[squeak-dev] Re: Morph shadows
Ken G. Brown
kbrown at mac.com
Fri Dec 11 17:21:23 UTC 2009
Don't know if this has any impact for you, but if you grab a rounded corner rectangle from the Objects tab in latest trunk, the shadow incorrectly appears in front of the object when dragging.
Ken G. Brown
At 11:04 AM -0600 12/11/09, Chris Muller apparently wrote:
>That got it. Shadow and rotation are now both working.
>
>Thank you very much..!
>
>On Thu, Dec 10, 2009 at 1:28 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
>> Chris Muller wrote:
>>>
>>> paintFor: aKmlPainter
>>> | canvasBounds |
>>> super paintFor: aKmlPainter.
>>> aKmlPainter form == form ifFalse:
>>> [ (aKmlPainter clipRect intersects: (canvasBounds := self
>>> surfaceBounds geoToCanvasFor: aKmlPainter)) ifTrue:
>>> [ (form scaledToSize: (canvasBounds extent))
>>> displayOn: aKmlPainter form
>>> at: (canvasBounds topLeft)
>>> clippingBox: canvasBounds
>>> rule: Form blend
>>> fillColor: nil ] ]
>>
>> I'm missing your morph's drawOn: method. If "aKmlPainter form" in the above
>> is Display, then yes, that won't work. This really should look more like the
>> following (assuming that there's a relation between aKmlPainter and a
>> FormCanvas):
>>
>> aKmlPainter form == form ifFalse:
>> [ (aKmlPainter clipRect intersects: (canvasBounds := self
>> surfaceBounds geoToCanvasFor: aKmlPainter)) ifTrue:[
>> "<--- here we go -->"
>> aKmlPainter canvasPassedIntoDrawOn "<-- we need this"
>> translucentImage: (form scaledToSize: (canvasBounds extent))
>> at: (canvasBounds topLeft)].
>>
>> if you're not using the canvas protocol for performance reasons, you'll have
>> to add extra code in your Morph's drawOn: method, along the lines of:
>>
>> Morph>>drawOn: aCanvas
>>
>> "check to see if we can operate directly on Display"
>> fastPath := (aCanvas isMemberOf: FormCanvas)
>> and:[aCanvas form == Display]
>> and:[aCanvas shadowDrawing not].
>>
>> fastPath ifTrue:[
>> "fast path - ignore canvas stuff and blit straight to
>> display"
>> myForm displayOn: Display at: bounds origin. "etc"
>> ] ifFalse:[
>> "slow path - not drawing to Display so must use canvas
>> protocol"
>> aCanvas drawImage: myForm at: bounds origin. "etc"
>> ].
>>
>> This will work for various other cases (like Morph>>imageForm etc) as well.
>>
>> Cheers,
>> - Andreas
>>
More information about the Squeak-dev
mailing list
|