Skip to content

Commit

Permalink
Deprecate BlElement>>aeDrawOn:with: to use a new AeCanvas API
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed May 3, 2024
1 parent abe5880 commit 2b84abd
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/Bloc-Alexandrie/BlElement.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,27 @@ BlElement >> aeDrawInSameLayerOn: aCanvas [
{ #category : #'*Bloc-Alexandrie' }
BlElement >> aeDrawOn: aeCanvas [

self aeDrawOn: aeCanvas with: [

"My position is applied before my transformation matrix,
which may have an additional translation."
aeCanvas pathTranslate: self position.
self transformation aeApplyTo: aeCanvas.

self aeDrawIgnoringOpacityAndTransformationOn: aeCanvas ]
aeCanvas
restoreContextAfterPaintAlpha: self opacity
with: [
"My position is applied before my transformation matrix,
which may have an additional translation."
aeCanvas pathTranslate: self position.
self transformation aeApplyTo: aeCanvas.

self aeDrawIgnoringOpacityAndTransformationOn: aeCanvas ]
]

{ #category : #'*Bloc-Alexandrie' }
BlElement >> aeDrawOn: aeCanvas with: aBlockClosure [
"Evaluate a block closure taking account my opacity.
The element opacity affects border and background, effects, and
recursively to children elements.
When I have opaque opacity (1.0) I take the fastest branch, restoring
the Cairo context afterwards."

self opacity < 1.0
ifTrue: [ aeCanvas paintGroupWith: aBlockClosure alpha: self opacity ]
ifFalse: [ aeCanvas restoreContextAfter: aBlockClosure ]
self
deprecated: 'Use AeCanvas API directly'
transformWith:
'`@rcv aeDrawOn: `@arg1 with: `@arg2' ->
'`@arg1 restoreContextAfterPaintAlpha: `@rcv opacity with: `@arg2'.

aeCanvas restoreContextAfterPaintAlpha: self opacity with: aBlockClosure
]

{ #category : #'*Bloc-Alexandrie' }
Expand Down

0 comments on commit 2b84abd

Please sign in to comment.