Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-cbc.375.mcz ==================== Summary ==================== Name: Graphics-cbc.375 Author: cbc Time: 5 May 2017, 10:09:55.994065 am UUID: 882b31df-9e3e-234a-8591-d4b2ae912b91 Ancestors: Graphics-nice.374 Factored out remaining pieces of ExternalForm, simplifying Form methods in the process. Minimal support left there, in case you want to use ExternalForm in the future. New location of classes noted in Form comment. =============== Diff against Graphics-nice.374 =============== Item was changed: DisplayMedium subclass: #Form instanceVariableNames: 'bits width height depth offset' classVariableNames: '' poolDictionaries: '' category: 'Graphics-Display Objects'! + !Form commentStamp: 'cbc 5/5/2017 10:07' prior: 0! - !Form commentStamp: 'ls 1/4/2004 17:16' prior: 0! A rectangular array of pixels, used for holding images. All pictures, including character images are Forms. The depth of a Form is how many bits are used to specify the color at each pixel. The actual bits are held in a Bitmap, whose internal structure is different at each depth. Class Color allows you to deal with colors without knowing how they are actually encoded inside a Bitmap. The supported depths (in bits) are 1, 2, 4, 8, 16, and 32. The number of actual colors at these depths are: 2, 4, 16, 256, 32768, and 16 million. Forms are indexed starting at 0 instead of 1; thus, the top-left pixel of a Form has coordinates 0@0. Forms are combined using BitBlt. See the comment in class BitBlt. Forms that repeat many times to fill a large destination are InfiniteForms. colorAt: x@y Returns the abstract Color at this location displayAt: x@y shows this form on the screen displayOn: aMedium at: x@y shows this form in a Window, a Form, or other DisplayMedium fillColor: aColor Set all the pixels to the color. edit launch an editor to change the bits of this form. pixelValueAt: x@y The encoded color. The encoding depends on the depth. + + Note: If you want to hook up other external forms/displayScreens, please look at the (successful) Graphics-External package in http://www.squeaksource.com/Balloon3D.! - ! Item was changed: ----- Method: Form>>balancedPatternFor: (in category 'color mapping') ----- balancedPatternFor: aColor "Return the pixel word for representing the given color on the receiver" + ^aColor balancedPatternForDepth: self depth! - self hasNonStandardPalette - ifTrue:[^self bitPatternFor: aColor] - ifFalse:[^aColor balancedPatternForDepth: self depth]! Item was changed: ----- Method: Form>>bitPatternFor: (in category 'color mapping') ----- bitPatternFor: aColor "Return the pixel word for representing the given color on the receiver" + ^aColor bitPatternForDepth: self depth! - aColor isColor ifFalse:[^aColor bitPatternForDepth: self depth]. - self hasNonStandardPalette - ifTrue:[^Bitmap with: (self pixelWordFor: aColor)] - ifFalse:[^aColor bitPatternForDepth: self depth]! Item was changed: ----- Method: Form>>colormapFromARGB (in category 'color mapping') ----- colormapFromARGB "Return a ColorMap mapping from canonical ARGB space into the receiver. Note: This version is optimized for Squeak forms." | map nBits | - self hasNonStandardPalette - ifTrue:[^ColorMap mappingFromARGB: self rgbaBitMasks]. self depth <= 8 ifTrue:[ map := Color colorMapIfNeededFrom: 32 to: self depth. map size = 512 ifTrue:[nBits := 3]. map size = 4096 ifTrue:[nBits := 4]. map size = 32768 ifTrue:[nBits := 5]. ^ColorMap shifts: (Array with: 3 * nBits - 24 with: 2 * nBits - 16 with: 1 * nBits - 8 with: 0) masks: (Array with: (1 << nBits) - 1 << (24 - nBits) with: (1 << nBits) - 1 << (16 - nBits) with: (1 << nBits) - 1 << (8 - nBits) with: 0) colors: map]. self depth = 16 ifTrue:[ ^ColorMap shifts: #(-9 -6 -3 0) masks: #(16rF80000 16rF800 16rF8 0)]. self depth = 32 ifTrue:[ ^ColorMap shifts: #(0 0 0 0) masks: #(16rFF0000 16rFF00 16rFF 16rFF000000)]. self error:'Bad depth'! Item was changed: ----- Method: Form>>colormapToARGB (in category 'color mapping') ----- colormapToARGB "Return a ColorMap mapping from the receiver into canonical ARGB space." - self hasNonStandardPalette - ifTrue:[^self colormapFromARGB inverseMap]. self depth <= 8 ifTrue:[ ^ColorMap shifts: #(0 0 0 0) masks: #(16rFF0000 16rFF00 16rFF 16rFF000000) colors: (Color colorMapIfNeededFrom: self depth to: 32)]. self depth = 16 ifTrue:[ ^ColorMap shifts: #( 9 6 3 0) masks: #(16r7C00 16r3E0 16r1F 0)]. self depth = 32 ifTrue:[ ^ColorMap shifts: #(0 0 0 0) masks: #(16rFF0000 16rFF00 16rFF 16rFF000000)]. self error:'Bad depth'! Item was removed: - ----- Method: Form>>displayScreen (in category 'accessing') ----- - displayScreen - "Return the display screen the receiver is allocated on. - Forms in general are Squeak internal and not allocated on any particular display." - ^nil! Item was removed: - ----- Method: Form>>isBltAccelerated:for: (in category 'testing') ----- - isBltAccelerated: ruleInteger for: sourceForm - "Return true if the receiver can perform accelerated blts operations by itself" - ^false! Item was removed: - ----- Method: Form>>isExternalForm (in category 'testing') ----- - isExternalForm - ^false! Item was removed: - ----- Method: Form>>isFillAccelerated:for: (in category 'testing') ----- - isFillAccelerated: ruleInteger for: aColor - "Return true if the receiver can perform accelerated fill operations by itself" - ^false! Item was changed: ----- Method: Form>>pixelValueFor: (in category 'color mapping') ----- pixelValueFor: aColor "Return the pixel word for representing the given color on the receiver" + ^aColor pixelValueForDepth: self depth! - self hasNonStandardPalette - ifTrue:[^self colormapFromARGB mapPixel: (aColor pixelValueForDepth: 32)] - ifFalse:[^aColor pixelValueForDepth: self depth]! Item was changed: ----- Method: Form>>pixelWordFor: (in category 'color mapping') ----- pixelWordFor: aColor "Return the pixel word for representing the given color on the receiver" + ^aColor pixelWordForDepth: self depth! - | basicPattern | - self hasNonStandardPalette - ifFalse:[^aColor pixelWordForDepth: self depth]. - basicPattern := self pixelValueFor: aColor. - self depth = 32 - ifTrue:[^basicPattern] - ifFalse:[^aColor pixelWordFor: self depth filledWith: basicPattern]! |
Free forum by Nabble | Edit this page |