Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.379.mcz
==================== Summary ====================
Name: Graphics-mt.379
Author: mt
Time: 29 June 2017, 1:36:17.576613 pm
UUID: 150a8e87-27a9-e147-8ea5-ac166788fdb2
Ancestors: Graphics-mt.378
Fixed integration of color names with named crayon colors. Thanks to Ralph for pointing this out.
This works now: "Color banana name"
Note that I still do not follow up the scheme of having a class var for each named crayon color like the old named colors do. We can do this in the future if performance of named color access becomes an issue. Then, we could just opt for a caching dict and not a bunch of class vars. See MenuIcons for an example.
=============== Diff against Graphics-mt.378 ===============
Item was changed:
----- Method: Color class>>colorNames (in category 'other') -----
colorNames
"Return a collection of color names."
+ ^ ColorNames, self orderedCrayonColorNames!
- ^ ColorNames!
Item was added:
+ ----- Method: Color class>>orderedCrayonColorNames (in category 'other') -----
+ orderedCrayonColorNames
+
+ ^ #(cantaloupe honeydew spindrift sky lavender carnation licorice snow salmon banana flora ice orchid bubblegum lead mercury tangerine lime seaFoam aqua grape strawberry tungsten silver maraschino lemon spring turquoise blueberry magenta iron magnesium mocha fern moss ocean eggplant maroon steel aluminum cayenne asparagus clover teal midnight plum tin nickel)!
Item was changed:
----- Method: Color class>>orderedCrayonColors (in category 'other') -----
orderedCrayonColors
"self orderedCrayonColors explore."
+ ^ OrderedDictionary newFrom: (self orderedCrayonColorNames collect: [:ea | ea -> (self perform: ea)])!
- ^ OrderedDictionary newFrom: (#(cantaloupe honeydew spindrift sky lavender carnation licorice snow salmon banana flora ice orchid bubblegum lead mercury tangerine lime seaFoam aqua grape strawberry tungsten silver maraschino lemon spring turquoise blueberry magenta iron magnesium mocha fern moss ocean eggplant maroon steel aluminum cayenne asparagus clover teal midnight plum tin nickel) collect: [:ea |
- ea -> (self perform: ea)])!
Item was changed:
----- Method: Color>>name (in category 'other') -----
name
"Return this color's name, or nil if it has no name. Only returns a name if it exactly matches the named color."
+ ^ self class colorNames detect: [ :name | (Color perform: name) = self ] ifNone: [ nil ]!
- ^ColorNames detect: [ :name | (Color perform: name) = self ] ifNone: [ nil ]!
Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-cbc.299.mcz
==================== Summary ====================
Name: EToys-cbc.299
Author: cbc
Time: 5 May 2017, 9:58:32.239065 am
UUID: b55b1e92-af0e-b14b-b061-78e945c7dff7
Ancestors: EToys-ul.298
Removed Etoys-Squeakland-Graphics-External.
Its classes are now in http://www.squeaksource.com/Balloon3D
=============== Diff against EToys-ul.298 ===============
Item was changed:
SystemOrganization addCategory: #'Etoys-Buttons'!
SystemOrganization addCategory: #'Etoys-CustomEvents'!
SystemOrganization addCategory: #'Etoys-Experimental'!
SystemOrganization addCategory: #'Etoys-Outliner'!
SystemOrganization addCategory: #'Etoys-Protocols'!
SystemOrganization addCategory: #'Etoys-Protocols-Type Vocabularies'!
SystemOrganization addCategory: #'Etoys-Scripting'!
SystemOrganization addCategory: #'Etoys-Scripting Support'!
SystemOrganization addCategory: #'Etoys-Scripting Tiles'!
SystemOrganization addCategory: #'Etoys-Squeakland-BroomMorphs-Base'!
SystemOrganization addCategory: #'Etoys-Squeakland-BroomMorphs-Connectors'!
SystemOrganization addCategory: #'Etoys-Squeakland-EToys-Kedama'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Buttons'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Calendar'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Debugger'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Help'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Input'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting Tiles'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-SpeechBubbles'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Tile Scriptors'!
- SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-External'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Text'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Intersection'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Simplification'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Triangulation'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-AdditionalMorphs'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Charts'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Postscript Filters'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-WebCam'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Basic'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Books'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Components'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Demo'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Experimental'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Games'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Games-Chess'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-GeeMail'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Kernel'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Mentoring'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Navigators'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-PartsBin'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-PDA'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Windows'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Worlds'!
SystemOrganization addCategory: #'Etoys-Squeakland-Multilingual-Languages'!
SystemOrganization addCategory: #'Etoys-Squeakland-Multilingual-TextConversion'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Formatter'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Forms'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Parser'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Parser Entities'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Tokenizer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-MIME'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-TelNet WordNet'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-UI'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-Url'!
SystemOrganization addCategory: #'Etoys-Squeakland-Protocols-Type Vocabularies'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Interface'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Ogg'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Scores'!
SystemOrganization addCategory: #'Etoys-Squeakland-ST80-Morphic'!
SystemOrganization addCategory: #'Etoys-Squeakland-SUnit'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sugar'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Clipboard-Extended'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Compiler'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Exceptions Kernel'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Changes'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Explorer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Process Browser'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ObjectVectors'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ParseTreeTransformer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ParseTree-AttributeDefinition'!
SystemOrganization addCategory: #'Etoys-Stacks'!
SystemOrganization addCategory: #'Etoys-StarSqueak'!
SystemOrganization addCategory: #'Etoys-Support'!
SystemOrganization addCategory: #'Etoys-Tests'!
SystemOrganization addCategory: #'Etoys-Tile Scriptors'!
SystemOrganization addCategory: #'Etoys-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-SISS-Serialization'!
SystemOrganization addCategory: #'Etoys-OLPC-Display'!
SystemOrganization addCategory: #'Etoys-ReleaseBuilder'!
SystemOrganization addCategory: #'Etoys-UserInterfaceTheme'!
Item was removed:
- Form subclass: #ExternalForm
- instanceVariableNames: 'display argbMap'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalForm commentStamp: '<historical>' prior: 0!
- An ExternalForm is just like any other form. It's only difference is that it is allocated on a specific display and can be used for accelerated blts on the particular display.
-
- Upon shutdown of the system ExternalForms will be deallocated from the display and be kept in their internalized form.!
Item was removed:
- ----- Method: ExternalForm>>colormapFromARGB (in category 'accessing') -----
- colormapFromARGB
- "Return a ColorMap mapping from canonical ARGB pixel values into the receiver"
- ^argbMap ifNil:[argbMap := ColorMap mappingFromARGB: self rgbaBitMasks].!
Item was removed:
- ----- Method: ExternalForm>>colormapFromARGB: (in category 'accessing') -----
- colormapFromARGB: aMap
- "Set the ColorMap mapping from canonical ARGB pixel values into the receiver"
- argbMap := aMap!
Item was removed:
- ----- Method: ExternalForm>>destroy (in category 'initialize-release') -----
- destroy
- "Destroy the receiver"
- display ifNotNil:[display destroyForm: self]!
Item was removed:
- ----- Method: ExternalForm>>displayScreen (in category 'accessing') -----
- displayScreen
- "Return the display screen the receiver is allocated on."
- ^display!
Item was removed:
- ----- Method: ExternalForm>>getExternalHandle (in category 'private') -----
- getExternalHandle
- "Private. Return the virtual handle used to represent the receiver"
- ^bits!
Item was removed:
- ----- Method: ExternalForm>>hasNonStandardPalette (in category 'testing') -----
- hasNonStandardPalette
- "Quite possible."
- ^display notNil or:[argbMap notNil]!
Item was removed:
- ----- Method: ExternalForm>>isExternalForm (in category 'testing') -----
- isExternalForm
- "I am an external form but only as long as I'm allocated on a display"
- ^display notNil!
Item was removed:
- ----- Method: ExternalForm>>rgbaBitMasks (in category 'accessing') -----
- rgbaBitMasks
- "Return the masks for specifying the R,G,B, and A components in the receiver"
- display
- ifNil:[^super rgbaBitMasks]
- ifNotNil:[^display rgbaBitMasksOfForm: self]!
Item was removed:
- ----- Method: ExternalForm>>setExternalHandle:on: (in category 'private') -----
- setExternalHandle: aHandle on: aDisplay
- "Initialize the receiver from the given external handle"
- display := aDisplay.
- bits := aHandle.!
Item was removed:
- ----- Method: ExternalForm>>shutDown (in category 'initialize-release') -----
- shutDown
- "System is going down. Internalize my bits and be finished."
- | copy |
- copy := Form extent: self extent depth: self depth.
- self displayOn: copy.
- copy hibernate. "compact bits of copy"
- self destroy. "Release my external handle"
- bits := copy bits. "Now compressed"
- display := nil. "No longer allocated"
- argbMap := nil. "No longer external"!
Item was removed:
- WeakKeyDictionary subclass: #ExternalFormRegistry
- instanceVariableNames: 'lockFlag'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalFormRegistry commentStamp: '<historical>' prior: 0!
- The ExternalFormRegistry needs to be synchronized with rendering to prevent forms from being destroyed during rendering. Only at certain points (that is after a rendering cycle is completed) the texture registry may be cleaned up.!
Item was removed:
- ----- Method: ExternalFormRegistry>>finalizeValues (in category 'finalization') -----
- finalizeValues
- "This message is sent when an element has gone away."
- lockFlag == true ifTrue:[^self].
- self forceFinalization.!
Item was removed:
- ----- Method: ExternalFormRegistry>>forceFinalization (in category 'finalization') -----
- forceFinalization
- self associationsDo:[:assoc|
- assoc key isNil ifTrue:[assoc value destroy].
- ].
- super finalizeValues.!
Item was removed:
- ----- Method: ExternalFormRegistry>>lock (in category 'accessing') -----
- lock
- lockFlag := true!
Item was removed:
- ----- Method: ExternalFormRegistry>>unlock (in category 'accessing') -----
- unlock
- lockFlag := false.!
Item was removed:
- DisplayScreen subclass: #ExternalScreen
- instanceVariableNames: 'argbMap allocatedForms'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalScreen commentStamp: '<historical>' prior: 0!
- I represent a DisplayScreen that is not part of the Squeak universe. Subclasses must implement the appropriate primitives for creating, destroying and allocating the appropriate external objects.
-
- Note: It is assumed that all external display surfaces are accessible by FXBlt, meaning that any support code must register the surfaces with the surface plugin. This requires that the support code will have a way of accessing the bits of the surface. Although this can be terribly expensive (such as on X where a roundtrip to the server might be required or for an OpenGL display where glReadPixels usually is slow as hell) the appropriate methods should be implemented. This allows for a gradual transition to less expensive model (such as implementing an X11Canvas supporting the drawing primitives of X) and is therefore the preferred solution.
-
- In the eventual case that it's known that BitBlt/FXBlt will *never* be used in conjunction with a particular drawing surface, the support code should return a handle that is a) not a SmallInteger (these are used by the surface plugin) and b) not of the 'bitsSize' of a Form. One possible representation for such a handle would be a ByteArray of a non-integral word size (e.g., a ByteArray of size 5,6, or 7). In this case, all attempts to use FXBlt with the drawing surface will simply fail.
- !
Item was removed:
- ----- Method: ExternalScreen>>allocateForm: (in category 'form support') -----
- allocateForm: extentPoint
- "Allocate a new form which is similar to the receiver and can be used for accelerated blts"
- | formHandle displayForm |
- formHandle := self primAllocateForm: self depth width: extentPoint x height: extentPoint y.
- formHandle = nil ifTrue:[^super allocateForm: extentPoint].
- displayForm := (ExternalForm extent: extentPoint depth: self depth bits: nil)
- setExternalHandle: formHandle on: self.
- allocatedForms at: displayForm put: displayForm executor.
- ^displayForm!
Item was removed:
- ----- Method: ExternalScreen>>colormapFromARGB (in category 'accessing') -----
- colormapFromARGB
- "Return a ColorMap mapping from canonical ARGB pixel values into the receiver"
- ^argbMap ifNil:[argbMap := ColorMap mappingFromARGB: self rgbaBitMasks].!
Item was removed:
- ----- Method: ExternalScreen>>copyBits:from:at:clippingBox:rule:fillColor:map: (in category 'blitting support') -----
- copyBits: sourceRect from: sourceForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf map: map
- "Attempt to accelerate blts to the receiver"
- | r |
- ((self isBltAccelerated: rule for: sourceForm) and:[map == nil and:[hf == nil]]) ifTrue:[
- "Try an accelerated blt"
- r := (destOrigin extent: sourceRect extent) intersect: (clipRect intersect: clippingBox).
- r area <= 0 ifTrue:[^self].
- (self primBltFast: bits from: sourceForm getExternalHandle
- at: r origin from: sourceRect origin
- extent: r extent) ifNotNil:[^self].
- ].
- ^super copyBits: sourceRect from: sourceForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf map: map!
Item was removed:
- ----- Method: ExternalScreen>>destroy (in category 'initialize-release') -----
- destroy
- "Destroy the receiver"
- allocatedForms ifNotNil:[
- allocatedForms lock. "Make sure we don't get interrupted"
- allocatedForms forceFinalization. "Clean up all lost references"
- allocatedForms keys do:[:stillValid| stillValid shutDown].
- "All remaining references are simply destroyed"
- allocatedForms associationsDo:[:assoc| assoc key: nil].
- allocatedForms forceFinalization. "destroy all others"
- allocatedForms := nil.
- ].
- bits ifNotNil:[self primDestroyDisplaySurface: bits].
- bits := nil.!
Item was removed:
- ----- Method: ExternalScreen>>destroyForm: (in category 'form support') -----
- destroyForm: anExternalForm
- "Destroy the given external form"
- self primDestroyForm: anExternalForm getExternalHandle.
- anExternalForm setExternalHandle: nil on: nil.
- allocatedForms removeKey: anExternalForm ifAbsent:[].!
Item was removed:
- ----- Method: ExternalScreen>>displayOn:at:clippingBox:rule:fillColor: (in category 'blitting support') -----
- displayOn: destForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf
- "Attempt to accelerate blts to aDisplayMedium"
- | sourceRect |
- ((self isBltAccelerated: rule for: destForm) and:[hf = nil]) ifTrue:[
- "Try an accelerated blt"
- sourceRect := (clipRect translateBy: destOrigin negated) intersect: clippingBox.
- (self primBltFast: bits to: destForm getExternalHandle
- at: 0@0 from: sourceRect origin
- extent: sourceRect extent) ifNotNil:[^self]].
- destForm copyBits: self boundingBox
- from: self
- at: destOrigin + self offset
- clippingBox: clipRect
- rule: rule
- fillColor: hf
- map: (self colormapIfNeededFor: destForm).
- !
Item was removed:
- ----- Method: ExternalScreen>>fill:rule:fillColor: (in category 'blitting support') -----
- fill: aRectangle rule: anInteger fillColor: aColor
- "Replace a rectangular area of the receiver with the pattern described by aForm
- according to the rule anInteger."
- | rect |
- (self isFillAccelerated: anInteger for: aColor) ifTrue:[
- rect := aRectangle intersect: clippingBox.
- (self primFill: bits
- color: (self pixelWordFor: aColor)
- x: rect left
- y: rect top
- w: rect width
- h: rect height) ifNotNil:[^self]].
- ^super fill: aRectangle rule: anInteger fillColor: aColor!
Item was removed:
- ----- Method: ExternalScreen>>finish (in category 'initialize-release') -----
- finish
- "Flush the receiver"
- self primFinish: bits.
- "Now is the time to do some cleanup"
- allocatedForms unlock.
- allocatedForms finalizeValues.!
Item was removed:
- ----- Method: ExternalScreen>>flush (in category 'initialize-release') -----
- flush
- "Flush the receiver"
- self primFlush: bits.!
Item was removed:
- ----- Method: ExternalScreen>>hasNonStandardPalette (in category 'testing') -----
- hasNonStandardPalette
- "Quite possible."
- ^true!
Item was removed:
- ----- Method: ExternalScreen>>isBltAccelerated:for: (in category 'blitting support') -----
- isBltAccelerated: ruleInteger for: aForm
- "Return true if the receiver can perform accelerated blt operations by itself.
- It is assumed that blts of forms allocated on the receiverusing Form>>over
- may be accelerated.
- Although some hardware may allow source-key blts (that is, Form>>paint or similar)
- this is usually questionable and the additional effort for allocating and
- maintaining the OS form doesn't quite seem worth the effort."
- ^aForm displayScreen == self and:[ruleInteger = Form over]!
Item was removed:
- ----- Method: ExternalScreen>>isExternalForm (in category 'testing') -----
- isExternalForm
- "Sorta. Kinda."
- ^true!
Item was removed:
- ----- Method: ExternalScreen>>isFillAccelerated:for: (in category 'blitting support') -----
- isFillAccelerated: ruleInteger for: aColor
- "Return true if the receiver can perform accelerated fill operations by itself.
- It is assumed that the hardware can accelerate plain color fill operations."
- ^ruleInteger = Form over and:[aColor isColor]!
Item was removed:
- ----- Method: ExternalScreen>>primAllocateForm:width:height: (in category 'primitives-forms') -----
- primAllocateForm: d width: w height: h
- "Primitive. Allocate a form with the given parameters"
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primBltFast:from:at:from:extent: (in category 'primitives-display') -----
- primBltFast: displayHandle from: sourceHandle at: destOrigin from: sourceOrigin extent: extent
- "Primitive. Perform a fast blt operation. Return the receiver if successful."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primBltFast:to:at:from:extent: (in category 'primitives-display') -----
- primBltFast: displayHandle to: dstHandle at: destOrigin from: sourceOrigin extent: extent
- "Primitive. Perform a fast blt operation. Return the receiver if successful."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primCreateDisplaySurface:width:height: (in category 'primitives-display') -----
- primCreateDisplaySurface: d width: w height: h
- "Primitive. Create a new external display surface. Return the handle used to identify the receiver. Fail if the surface cannot be created."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDestroyDisplaySurface: (in category 'primitives-display') -----
- primDestroyDisplaySurface: aHandle
- "Primitive. Destroy the display surface associated with the given handle."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDestroyForm: (in category 'primitives-forms') -----
- primDestroyForm: aHandle
- "Primitive. Destroy the form associated with the given handle."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDisplay:colorMasksInto: (in category 'primitives-display') -----
- primDisplay: aHandle colorMasksInto: anArray
- "Primitive. Store the bit masks for each color into the given array."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFill:color:x:y:w:h: (in category 'primitives-display') -----
- primFill: handle color: pixelWord x: x y: y w: w h: h
- "Primitive. Perform an accelerated fill operation on the receiver."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFinish: (in category 'primitives-display') -----
- primFinish: aHandle
- "Primitive. Finish all rendering operations on the receiver.
- Do not return before all rendering operations have taken effect."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFlush: (in category 'primitives-display') -----
- primFlush: aHandle
- "Primitive. If any rendering operations are pending, force them to be executed.
- Do not wait until they have taken effect."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primForm:colorMasksInto: (in category 'primitives-forms') -----
- primForm: aHandle colorMasksInto: anArray
- "Primitive. Store the bit masks for each color into the given array."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>release (in category 'initialize-release') -----
- release
- "I am no longer Display. Release any resources if necessary"
- self destroy!
Item was removed:
- ----- Method: ExternalScreen>>rgbaBitMasks (in category 'accessing') -----
- rgbaBitMasks
- "Return the masks for specifying the R,G,B, and A components in the receiver"
- | rgbaBitMasks |
- rgbaBitMasks := Array new: 4.
- self primDisplay: bits colorMasksInto: rgbaBitMasks.
- ^rgbaBitMasks!
Item was removed:
- ----- Method: ExternalScreen>>rgbaBitMasksOfForm: (in category 'form support') -----
- rgbaBitMasksOfForm: anExternalForm
- | rgbaBitMasks |
- rgbaBitMasks := Array new: 4.
- self primForm: anExternalForm getExternalHandle colorMasksInto: rgbaBitMasks.
- ^rgbaBitMasks!
Item was removed:
- ----- Method: ExternalScreen>>setExtent:depth: (in category 'private') -----
- setExtent: aPoint depth: bitsPerPixel
- "Create a 3D accelerated display screen"
- | screen |
- (bits isInteger and:[depth == bitsPerPixel and: [aPoint = self extent and:
- [self supportsDisplayDepth: bitsPerPixel]]]) ifFalse: [
- bits ifNotNil:[self primDestroyDisplaySurface: bits].
- bits := nil. "Free up old bitmap in case space is low"
- DisplayChangeSignature := (DisplayChangeSignature ifNil: [0]) + 1.
- (self supportsDisplayDepth: bitsPerPixel)
- ifTrue:[depth := bitsPerPixel]
- ifFalse:["Search for a suitable depth"
- depth := self findAnyDisplayDepthIfNone:[nil]].
- depth == nil ifFalse:[
- bits := self primCreateDisplaySurface: depth
- width: aPoint x height: aPoint y].
- "Bail out if surface could not be created"
- (bits == nil) ifTrue:[
- screen := DisplayScreen extent: aPoint depth: bitsPerPixel.
- self == Display ifTrue:[
- Display := screen.
- Display beDisplay].
- ^screen].
- width := aPoint x.
- height := aPoint y.
- ].
- clippingBox := super boundingBox.
- allocatedForms ifNil:[
- allocatedForms := ExternalFormRegistry new.
- WeakArray addWeakDependent: allocatedForms].
- !
Item was removed:
- ----- Method: ExternalScreen>>shutDown (in category 'initialize-release') -----
- shutDown
- "Minimize Display memory saved in image"
- self destroy.
- width := 240.
- height := 120.
- bits := Bitmap new: self bitsSize.!
Item was removed:
- ----- Method: ExternalScreen>>supportsDisplayDepth: (in category 'primitives-display') -----
- supportsDisplayDepth: pixelDepth
- "Return true if this pixel depth is supported on the current host platform."
- ^false!
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]!
Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-mt.301.mcz
==================== Summary ====================
Name: EToys-mt.301
Author: mt
Time: 29 June 2017, 11:45:31.324967 am
UUID: ec8bb02f-eba1-114a-8bfb-41c41cfd5736
Ancestors: EToys-nice.300, EToys-cbc.299
Merges cbc.299
See http://forum.world.st/Updated-and-finished-removal-of-ExternalForm-and-rela…
=============== Diff against EToys-nice.300 ===============
Item was changed:
SystemOrganization addCategory: #'Etoys-Buttons'!
SystemOrganization addCategory: #'Etoys-CustomEvents'!
SystemOrganization addCategory: #'Etoys-Experimental'!
SystemOrganization addCategory: #'Etoys-Outliner'!
SystemOrganization addCategory: #'Etoys-Protocols'!
SystemOrganization addCategory: #'Etoys-Protocols-Type Vocabularies'!
SystemOrganization addCategory: #'Etoys-Scripting'!
SystemOrganization addCategory: #'Etoys-Scripting Support'!
SystemOrganization addCategory: #'Etoys-Scripting Tiles'!
SystemOrganization addCategory: #'Etoys-Squeakland-BroomMorphs-Base'!
SystemOrganization addCategory: #'Etoys-Squeakland-BroomMorphs-Connectors'!
SystemOrganization addCategory: #'Etoys-Squeakland-EToys-Kedama'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Buttons'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Calendar'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Debugger'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Help'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Input'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Scripting Tiles'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-SpeechBubbles'!
SystemOrganization addCategory: #'Etoys-Squeakland-Etoys-Tile Scriptors'!
- SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-External'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Text'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Intersection'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Simplification'!
SystemOrganization addCategory: #'Etoys-Squeakland-Graphics-Tools-Triangulation'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-AdditionalMorphs'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Charts'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Postscript Filters'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-WebCam'!
SystemOrganization addCategory: #'Etoys-Squeakland-MorphicExtras-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Basic'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Books'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Components'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Demo'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Experimental'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Games'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Games-Chess'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-GeeMail'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Kernel'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Mentoring'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Navigators'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-PartsBin'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-PDA'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Windows'!
SystemOrganization addCategory: #'Etoys-Squeakland-Morphic-Worlds'!
SystemOrganization addCategory: #'Etoys-Squeakland-Multilingual-Languages'!
SystemOrganization addCategory: #'Etoys-Squeakland-Multilingual-TextConversion'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Formatter'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Forms'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Parser'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Parser Entities'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-HTML-Tokenizer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-MIME'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-TelNet WordNet'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-UI'!
SystemOrganization addCategory: #'Etoys-Squeakland-Network-Url'!
SystemOrganization addCategory: #'Etoys-Squeakland-Protocols-Type Vocabularies'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Interface'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Ogg'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sound-Scores'!
SystemOrganization addCategory: #'Etoys-Squeakland-ST80-Morphic'!
SystemOrganization addCategory: #'Etoys-Squeakland-SUnit'!
SystemOrganization addCategory: #'Etoys-Squeakland-Sugar'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Clipboard-Extended'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Compiler'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Exceptions Kernel'!
SystemOrganization addCategory: #'Etoys-Squeakland-System-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Changes'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Explorer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tools-Process Browser'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ObjectVectors'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ParseTreeTransformer'!
SystemOrganization addCategory: #'Etoys-Squeakland-Tweak-Kedama-ParseTree-AttributeDefinition'!
SystemOrganization addCategory: #'Etoys-Stacks'!
SystemOrganization addCategory: #'Etoys-StarSqueak'!
SystemOrganization addCategory: #'Etoys-Support'!
SystemOrganization addCategory: #'Etoys-Tests'!
SystemOrganization addCategory: #'Etoys-Tile Scriptors'!
SystemOrganization addCategory: #'Etoys-Widgets'!
SystemOrganization addCategory: #'Etoys-Squeakland-Support'!
SystemOrganization addCategory: #'Etoys-Squeakland-SISS-Serialization'!
SystemOrganization addCategory: #'Etoys-OLPC-Display'!
SystemOrganization addCategory: #'Etoys-ReleaseBuilder'!
SystemOrganization addCategory: #'Etoys-UserInterfaceTheme'!
Item was removed:
- Form subclass: #ExternalForm
- instanceVariableNames: 'display argbMap'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalForm commentStamp: '<historical>' prior: 0!
- An ExternalForm is just like any other form. It's only difference is that it is allocated on a specific display and can be used for accelerated blts on the particular display.
-
- Upon shutdown of the system ExternalForms will be deallocated from the display and be kept in their internalized form.!
Item was removed:
- ----- Method: ExternalForm>>colormapFromARGB (in category 'accessing') -----
- colormapFromARGB
- "Return a ColorMap mapping from canonical ARGB pixel values into the receiver"
- ^argbMap ifNil:[argbMap := ColorMap mappingFromARGB: self rgbaBitMasks].!
Item was removed:
- ----- Method: ExternalForm>>colormapFromARGB: (in category 'accessing') -----
- colormapFromARGB: aMap
- "Set the ColorMap mapping from canonical ARGB pixel values into the receiver"
- argbMap := aMap!
Item was removed:
- ----- Method: ExternalForm>>destroy (in category 'initialize-release') -----
- destroy
- "Destroy the receiver"
- display ifNotNil:[display destroyForm: self]!
Item was removed:
- ----- Method: ExternalForm>>displayScreen (in category 'accessing') -----
- displayScreen
- "Return the display screen the receiver is allocated on."
- ^display!
Item was removed:
- ----- Method: ExternalForm>>getExternalHandle (in category 'private') -----
- getExternalHandle
- "Private. Return the virtual handle used to represent the receiver"
- ^bits!
Item was removed:
- ----- Method: ExternalForm>>hasNonStandardPalette (in category 'testing') -----
- hasNonStandardPalette
- "Quite possible."
- ^display notNil or:[argbMap notNil]!
Item was removed:
- ----- Method: ExternalForm>>isExternalForm (in category 'testing') -----
- isExternalForm
- "I am an external form but only as long as I'm allocated on a display"
- ^display notNil!
Item was removed:
- ----- Method: ExternalForm>>rgbaBitMasks (in category 'accessing') -----
- rgbaBitMasks
- "Return the masks for specifying the R,G,B, and A components in the receiver"
- display
- ifNil:[^super rgbaBitMasks]
- ifNotNil:[^display rgbaBitMasksOfForm: self]!
Item was removed:
- ----- Method: ExternalForm>>setExternalHandle:on: (in category 'private') -----
- setExternalHandle: aHandle on: aDisplay
- "Initialize the receiver from the given external handle"
- display := aDisplay.
- bits := aHandle.!
Item was removed:
- ----- Method: ExternalForm>>shutDown (in category 'initialize-release') -----
- shutDown
- "System is going down. Internalize my bits and be finished."
- | copy |
- copy := Form extent: self extent depth: self depth.
- self displayOn: copy.
- copy hibernate. "compact bits of copy"
- self destroy. "Release my external handle"
- bits := copy bits. "Now compressed"
- display := nil. "No longer allocated"
- argbMap := nil. "No longer external"!
Item was removed:
- WeakKeyDictionary subclass: #ExternalFormRegistry
- instanceVariableNames: 'lockFlag'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalFormRegistry commentStamp: '<historical>' prior: 0!
- The ExternalFormRegistry needs to be synchronized with rendering to prevent forms from being destroyed during rendering. Only at certain points (that is after a rendering cycle is completed) the texture registry may be cleaned up.!
Item was removed:
- ----- Method: ExternalFormRegistry>>finalizeValues (in category 'finalization') -----
- finalizeValues
- "This message is sent when an element has gone away."
- lockFlag == true ifTrue:[^self].
- self forceFinalization.!
Item was removed:
- ----- Method: ExternalFormRegistry>>forceFinalization (in category 'finalization') -----
- forceFinalization
- self associationsDo:[:assoc|
- assoc key isNil ifTrue:[assoc value destroy].
- ].
- super finalizeValues.!
Item was removed:
- ----- Method: ExternalFormRegistry>>lock (in category 'accessing') -----
- lock
- lockFlag := true!
Item was removed:
- ----- Method: ExternalFormRegistry>>unlock (in category 'accessing') -----
- unlock
- lockFlag := false.!
Item was removed:
- DisplayScreen subclass: #ExternalScreen
- instanceVariableNames: 'argbMap allocatedForms'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Etoys-Squeakland-Graphics-External'!
-
- !ExternalScreen commentStamp: '<historical>' prior: 0!
- I represent a DisplayScreen that is not part of the Squeak universe. Subclasses must implement the appropriate primitives for creating, destroying and allocating the appropriate external objects.
-
- Note: It is assumed that all external display surfaces are accessible by FXBlt, meaning that any support code must register the surfaces with the surface plugin. This requires that the support code will have a way of accessing the bits of the surface. Although this can be terribly expensive (such as on X where a roundtrip to the server might be required or for an OpenGL display where glReadPixels usually is slow as hell) the appropriate methods should be implemented. This allows for a gradual transition to less expensive model (such as implementing an X11Canvas supporting the drawing primitives of X) and is therefore the preferred solution.
-
- In the eventual case that it's known that BitBlt/FXBlt will *never* be used in conjunction with a particular drawing surface, the support code should return a handle that is a) not a SmallInteger (these are used by the surface plugin) and b) not of the 'bitsSize' of a Form. One possible representation for such a handle would be a ByteArray of a non-integral word size (e.g., a ByteArray of size 5,6, or 7). In this case, all attempts to use FXBlt with the drawing surface will simply fail.
- !
Item was removed:
- ----- Method: ExternalScreen>>allocateForm: (in category 'form support') -----
- allocateForm: extentPoint
- "Allocate a new form which is similar to the receiver and can be used for accelerated blts"
- | formHandle displayForm |
- formHandle := self primAllocateForm: self depth width: extentPoint x height: extentPoint y.
- formHandle = nil ifTrue:[^super allocateForm: extentPoint].
- displayForm := (ExternalForm extent: extentPoint depth: self depth bits: nil)
- setExternalHandle: formHandle on: self.
- allocatedForms at: displayForm put: displayForm executor.
- ^displayForm!
Item was removed:
- ----- Method: ExternalScreen>>colormapFromARGB (in category 'accessing') -----
- colormapFromARGB
- "Return a ColorMap mapping from canonical ARGB pixel values into the receiver"
- ^argbMap ifNil:[argbMap := ColorMap mappingFromARGB: self rgbaBitMasks].!
Item was removed:
- ----- Method: ExternalScreen>>copyBits:from:at:clippingBox:rule:fillColor:map: (in category 'blitting support') -----
- copyBits: sourceRect from: sourceForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf map: map
- "Attempt to accelerate blts to the receiver"
- | r |
- ((self isBltAccelerated: rule for: sourceForm) and:[map == nil and:[hf == nil]]) ifTrue:[
- "Try an accelerated blt"
- r := (destOrigin extent: sourceRect extent) intersect: (clipRect intersect: clippingBox).
- r area <= 0 ifTrue:[^self].
- (self primBltFast: bits from: sourceForm getExternalHandle
- at: r origin from: sourceRect origin
- extent: r extent) ifNotNil:[^self].
- ].
- ^super copyBits: sourceRect from: sourceForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf map: map!
Item was removed:
- ----- Method: ExternalScreen>>destroy (in category 'initialize-release') -----
- destroy
- "Destroy the receiver"
- allocatedForms ifNotNil:[
- allocatedForms lock. "Make sure we don't get interrupted"
- allocatedForms forceFinalization. "Clean up all lost references"
- allocatedForms keys do:[:stillValid| stillValid shutDown].
- "All remaining references are simply destroyed"
- allocatedForms associationsDo:[:assoc| assoc key: nil].
- allocatedForms forceFinalization. "destroy all others"
- allocatedForms := nil.
- ].
- bits ifNotNil:[self primDestroyDisplaySurface: bits].
- bits := nil.!
Item was removed:
- ----- Method: ExternalScreen>>destroyForm: (in category 'form support') -----
- destroyForm: anExternalForm
- "Destroy the given external form"
- self primDestroyForm: anExternalForm getExternalHandle.
- anExternalForm setExternalHandle: nil on: nil.
- allocatedForms removeKey: anExternalForm ifAbsent:[].!
Item was removed:
- ----- Method: ExternalScreen>>displayOn:at:clippingBox:rule:fillColor: (in category 'blitting support') -----
- displayOn: destForm at: destOrigin clippingBox: clipRect rule: rule fillColor: hf
- "Attempt to accelerate blts to aDisplayMedium"
- | sourceRect |
- ((self isBltAccelerated: rule for: destForm) and:[hf = nil]) ifTrue:[
- "Try an accelerated blt"
- sourceRect := (clipRect translateBy: destOrigin negated) intersect: clippingBox.
- (self primBltFast: bits to: destForm getExternalHandle
- at: 0@0 from: sourceRect origin
- extent: sourceRect extent) ifNotNil:[^self]].
- destForm copyBits: self boundingBox
- from: self
- at: destOrigin + self offset
- clippingBox: clipRect
- rule: rule
- fillColor: hf
- map: (self colormapIfNeededFor: destForm).
- !
Item was removed:
- ----- Method: ExternalScreen>>fill:rule:fillColor: (in category 'blitting support') -----
- fill: aRectangle rule: anInteger fillColor: aColor
- "Replace a rectangular area of the receiver with the pattern described by aForm
- according to the rule anInteger."
- | rect |
- (self isFillAccelerated: anInteger for: aColor) ifTrue:[
- rect := aRectangle intersect: clippingBox.
- (self primFill: bits
- color: (self pixelWordFor: aColor)
- x: rect left
- y: rect top
- w: rect width
- h: rect height) ifNotNil:[^self]].
- ^super fill: aRectangle rule: anInteger fillColor: aColor!
Item was removed:
- ----- Method: ExternalScreen>>finish (in category 'initialize-release') -----
- finish
- "Flush the receiver"
- self primFinish: bits.
- "Now is the time to do some cleanup"
- allocatedForms unlock.
- allocatedForms finalizeValues.!
Item was removed:
- ----- Method: ExternalScreen>>flush (in category 'initialize-release') -----
- flush
- "Flush the receiver"
- self primFlush: bits.!
Item was removed:
- ----- Method: ExternalScreen>>hasNonStandardPalette (in category 'testing') -----
- hasNonStandardPalette
- "Quite possible."
- ^true!
Item was removed:
- ----- Method: ExternalScreen>>isBltAccelerated:for: (in category 'blitting support') -----
- isBltAccelerated: ruleInteger for: aForm
- "Return true if the receiver can perform accelerated blt operations by itself.
- It is assumed that blts of forms allocated on the receiverusing Form>>over
- may be accelerated.
- Although some hardware may allow source-key blts (that is, Form>>paint or similar)
- this is usually questionable and the additional effort for allocating and
- maintaining the OS form doesn't quite seem worth the effort."
- ^aForm displayScreen == self and:[ruleInteger = Form over]!
Item was removed:
- ----- Method: ExternalScreen>>isExternalForm (in category 'testing') -----
- isExternalForm
- "Sorta. Kinda."
- ^true!
Item was removed:
- ----- Method: ExternalScreen>>isFillAccelerated:for: (in category 'blitting support') -----
- isFillAccelerated: ruleInteger for: aColor
- "Return true if the receiver can perform accelerated fill operations by itself.
- It is assumed that the hardware can accelerate plain color fill operations."
- ^ruleInteger = Form over and:[aColor isColor]!
Item was removed:
- ----- Method: ExternalScreen>>primAllocateForm:width:height: (in category 'primitives-forms') -----
- primAllocateForm: d width: w height: h
- "Primitive. Allocate a form with the given parameters"
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primBltFast:from:at:from:extent: (in category 'primitives-display') -----
- primBltFast: displayHandle from: sourceHandle at: destOrigin from: sourceOrigin extent: extent
- "Primitive. Perform a fast blt operation. Return the receiver if successful."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primBltFast:to:at:from:extent: (in category 'primitives-display') -----
- primBltFast: displayHandle to: dstHandle at: destOrigin from: sourceOrigin extent: extent
- "Primitive. Perform a fast blt operation. Return the receiver if successful."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primCreateDisplaySurface:width:height: (in category 'primitives-display') -----
- primCreateDisplaySurface: d width: w height: h
- "Primitive. Create a new external display surface. Return the handle used to identify the receiver. Fail if the surface cannot be created."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDestroyDisplaySurface: (in category 'primitives-display') -----
- primDestroyDisplaySurface: aHandle
- "Primitive. Destroy the display surface associated with the given handle."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDestroyForm: (in category 'primitives-forms') -----
- primDestroyForm: aHandle
- "Primitive. Destroy the form associated with the given handle."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primDisplay:colorMasksInto: (in category 'primitives-display') -----
- primDisplay: aHandle colorMasksInto: anArray
- "Primitive. Store the bit masks for each color into the given array."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFill:color:x:y:w:h: (in category 'primitives-display') -----
- primFill: handle color: pixelWord x: x y: y w: w h: h
- "Primitive. Perform an accelerated fill operation on the receiver."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFinish: (in category 'primitives-display') -----
- primFinish: aHandle
- "Primitive. Finish all rendering operations on the receiver.
- Do not return before all rendering operations have taken effect."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primFlush: (in category 'primitives-display') -----
- primFlush: aHandle
- "Primitive. If any rendering operations are pending, force them to be executed.
- Do not wait until they have taken effect."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>primForm:colorMasksInto: (in category 'primitives-forms') -----
- primForm: aHandle colorMasksInto: anArray
- "Primitive. Store the bit masks for each color into the given array."
- ^nil!
Item was removed:
- ----- Method: ExternalScreen>>release (in category 'initialize-release') -----
- release
- "I am no longer Display. Release any resources if necessary"
- self destroy!
Item was removed:
- ----- Method: ExternalScreen>>rgbaBitMasks (in category 'accessing') -----
- rgbaBitMasks
- "Return the masks for specifying the R,G,B, and A components in the receiver"
- | rgbaBitMasks |
- rgbaBitMasks := Array new: 4.
- self primDisplay: bits colorMasksInto: rgbaBitMasks.
- ^rgbaBitMasks!
Item was removed:
- ----- Method: ExternalScreen>>rgbaBitMasksOfForm: (in category 'form support') -----
- rgbaBitMasksOfForm: anExternalForm
- | rgbaBitMasks |
- rgbaBitMasks := Array new: 4.
- self primForm: anExternalForm getExternalHandle colorMasksInto: rgbaBitMasks.
- ^rgbaBitMasks!
Item was removed:
- ----- Method: ExternalScreen>>setExtent:depth: (in category 'private') -----
- setExtent: aPoint depth: bitsPerPixel
- "Create a 3D accelerated display screen"
- | screen |
- (bits isInteger and:[depth == bitsPerPixel and: [aPoint = self extent and:
- [self supportsDisplayDepth: bitsPerPixel]]]) ifFalse: [
- bits ifNotNil:[self primDestroyDisplaySurface: bits].
- bits := nil. "Free up old bitmap in case space is low"
- DisplayChangeSignature := (DisplayChangeSignature ifNil: [0]) + 1.
- (self supportsDisplayDepth: bitsPerPixel)
- ifTrue:[depth := bitsPerPixel]
- ifFalse:["Search for a suitable depth"
- depth := self findAnyDisplayDepthIfNone:[nil]].
- depth == nil ifFalse:[
- bits := self primCreateDisplaySurface: depth
- width: aPoint x height: aPoint y].
- "Bail out if surface could not be created"
- (bits == nil) ifTrue:[
- screen := DisplayScreen extent: aPoint depth: bitsPerPixel.
- self == Display ifTrue:[
- Display := screen.
- Display beDisplay].
- ^screen].
- width := aPoint x.
- height := aPoint y.
- ].
- clippingBox := super boundingBox.
- allocatedForms ifNil:[
- allocatedForms := ExternalFormRegistry new.
- WeakArray addWeakDependent: allocatedForms].
- !
Item was removed:
- ----- Method: ExternalScreen>>shutDown (in category 'initialize-release') -----
- shutDown
- "Minimize Display memory saved in image"
- self destroy.
- width := 240.
- height := 120.
- bits := Bitmap new: self bitsSize.!
Item was removed:
- ----- Method: ExternalScreen>>supportsDisplayDepth: (in category 'primitives-display') -----
- supportsDisplayDepth: pixelDepth
- "Return true if this pixel depth is supported on the current host platform."
- ^false!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.378.mcz
==================== Summary ====================
Name: Graphics-mt.378
Author: mt
Time: 29 June 2017, 11:44:17.283967 am
UUID: 71536264-38ce-8e45-ad7e-12bb788bf319
Ancestors: Graphics-dtl.377, Graphics-cbc.375
Merges cbc.375
See http://forum.world.st/Updated-and-finished-removal-of-ExternalForm-and-rela…
=============== Diff against Graphics-dtl.377 ===============
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]!
Patrick Rein uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-pre.956.mcz
==================== Summary ====================
Name: System-pre.956
Author: pre
Time: 28 June 2017, 11:03:30.410481 am
UUID: 7afdd78a-da8d-9c43-a291-f04048ca49c6
Ancestors: System-eem.955
Improves on the description of the garbage collect utility call.
=============== Diff against System-eem.955 ===============
Item was changed:
----- Method: Utilities class>>garbageCollectAndReport (in category 'miscellaneous') -----
garbageCollectAndReport
"Do a garbage collection, and report results to the user."
| reportString |
reportString := String streamContents:
[:aStream |
+ aStream
+ nextPutAll: 'The following amounts of memory are still available:' translated;
+ cr.
aStream nextPutAll: Smalltalk bytesLeftString.
Smalltalk at: #Command ifPresent:
[:cmdClass | | cc |
(cc := cmdClass instanceCount) > 0 ifTrue:
+ [aStream
+ cr;
+ nextPutAll: '(note: there are ';
+ print: cc;
+ nextPutAll: ' undo record(s) present in your';
+ cr;
+ nextPutAll: 'system; purging them may free up more space.)']]].
- [aStream cr; nextPutAll:
- ('(note: there are ', cc printString,
- ' undo record(s) present in your
- system; purging them may free up more space.)')]]].
self inform: reportString
!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.955.mcz
==================== Summary ====================
Name: System-eem.955
Author: eem
Time: 27 June 2017, 6:07:12.882121 pm
UUID: da5503a6-f9c7-4332-8cce-2ac9dfd50b43
Ancestors: System-eem.954
Have bytesLeft answer the result it claims to (Spur changed the p[rmitive to answer the largest free chunk; needed for the allocation failure followed by growth and retry logic).
Update bytesLeft string to include the largest free chunk info.
Comment garbageCollect properly.
Fix a comment typo.
Nuke unused methods in SuystemDictionary that are in SmalltalkImage.
=============== Diff against System-eem.954 ===============
Item was changed:
----- Method: SmalltalkImage>>bytesLeft (in category 'memory space') -----
bytesLeft
"Answer the number of bytes of space available. Does a full garbage collection."
+ self garbageCollect.
+ ^self bytesLeft: true!
- ^ self garbageCollect
- !
Item was changed:
----- Method: SmalltalkImage>>bytesLeft: (in category 'memory space') -----
bytesLeft: aBool
+ "Return the amount of available space. If aBool is true, include possibly available swap space.
+ If aBool is false, include possibly available physical memory. For a report on the largest free
+ block currently available within Squeak memory but not counting extra memory use #primBytesLeft."
- "Return the amount of available space. If aBool is true, include possibly available swap space. If aBool is false, include possibly available physical memory. For a report on the largest free block currently availabe within Squeak memory but not counting extra memory use #primBytesLeft."
<primitive: 112>
^self primBytesLeft!
Item was changed:
----- Method: SmalltalkImage>>bytesLeftString (in category 'memory space') -----
bytesLeftString
+ "Answer a string describing the amount of memory available."
+ "Smalltalk bytesLeftString"
+ | largestFree availInternal availPhysical availTotal |
+ largestFree := self garbageCollect.
- "Return a string describing the amount of memory available"
- | availInternal availPhysical availTotal |
- self garbageCollect.
availInternal := self primBytesLeft.
availPhysical := self bytesLeft: false.
availTotal := self bytesLeft: true.
(availTotal > (availInternal + 10000)) "compensate for mini allocations inbetween"
ifFalse:[^availInternal asStringWithCommas, ' bytes available'].
+ ^String streamContents:
+ [:s|
+ {availInternal. availPhysical. largestFree. availTotal}
+ with: #('old space' 'physical' 'largest free chunk' 'total')
+ do: [:value :name|
+ s nextPutAll: value asStringWithCommas; nextPutAll: ' bytes ('; nextPutAll: name; nextPutAll: ') '; cr]]!
- ^String streamContents:[:s|
- s nextPutAll: availInternal asStringWithCommas, ' bytes (internal) '; cr.
- s nextPutAll: availPhysical asStringWithCommas, ' bytes (physical) '; cr.
- s nextPutAll: availTotal asStringWithCommas, ' bytes (total) '].!
Item was changed:
----- Method: SmalltalkImage>>garbageCollect (in category 'memory space') -----
garbageCollect
+ "Reclaims all garbage and answers the number of bytes of available space in the largest free chunk."
- "Primitive. Reclaims all garbage and answers the number of bytes of available space."
Object flushDependents.
EventManager flushEvents.
^self primitiveGarbageCollect!
Item was removed:
- ----- Method: SystemDictionary>>growMemoryByAtLeast: (in category 'memory space') -----
- growMemoryByAtLeast: numBytes
- "Grow memory by at least the requested number of bytes.
- Primitive. Fail if no memory is available. Essential.
- N.B. In Spur, the heap is composed of segments. Growing memory adds a new
- segment; it does not extend existing segments. Growth is by at least that
- established by SmalltalkImage current vmParameterAt: 25, which defaults to 16Mb."
- <primitive: 180>
- ^(numBytes isInteger and: [numBytes > 0])
- ifTrue: [OutOfMemory signal]
- ifFalse: [self primitiveFailed]!
Item was removed:
- ----- Method: SystemDictionary>>maxIdentityHash (in category 'system attributes') -----
- maxIdentityHash
- "Answer the maximum identityHash value supported by the VM."
- <primitive: 176>
- ^self primitiveFailed!
Item was removed:
- ----- Method: SystemDictionary>>setGCParameters (in category 'snapshot and quit') -----
- setGCParameters
- "Adjust the VM's default GC parameters to avoid too much tenuring.
- Maybe this should be left to the VM?"
-
- | proportion edenSize survivorSize averageObjectSize numObjects |
- proportion := 0.9. "tenure when 90% of pastSpace is full"
- edenSize := SmalltalkImage current vmParameterAt: 44.
- survivorSize := edenSize / 5.0. "David's paper uses 140Kb eden + 2 x 28kb survivor spaces; Spur uses the same ratios :-)"
- averageObjectSize := 8 * self wordSize. "a good approximation"
- numObjects := (proportion * survivorSize / averageObjectSize) rounded.
- SmalltalkImage current vmParameterAt: 6 put: numObjects "tenure when more than this many objects survive the GC"!