Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <georgelemon@protonmail.com>
  • Loading branch information
georgelemon committed Oct 20, 2024
1 parent 1702c86 commit 8c25d84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/blend2d/color.nim
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ proc radialGradient*(x1, y1, x0, y0, r0: float): Gradient =
BLGradientType.BL_GRADIENT_TYPE_RADIAL, v.addr,
BLExtendMode.BL_EXTEND_MODE_PAD, nil, 0, nil)

proc conicGradient*(x0, y0, angle, repeat: float): Gradient =
## Create a new conic `Gradient` pointer of `BLGradientCore`
result = create(BLGradientCore)
var v = BLConicGradientValues(x0: x0, y0: y0, angle: angle, repeat: repeat)
!blGradientInitAs(result,
BLGradientType.BL_GRADIENT_TYPE_RADIAL, v.addr,
BLExtendMode.BL_EXTEND_MODE_PAD, nil, 0, nil)

proc add*(gr: Gradient, offset: float32, color: uint32) =
## Add a new stop color to `Gradient` using `offset` and `color`
!blGradientAddStopRgba32(gr, offset, color)
Expand Down
8 changes: 0 additions & 8 deletions src/blend2d/context.nim
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,6 @@ proc mask*(ctx: Context, origin: PointI,
!blContextFillMaskI(ctx, origin, mask, maskArea)
ctx

proc mask*(ctx: Context, text: tuple[f: BLFontCore, textContent: string, x: int32, y: int32], img: BLImageCore) =
!blContextSetCompOp(ctx, BLCompOp.BL_COMP_OP_SRC_COPY)
ctx.add(text[0].addr, text[1], 0, 0)
var p = point(0, 0)
var r = rect(300, 300)
!blContextSetCompOp(ctx, BLCompOp.BL_COMP_OP_SRC_IN)
!ctx.blContextBlitImageI(p.addr, img.addr, r.addr)

proc endContext*(ctx: Context) =
!blContextEnd(ctx)

Expand Down

0 comments on commit 8c25d84

Please sign in to comment.