The Trunk: Morphic-bf.627.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-bf.627.mcz

commits-2
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-bf.627.mcz

==================== Summary ====================

Name: Morphic-bf.627
Author: bf
Time: 9 October 2012, 3:00:33.903 pm
UUID: 2d7d0432-9723-4629-a850-3371eb3aca8b
Ancestors: Morphic-bf.626

For drawing rotated forms less than 32 bits deep, use Form paint rule.

=============== Diff against Morphic-bf.626 ===============

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 |
  (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].
+ warp combinationRule: (self depth = 32
+ ifTrue: [Form blendAlphaScaled]
+ ifFalse: [Form paint])].
- warp combinationRule: (self depth = 32 ifTrue: [Form blendAlphaScaled] ifFalse: [Form blend])].
  subCanvas
  translateBy: patchRect topLeft negated
  during: aBlock.
  warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
  warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-bf.627.mcz

Chris Muller-3
I removed my Inbox submission (Morphic-cmm.442) for fixing this which
you rejected in June 2010.  I'm glad you finally found a solution that
works for you.


On Tue, Oct 9, 2012 at 5:01 PM,  <[hidden email]> wrote:

> Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-bf.627.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-bf.627
> Author: bf
> Time: 9 October 2012, 3:00:33.903 pm
> UUID: 2d7d0432-9723-4629-a850-3371eb3aca8b
> Ancestors: Morphic-bf.626
>
> For drawing rotated forms less than 32 bits deep, use Form paint rule.
>
> =============== Diff against Morphic-bf.626 ===============
>
> 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 |
>         (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].
> +                               warp combinationRule: (self depth = 32
> +                                       ifTrue: [Form blendAlphaScaled]
> +                                       ifFalse: [Form paint])].
> -                                       warp combinationRule: (self depth = 32 ifTrue: [Form blendAlphaScaled] ifFalse: [Form blend])].
>                 subCanvas
>                         translateBy: patchRect topLeft negated
>                         during: aBlock.
>                 warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
>                 warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
>   !
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-bf.627.mcz

Bert Freudenberg

On 09.10.2012, at 16:58, Chris Muller <[hidden email]> wrote:

> I removed my Inbox submission (Morphic-cmm.442) for fixing this which
> you rejected in June 2010.  I'm glad you finally found a solution that
> works for you.

Ah, I actually had forgotten about that. I just looked at our old discussion again. While the blend mode I used now is qualitatively better than the one proposed previously (the translucent color is drawn correctly), it still smooths the edges of rotated sketches. But as we discussed before, this is a separate problem (which I now realize could be solved by setting smoothing to 1 in the TransformMorph when needed). Actually we should have taken in your improvement last year, because it was a little better than what we had before that. As long as we're moving roughly in the right direction, every little step counts :)

- Bert -


>
> On Tue, Oct 9, 2012 at 5:01 PM,  <[hidden email]> wrote:
>> Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-bf.627.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-bf.627
>> Author: bf
>> Time: 9 October 2012, 3:00:33.903 pm
>> UUID: 2d7d0432-9723-4629-a850-3371eb3aca8b
>> Ancestors: Morphic-bf.626
>>
>> For drawing rotated forms less than 32 bits deep, use Form paint rule.
>>
>> =============== Diff against Morphic-bf.626 ===============
>>
>> 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 |
>>        (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].
>> +                               warp combinationRule: (self depth = 32
>> +                                       ifTrue: [Form blendAlphaScaled]
>> +                                       ifFalse: [Form paint])].
>> -                                       warp combinationRule: (self depth = 32 ifTrue: [Form blendAlphaScaled] ifFalse: [Form blend])].
>>                subCanvas
>>                        translateBy: patchRect topLeft negated
>>                        during: aBlock.
>>                warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
>>                warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
>>  !
>>