Skip to content

Commit

Permalink
AeCairoRadialGradientPattern: Add instance creation API for same inne…
Browse files Browse the repository at this point in the history
…r and outer center (frequent scenario)
  • Loading branch information
tinchodias committed Dec 10, 2024
1 parent 57d83e9 commit f9fa8f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,8 @@ AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedBuffered [
format: AeCairoSurfaceFormat a8.
aShadowContext := aShadowSurface newContext.
aGradient := (AeCairoRadialGradientPattern
innerCenter: shadowCenter
center: shadowCenter
innerRadius: radius
outerCenter: shadowCenter
outerRadius: radius + shadowSize)
addStopAt: 0.0 color: Color white;
addStopAt: 0.2 color: (Color white alpha: 0.5);
Expand Down Expand Up @@ -693,9 +692,8 @@ AeCairoExamplesRenderTest >> surfaceWithShadowedCircleEmulatedDirect [

"draw shadow"
aGradient := (AeCairoRadialGradientPattern
innerCenter: shadowCenter
center: shadowCenter
innerRadius: radius
outerCenter: shadowCenter
outerRadius: radius + shadowSize)
addStopAt: 0.0 color: shadowColor;
addStopAt: 0.2 color: (shadowColor alpha: 0.5);
Expand Down
7 changes: 3 additions & 4 deletions src/Alexandrie-Cairo/AeCairoGradientShadowFilter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ AeCairoGradientShadowFilter >> paintFor: rectangle blurRadius: radius color: aCo

aGradient :=
AeCairoRadialGradientPattern
innerCenter: rectangle topLeft
center: rectangle topLeft
innerRadius: 0.0
outerCenter: rectangle topLeft
outerRadius: radius
addStopsFrom: colorRamp.
outerRadius: radius.
aGradient addStopsFrom: colorRamp.
aGradientMatrix := AeCairoMatrix newIdentity.

aContext restoreStateAfter: [
Expand Down
10 changes: 10 additions & 0 deletions src/Alexandrie-Cairo/AeCairoRadialGradientPattern.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Class {
#category : #'Alexandrie-Cairo-Patterns'
}

{ #category : #'instance creation' }
AeCairoRadialGradientPattern class >> center: aCenter innerRadius: anInnerRadius outerRadius: anOuterRadius [

^ self
innerCenter: aCenter
innerRadius: anInnerRadius
outerCenter: aCenter
outerRadius: anOuterRadius
]

{ #category : #'instance creation' }
AeCairoRadialGradientPattern class >> innerCenter: anInnerCenter innerRadius: anInnerRadius outerCenter: anOuterCenter outerRadius: anOuterRadius [

Expand Down

0 comments on commit f9fa8f3

Please sign in to comment.