Skip to content

Commit

Permalink
Convert to Tonel v1
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Feb 8, 2024
1 parent 0e22ca4 commit 5c74353
Show file tree
Hide file tree
Showing 23 changed files with 305 additions and 216 deletions.
29 changes: 14 additions & 15 deletions src/Alexandrie-Cairo-Tests/AeCairoContextTest.class.st
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
Class {
#name : 'AeCairoContextTest',
#superclass : 'TestCase',
#name : #AeCairoContextTest,
#superclass : #TestCase,
#instVars : [
'surface',
'context'
],
#category : 'Alexandrie-Cairo-Tests',
#package : 'Alexandrie-Cairo-Tests'
#category : #'Alexandrie-Cairo-Tests'
}

{ #category : 'running' }
{ #category : #running }
AeCairoContextTest >> newSourceSansProRegularFontFace [

| aFTLibrary aFTFace |
Expand All @@ -18,7 +17,7 @@ AeCairoContextTest >> newSourceSansProRegularFontFace [
^ AeCairoFreetypeFontFace newForFace: aFTFace
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testClipExtents [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand Down Expand Up @@ -63,7 +62,7 @@ AeCairoContextTest >> testClipExtents [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testCurrentPoint [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand Down Expand Up @@ -93,7 +92,7 @@ AeCairoContextTest >> testCurrentPoint [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testCurrentTarget [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand All @@ -111,7 +110,7 @@ AeCairoContextTest >> testCurrentTarget [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testFillRule [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand All @@ -129,7 +128,7 @@ AeCairoContextTest >> testFillRule [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testFontExtents [

| aSurface aContext aFontFace aScaledFont aFontExtents |
Expand Down Expand Up @@ -169,7 +168,7 @@ AeCairoContextTest >> testFontExtents [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testGlyphExtentsOf [

| aSurface aContext string aScaledFont aGlyphArray aTextExtents aFontFace |
Expand Down Expand Up @@ -208,7 +207,7 @@ AeCairoContextTest >> testGlyphExtentsOf [
self assert: aTextExtents advance closeTo: 34@0
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testOperator [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand All @@ -226,7 +225,7 @@ AeCairoContextTest >> testOperator [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testPathExtents [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand Down Expand Up @@ -264,7 +263,7 @@ AeCairoContextTest >> testPathExtents [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testScaledFont [

| aSurface aContext aFontFace scaledFont17 scaledFont71 scaledFont17b |
Expand Down Expand Up @@ -320,7 +319,7 @@ AeCairoContextTest >> testScaledFont [
equals: scaledFont71 getHandle
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoContextTest >> testStrokeExtents [

surface := AeCairoImageSurface extent: 100 @ 100.
Expand Down
11 changes: 5 additions & 6 deletions src/Alexandrie-Cairo-Tests/AeCairoConvertTest.class.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
Class {
#name : 'AeCairoConvertTest',
#superclass : 'AeCairoRenderTest',
#category : 'Alexandrie-Cairo-Tests',
#package : 'Alexandrie-Cairo-Tests'
#name : #AeCairoConvertTest,
#superclass : #AeCairoRenderTest,
#category : #'Alexandrie-Cairo-Tests'
}

{ #category : 'tests' }
{ #category : #tests }
AeCairoConvertTest >> surfaceWithDeviceScaleAsARGB32ImageSurface [

| radius center extent scale aSurface aContext |
Expand All @@ -30,7 +29,7 @@ AeCairoConvertTest >> surfaceWithDeviceScaleAsARGB32ImageSurface [
^ aSurface asARGB32ImageSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoConvertTest >> surfaceWithDeviceScaleAsAlphaChannelGrayscaleImage [

| radius center extent scale aSurface aContext |
Expand Down
53 changes: 26 additions & 27 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
Class {
#name : 'AeCairoExamplesRenderTest',
#superclass : 'AeCairoRenderTest',
#category : 'Alexandrie-Cairo-Tests',
#package : 'Alexandrie-Cairo-Tests'
#name : #AeCairoExamplesRenderTest,
#superclass : #AeCairoRenderTest,
#category : #'Alexandrie-Cairo-Tests'
}

{ #category : 'convenience' }
{ #category : #convenience }
AeCairoExamplesRenderTest class >> exportAll [
<script: 'self exportAll' >

super exportAll
]

{ #category : 'convenience' }
{ #category : #convenience }
AeCairoExamplesRenderTest class >> inspectAll [
<script: 'super inspectAll'>

super inspectAll
]

{ #category : 'convenience' }
{ #category : #convenience }
AeCairoExamplesRenderTest class >> inspectMismatches [
<script: 'super inspectMismatches'>

super inspectMismatches
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithAllOperators [
"Catalog of cairo's compositing operators.
Expand Down Expand Up @@ -85,7 +84,7 @@ AeCairoExamplesRenderTest >> surfaceWithAllOperators [
^ aSurface
]

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

| inputForm inputSurface outputColors outputSurface outputContext |
Expand Down Expand Up @@ -114,7 +113,7 @@ AeCairoExamplesRenderTest >> surfaceWithColoredIcons [
^ outputSurface
]

{ #category : 'tests - mesh gradient' }
{ #category : #'tests - mesh gradient' }
AeCairoExamplesRenderTest >> surfaceWithCoonsPatch [
"See: https://blogs.igalia.com/dpino/2020/06/11/renderization-of-conic-gradients/"

Expand Down Expand Up @@ -147,7 +146,7 @@ AeCairoExamplesRenderTest >> surfaceWithCoonsPatch [
^ aSurface
]

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

| aSurface aSquare offsetPoint surfaceWidth surfaceHeight |
Expand Down Expand Up @@ -185,7 +184,7 @@ AeCairoExamplesRenderTest >> surfaceWithDeviceOffset [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithDeviceScale [

| aSurface aSquare scalePoint surfaceWidth surfaceHeight |
Expand Down Expand Up @@ -224,7 +223,7 @@ AeCairoExamplesRenderTest >> surfaceWithDeviceScale [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithDottedCircle [
"Cairo allows drawing strokes with dotted borders (either with circular dots, or squared dots).
The trick is setting dash segments of length 0.0, followed by a non-zero segment.
Expand Down Expand Up @@ -291,7 +290,7 @@ AeCairoExamplesRenderTest >> surfaceWithDottedCircle [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithEmulatedRadialGradient [

| aSurface context aPattern |
Expand All @@ -316,7 +315,7 @@ AeCairoExamplesRenderTest >> surfaceWithEmulatedRadialGradient [
^ aSurface
]

{ #category : 'tests - mesh gradient' }
{ #category : #'tests - mesh gradient' }
AeCairoExamplesRenderTest >> surfaceWithGouraudBasedTriangle [

| aSurface aContext aMeshPattern |
Expand Down Expand Up @@ -344,7 +343,7 @@ AeCairoExamplesRenderTest >> surfaceWithGouraudBasedTriangle [
^ aSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithPixelatedIcon [

| iconForm iconSurface iconPattern scale aSurface aContext |
Expand Down Expand Up @@ -383,7 +382,7 @@ AeCairoExamplesRenderTest >> surfaceWithPixelatedIcon [
^ aSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithRoundedRectangle [

| extent aSurface aContext aRectangle |
Expand Down Expand Up @@ -418,7 +417,7 @@ AeCairoExamplesRenderTest >> surfaceWithRoundedRectangle [
^ aSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedBuffered [
"Emulate a Gaussian shadow on a circle using a radial gradient, using an intermediate surface."

Expand Down Expand Up @@ -479,7 +478,7 @@ AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedBuffered [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedDirect [
"Emulate a Gaussian shadow on a circle using a radial gradient."

Expand Down Expand Up @@ -528,7 +527,7 @@ AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedDirect [

]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithSphere [
"Emulate a sphere with a radial gradient, using an inner center different than the outer center."

Expand Down Expand Up @@ -564,7 +563,7 @@ AeCairoExamplesRenderTest >> surfaceWithSphere [
^ aSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithStraightEdgesCurve [
"Edges of the curve are straight.
Reference: https://github.com/memononen/nanovg/issues/650"
Expand Down Expand Up @@ -596,7 +595,7 @@ AeCairoExamplesRenderTest >> surfaceWithStraightEdgesCurve [
^ aSurface
]

{ #category : 'tests' }
{ #category : #tests }
AeCairoExamplesRenderTest >> surfaceWithStretchedIcon [

| aSurface aContext iconForm iconSurface iconPattern horizontalScale verticalScale |
Expand Down Expand Up @@ -629,7 +628,7 @@ AeCairoExamplesRenderTest >> surfaceWithStretchedIcon [
^ aSurface
]

{ #category : 'tests - text' }
{ #category : #'tests - text' }
AeCairoExamplesRenderTest >> surfaceWithText [

| fontSize string surfaceSize aSurface aContext aFTLibrary aFTFace aScaledFont |
Expand Down Expand Up @@ -666,7 +665,7 @@ AeCairoExamplesRenderTest >> surfaceWithText [
^ aSurface
]

{ #category : 'tests - text' }
{ #category : #'tests - text' }
AeCairoExamplesRenderTest >> surfaceWithTextAsPath [

| fontSize string surfaceSize aSurface aContext aFTLibrary aFTFace aFontFace glyphArray |
Expand Down Expand Up @@ -704,7 +703,7 @@ AeCairoExamplesRenderTest >> surfaceWithTextAsPath [
^ aSurface
]

{ #category : 'tests - text' }
{ #category : #'tests - text' }
AeCairoExamplesRenderTest >> surfaceWithTextPixelated [
"The trick is:
- Create special font options with full hinting and without anti-aliasing
Expand Down Expand Up @@ -759,7 +758,7 @@ AeCairoExamplesRenderTest >> surfaceWithTextPixelated [
^ aSurface
]

{ #category : 'tests - text' }
{ #category : #'tests - text' }
AeCairoExamplesRenderTest >> surfaceWithToyAPISelectFontSlantWeight [
"Use `AeCairoContext>>selectFont:slant:weight:`, which cairo documentation considers 'toy API'."

Expand Down Expand Up @@ -789,7 +788,7 @@ AeCairoExamplesRenderTest >> surfaceWithToyAPISelectFontSlantWeight [
^ aSurface
]

{ #category : 'tests - text' }
{ #category : #'tests - text' }
AeCairoExamplesRenderTest >> surfaceWithToyAPIShowText [
"Use `AeCairoContext>>#showText:`, which cairo documentation considers 'toy API'."

Expand Down

0 comments on commit 5c74353

Please sign in to comment.