morepretty
This commit is contained in:
parent
46cf47bdeb
commit
f00860a9cc
4 changed files with 38 additions and 40 deletions
|
@ -495,7 +495,7 @@ proc getLineDash*(ctx: Context): seq[float32] {.inline, raises: [].} =
|
||||||
proc setLineDash*(ctx: Context, lineDash: seq[float32]) {.inline, raises: [].} =
|
proc setLineDash*(ctx: Context, lineDash: seq[float32]) {.inline, raises: [].} =
|
||||||
ctx.lineDash = lineDash
|
ctx.lineDash = lineDash
|
||||||
|
|
||||||
proc getTransform*(ctx: Context): Mat3 {.inline, raises: []} =
|
proc getTransform*(ctx: Context): Mat3 {.inline, raises: [].} =
|
||||||
## Retrieves the current transform matrix being applied to the context.
|
## Retrieves the current transform matrix being applied to the context.
|
||||||
ctx.mat
|
ctx.mat
|
||||||
|
|
||||||
|
|
|
@ -884,10 +884,10 @@ proc draw*(
|
||||||
|
|
||||||
proc drawTiled*(
|
proc drawTiled*(
|
||||||
dst, src: Image, mat: Mat3, blendMode = bmNormal
|
dst, src: Image, mat: Mat3, blendMode = bmNormal
|
||||||
) {.raises: [PixieError]} =
|
) {.raises: [PixieError].} =
|
||||||
dst.drawCorrect(src, mat, true, blendMode)
|
dst.drawCorrect(src, mat, true, blendMode)
|
||||||
|
|
||||||
proc resize*(srcImage: Image, width, height: int): Image {.raises: [PixieError]} =
|
proc resize*(srcImage: Image, width, height: int): Image {.raises: [PixieError].} =
|
||||||
## Resize an image to a given height and width.
|
## Resize an image to a given height and width.
|
||||||
if width == srcImage.width and height == srcImage.height:
|
if width == srcImage.width and height == srcImage.height:
|
||||||
result = srcImage.copy()
|
result = srcImage.copy()
|
||||||
|
@ -904,7 +904,7 @@ proc resize*(srcImage: Image, width, height: int): Image {.raises: [PixieError]}
|
||||||
|
|
||||||
proc shadow*(
|
proc shadow*(
|
||||||
image: Image, offset: Vec2, spread, blur: float32, color: SomeColor
|
image: Image, offset: Vec2, spread, blur: float32, color: SomeColor
|
||||||
): Image {.raises: [PixieError]} =
|
): Image {.raises: [PixieError].} =
|
||||||
## Create a shadow of the image with the offset, spread and blur.
|
## Create a shadow of the image with the offset, spread and blur.
|
||||||
let
|
let
|
||||||
mask = image.newMask()
|
mask = image.newMask()
|
||||||
|
@ -916,7 +916,7 @@ proc shadow*(
|
||||||
result.fill(color)
|
result.fill(color)
|
||||||
result.draw(shifted, blendMode = bmMask)
|
result.draw(shifted, blendMode = bmMask)
|
||||||
|
|
||||||
proc superImage*(image: Image, x, y, w, h: int): Image {.raises: [PixieError]} =
|
proc superImage*(image: Image, x, y, w, h: int): Image {.raises: [PixieError].} =
|
||||||
## Either cuts a sub image or returns a super image with padded transparency.
|
## Either cuts a sub image or returns a super image with padded transparency.
|
||||||
if x >= 0 and x + w <= image.width and y >= 0 and y + h <= image.height:
|
if x >= 0 and x + w <= image.width and y >= 0 and y + h <= image.height:
|
||||||
result = image.subImage(x, y, w, h)
|
result = image.subImage(x, y, w, h)
|
||||||
|
|
|
@ -1252,9 +1252,7 @@ proc computeCoverages(
|
||||||
for j in i ..< fillStart + fillLen:
|
for j in i ..< fillStart + fillLen:
|
||||||
coverages[j - startX] += sampleCoverage
|
coverages[j - startX] += sampleCoverage
|
||||||
|
|
||||||
proc clearUnsafe(
|
proc clearUnsafe(target: Image | Mask, startX, startY, toX, toY: int) =
|
||||||
target: Image | Mask, startX, startY, toX, toY: int
|
|
||||||
) =
|
|
||||||
## Clears data from [start, to).
|
## Clears data from [start, to).
|
||||||
if startX == target.width or startY == target.height:
|
if startX == target.width or startY == target.height:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue