Eliot Miranda uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-eem.402.mcz ==================== Summary ==================== Name: Graphics-eem.402 Author: eem Time: 28 September 2018, 3:55:16.923545 pm UUID: 8982d87a-fe28-49e0-a900-d876452ce484 Ancestors: Graphics-bf.401 Fix BitBlt>>exampleOne for systems where a display depth of 1 is unsupported. =============== Diff against Graphics-bf.401 =============== Item was changed: ----- Method: BitBlt class>>exampleAt:rule:fillColor: (in category 'private') ----- exampleAt: originPoint rule: rule fillColor: mask "This builds a source and destination form and copies the source to the destination using the specifed rule and mask. It is called from the method named exampleOne. Only works with Display depth of 1" + ^self exampleOn: Display at: originPoint rule: rule fillColor: mask - | s d border aBitBlt | - border:=Form extent: 32@32. - border fillBlack. - border fill: (1@1 extent: 30@30) fillColor: Color white. - s := Form extent: 32@32. - s fillWhite. - s fillBlack: (7@7 corner: 25@25). - d := Form extent: 32@32. - d fillWhite. - d fillBlack: (0@0 corner: 32@16). + "BitBlt exampleAt: 100@100 rule: 0 fillColor: nil"! - s displayOn: Display at: originPoint. - border displayOn: Display at: originPoint rule: Form under. - d displayOn: Display at: originPoint + (s width @0). - border displayOn: Display at: originPoint + (s width @0) rule: Form under. - - d displayOn: Display at: originPoint + (s extent // (2 @ 1)). - aBitBlt := BitBlt - destForm: Display - sourceForm: s - fillColor: mask - combinationRule: rule - destOrigin: originPoint + (s extent // (2 @ 1)) - sourceOrigin: 0 @ 0 - extent: s extent - clipRect: Display computeBoundingBox. - aBitBlt copyBits. - border - displayOn: Display at: originPoint + (s extent // (2 @ 1)) - rule: Form under. - - "BitBlt exampleAt: 100@100 rule: 0 fillColor: nil" ! Item was added: + ----- Method: BitBlt class>>exampleOn:at:rule:fillColor: (in category 'private') ----- + exampleOn: destinationForm at: originPoint rule: rule fillColor: mask + "This builds a source and destination form and copies the source to the + destination using the specifed rule and mask. It is called from the method + named exampleOne. Only works with Display depth of 1" + + | s d border aBitBlt | + border:=Form extent: 32@32. + border fillBlack. + border fill: (1@1 extent: 30@30) fillColor: Color white. + s := Form extent: 32@32. + s fillWhite. + s fillBlack: (7@7 corner: 25@25). + d := Form extent: 32@32. + d fillWhite. + d fillBlack: (0@0 corner: 32@16). + + s displayOn: destinationForm at: originPoint. + border displayOn: destinationForm at: originPoint rule: Form under. + d displayOn: destinationForm at: originPoint + (s width @0). + border displayOn: destinationForm at: originPoint + (s width @0) rule: Form under. + + d displayOn: destinationForm at: originPoint + (s extent // (2 @ 1)). + aBitBlt := BitBlt + destForm: destinationForm + sourceForm: s + fillColor: mask + combinationRule: rule + destOrigin: originPoint + (s extent // (2 @ 1)) + sourceOrigin: 0 @ 0 + extent: s extent + clipRect: destinationForm computeBoundingBox. + aBitBlt copyBits. + border + displayOn: destinationForm at: originPoint + (s extent // (2 @ 1)) + rule: Form under. + + "BitBlt exampleOn: Display at: 100@100 rule: 0 fillColor: nil" ! Item was changed: ----- Method: BitBlt class>>exampleOne (in category 'examples') ----- exampleOne "This tests BitBlt by displaying the result of all sixteen combination rules that BitBlt is capable of using. (Please see the comment in BitBlt for the meaning of the combination rules). This only works at Display depth of 1. (Rule 15 does not work?)" + | pathClass path displayDepth destination | - | pathClass path displayDepth | + (Display supportsDisplayDepth: 1) + ifTrue: + [displayDepth := Display depth. + Display newDepth: 1. + destination := Display] + ifFalse: + [destination := Form extent: 480 @ 400 depth: 1]. - displayDepth := Display depth. - Display newDepth: 1. (Smalltalk hasClassNamed: #Path) ifTrue: [pathClass := Smalltalk at: #Path] ifFalse: [^self inform: 'MVC class Path not present in this image']. path := pathClass new. 0 to: 3 do: [:i | 0 to: 3 do: [:j | path add: j * 100 @ (i * 75)]]. + destination fillWhite. - Display fillWhite. path := path translateBy: 60 @ 40. + 1 to: 16 do: + [:index | + BitBlt + exampleOn: destination + at: (path at: index) - 1 to: 16 do: [:index | BitBlt - exampleAt: (path at: index) rule: index - 1 fillColor: nil]. + destination ~~ Display ifTrue: + [destination displayOn: Display at: 0 asPoint]. [Sensor anyButtonPressed] whileFalse: []. + displayDepth ifNotNil: [Display newDepth: displayDepth]. - Display newDepth: displayDepth. "BitBlt exampleOne"! |
Free forum by Nabble | Edit this page |