Skip to content

Commit

Permalink
Add an example of mask API
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed May 23, 2023
1 parent ae96a20 commit 86d7f7a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ AeCairoExamplesRenderTest class >> inspectMismatches [
super inspectMismatches
]

{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithColoredIcons [

| inputForm inputSurface outputColors outputSurface outputContext |
inputForm := self iconNamed: #windowClose.
inputSurface := AeCairoImageSurface fromForm: inputForm.

outputColors := Color wheel: 7.

"Create a surface and associated context"
outputSurface := AeCairoImageSurface
extent: (inputSurface width * outputColors size) @ inputSurface height
format: AeCairoSurfaceFormat argb32.
outputContext := outputSurface newContext.

"Paint the inputSurface with each color"
outputColors
do: [ :eachColor |
outputContext
sourceColorRGBA: eachColor;
maskSurface: inputSurface x: 0 y: 0 ]
separatedBy: [
outputContext
translateByX: inputSurface width
y: 0 ].

^ outputSurface
]

{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithDeviceOffset [

Expand Down

0 comments on commit 86d7f7a

Please sign in to comment.