[squeak-dev] Re: Morph shadows

Chris Muller ma.chris.m at gmail.com
Fri Dec 11 17:04:40 UTC 2009


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