[etoys-dev] Etoys Inbox: Morphic-kfr..78.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Nov 9 04:29:47 EST 2011
A new version of Morphic was added to project Etoys Inbox:
http://source.squeak.org/etoysinbox/Morphic-kfr..78.mcz
==================== Summary ====================
Name: Morphic-kfr..78
Author: kfr.
Time: 9 November 2011, 10:29:02 am
UUID: e2246582-5edf-1e42-8d3d-4d28b78c8883
Ancestors: Morphic-kfr..77
Add some hacks to make color and form translucency work. This hack make 32 bit depth work pretty well. 16 bit and lower work as before.
=============== Diff against Morphic-kfr..77 ===============
Item was changed:
----- Method: Canvas>>translucentImage:at:sourceRect: (in category 'drawing-images') -----
translucentImage: aForm at: aPoint sourceRect: sourceRect
"Draw with a translucent image using the best way of creating translucency. Perhaps translucency should be available without creating an image form."
+ | combinationRule |
self shadowColor ifNotNil:[
^self stencil: aForm at: aPoint sourceRect: sourceRect color: self shadowColor].
aForm isTranslucent not
ifTrue:[^self paintImage: aForm at: aPoint sourceRect: sourceRect].
+ ((self depth = 32) and:[aForm depth = 32])
+ ifTrue:[ combinationRule := 24]
+ ifFalse:[combinationRule := 34]."better than Form blend = 24"
self image: aForm
at: aPoint
sourceRect: sourceRect
+ rule: combinationRule !
- rule: 34 "better than Form blend = 24"!
Item was changed:
----- Method: FormCanvas>>transformBy:clippingTo:during:smoothing: (in category 'drawing-support') -----
transformBy: aDisplayTransform clippingTo: aClipRect during: aBlock smoothing: cellSize
"Note: This method has been originally copied from TransformationMorph."
+ | innerRect patchRect sourceQuad warp start subCanvas test |
- | innerRect patchRect sourceQuad warp start subCanvas |
(aDisplayTransform isPureTranslation) ifTrue:[
^aBlock value: (self copyOffset: aDisplayTransform offset negated truncated
clipRect: aClipRect)
].
"Prepare an appropriate warp from patch to innerRect"
innerRect := aClipRect.
patchRect := (aDisplayTransform globalBoundsToLocal: innerRect) truncated.
sourceQuad := (aDisplayTransform sourceQuadFor: innerRect)
collect: [:p | p - patchRect topLeft].
warp := self warpFrom: sourceQuad toRect: innerRect.
+
-
"Render the submorphs visible in the clipping rectangle, as patchForm"
start := (self depth = 1 and: [self isShadowDrawing not])
"If this is true B&W, then we need a first pass for erasure."
ifTrue: [1] ifFalse: [2].
start to: 2 do:
[:i | "If i=1 we first make a shadow and erase it for opaque whites in B&W"
subCanvas := self class extent: patchRect extent depth: self depth.
i=1 ifTrue: [subCanvas shadowColor: Color black.
warp combinationRule: Form erase]
ifFalse: [self isShadowDrawing ifTrue:
[subCanvas shadowColor: self shadowColor].
+ test := aBlock receiver renderedMorph.
+ ((test isKindOf: SketchMorph) or:[ test isKindOf: ImageMorph])
+ ifTrue:[ ((test form isTranslucent) and:[ self depth = 32])
+ ifTrue:[warp combinationRule: 34]
+ ifFalse:[warp combinationRule: Form paint]]
+ ifFalse:[ self depth = 32
+ ifTrue:[warp combinationRule: 34]
+ ifFalse:[ ((self depth = 16) and:[(test color isTranslucent ) or:[ test borderColor isTranslucent]])
+ ifTrue:[warp combinationRule:34 ]
+ ifFalse:[warp combinationRule:Form paint]]]].
- warp combinationRule: Form paint].
subCanvas translateBy: patchRect topLeft negated
during:[:offsetCanvas| aBlock value: offsetCanvas].
+ warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
- warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
warp sourceForm: nil. subCanvas := nil "release space for next loop"]
!
More information about the etoys-dev
mailing list