clamp paint opacity
This commit is contained in:
parent
5b6a50d0a2
commit
328116893a
2 changed files with 7 additions and 0 deletions
|
@ -104,6 +104,7 @@ proc fillGradientLinear(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -177,6 +178,7 @@ proc fillGradientRadial(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -208,6 +210,7 @@ proc fillGradientAngular(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1922,6 +1922,8 @@ proc fillPath*(
|
||||||
windingRule = NonZero
|
windingRule = NonZero
|
||||||
) {.raises: [PixieError].} =
|
) {.raises: [PixieError].} =
|
||||||
## Fills a path.
|
## Fills a path.
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
|
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2000,6 +2002,8 @@ proc strokePath*(
|
||||||
dashes: seq[float32] = @[]
|
dashes: seq[float32] = @[]
|
||||||
) {.raises: [PixieError].} =
|
) {.raises: [PixieError].} =
|
||||||
## Strokes a path.
|
## Strokes a path.
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
|
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue