commit
569b3668b7
6 changed files with 399 additions and 317 deletions
|
@ -6,7 +6,7 @@ proc takeError*(): string =
|
|||
result = lastError.msg
|
||||
lastError = nil
|
||||
|
||||
proc checkError*(): bool =
|
||||
proc checkError*(): bool =
|
||||
result = lastError != nil
|
||||
|
||||
type
|
||||
|
@ -38,32 +38,30 @@ proc drawImage3*(
|
|||
ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight)
|
||||
|
||||
exportConsts:
|
||||
export
|
||||
defaultMiterLimit,
|
||||
autoLineHeight
|
||||
defaultMiterLimit
|
||||
autoLineHeight
|
||||
|
||||
exportEnums:
|
||||
export
|
||||
FileFormat,
|
||||
BlendMode,
|
||||
PaintKind,
|
||||
WindingRule,
|
||||
LineCap,
|
||||
LineJoin,
|
||||
HorizontalAlignment,
|
||||
VerticalAlignment,
|
||||
TextCase
|
||||
FileFormat
|
||||
BlendMode
|
||||
PaintKind
|
||||
WindingRule
|
||||
LineCap
|
||||
LineJoin
|
||||
HorizontalAlignment
|
||||
VerticalAlignment
|
||||
TextCase
|
||||
|
||||
exportProcs:
|
||||
export
|
||||
bindings.checkError,
|
||||
bindings.takeError
|
||||
checkError
|
||||
takeError
|
||||
|
||||
exportObject Vector2:
|
||||
discard
|
||||
|
||||
exportObject Matrix3:
|
||||
discard matrix3()
|
||||
constructor:
|
||||
matrix3
|
||||
|
||||
exportObject Rect:
|
||||
discard
|
||||
|
@ -81,175 +79,220 @@ exportSeq seq[float32]:
|
|||
discard
|
||||
|
||||
exportSeq seq[Span]:
|
||||
export
|
||||
pixie.typeset,
|
||||
pixie.computeBounds
|
||||
procs:
|
||||
typeset(seq[Span], Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
||||
computeBounds(seq[Span])
|
||||
|
||||
exportRefObject Image, ["width", "height"]:
|
||||
discard newImage(0, 0)
|
||||
export
|
||||
pixie.writeFile,
|
||||
pixie.wh,
|
||||
pixie.copy,
|
||||
pixie.getColor,
|
||||
pixie.setColor,
|
||||
pixie.fill,
|
||||
pixie.flipHorizontal,
|
||||
pixie.flipVertical,
|
||||
pixie.subImage,
|
||||
pixie.minifyBy2,
|
||||
pixie.magnifyBy2,
|
||||
pixie.applyOpacity,
|
||||
pixie.invert,
|
||||
pixie.blur,
|
||||
pixie.newMask,
|
||||
pixie.resize,
|
||||
pixie.shadow,
|
||||
pixie.superImage,
|
||||
pixie.draw,
|
||||
pixie.fillGradient,
|
||||
pixie.fillText,
|
||||
pixie.strokeText,
|
||||
pixie.fillPath,
|
||||
pixie.strokePath,
|
||||
pixie.newContext
|
||||
exportRefObject Image:
|
||||
fields:
|
||||
width
|
||||
height
|
||||
constructor:
|
||||
newImage(int, int)
|
||||
procs:
|
||||
writeFile(Image, string)
|
||||
wh(Image)
|
||||
copy(Image)
|
||||
getColor
|
||||
setColor
|
||||
fill(Image, Color)
|
||||
flipHorizontal
|
||||
flipVertical
|
||||
subImage
|
||||
minifyBy2(Image, int)
|
||||
magnifyBy2
|
||||
applyOpacity(Image, float32)
|
||||
invert(Image)
|
||||
blur(Image, float32, Color)
|
||||
newMask(Image)
|
||||
resize(Image, int, int)
|
||||
shadow(Image, Vec2, float32, float32, Color)
|
||||
superImage
|
||||
draw(Image, Image, Mat3, BlendMode)
|
||||
draw(Image, Mask, Mat3, BlendMode)
|
||||
fillGradient
|
||||
fillText(Image, Font, string, Mat3, Vec2, HorizontalAlignment, VerticalAlignment)
|
||||
fillText(Image, Arrangement, Mat3)
|
||||
strokeText(Image, Font, string, Mat3, float32, Vec2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, float32, seq[float32])
|
||||
strokeText(Image, Arrangement, Mat3, float32, LineCap, LineJoin, float32, seq[float32])
|
||||
fillPath(Image, Path, Paint, Mat3, WindingRule)
|
||||
strokePath(Image, Path, Paint, Mat3, float32, LineCap, LineJoin, float32, seq[float32])
|
||||
newContext(Image)
|
||||
|
||||
exportRefObject Mask, ["width", "height"]:
|
||||
discard newMask(0, 0)
|
||||
export
|
||||
pixie.writeFile,
|
||||
pixie.wh,
|
||||
pixie.copy,
|
||||
pixie.getValue,
|
||||
pixie.setValue,
|
||||
pixie.fill,
|
||||
pixie.minifyBy2,
|
||||
pixie.spread,
|
||||
pixie.ceil,
|
||||
pixie.newImage,
|
||||
pixie.applyOpacity,
|
||||
pixie.invert,
|
||||
pixie.blur,
|
||||
pixie.draw,
|
||||
pixie.fillText,
|
||||
pixie.strokeText,
|
||||
pixie.fillPath,
|
||||
pixie.strokePath
|
||||
exportRefObject Mask:
|
||||
fields:
|
||||
width
|
||||
height
|
||||
constructor:
|
||||
newMask(int, int)
|
||||
procs:
|
||||
writeFile(Mask, string)
|
||||
wh(Mask)
|
||||
copy(Mask)
|
||||
getValue
|
||||
setValue
|
||||
fill(Mask, uint8)
|
||||
minifyBy2(Mask, int)
|
||||
spread
|
||||
ceil(Mask)
|
||||
newImage(Mask)
|
||||
applyOpacity(Mask, float32)
|
||||
invert(Mask)
|
||||
blur(Mask, float32, uint8)
|
||||
draw(Mask, Mask, Mat3, BlendMode)
|
||||
draw(Mask, Image, Mat3, BlendMode)
|
||||
fillText(Mask, Font, string, Mat3, Vec2, HorizontalAlignment, VerticalAlignment)
|
||||
fillText(Mask, Arrangement, Mat3)
|
||||
strokeText(Mask, Font, string, Mat3, float32, Vec2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, float32, seq[float32])
|
||||
strokeText(Mask, Arrangement, Mat3, float32, LineCap, LineJoin, float32, seq[float32])
|
||||
fillPath(Mask, Path, Mat3, WindingRule)
|
||||
strokePath(Mask, Path, Mat3, float32, LineCap, LineJoin, float32, seq[float32])
|
||||
|
||||
exportRefObject Paint, ["*"]:
|
||||
discard newPaint(pkSolid)
|
||||
export
|
||||
pixie.newPaint
|
||||
exportRefObject Paint:
|
||||
fields:
|
||||
kind
|
||||
blendMode
|
||||
opacity
|
||||
color
|
||||
image
|
||||
imageMat
|
||||
gradientHandlePositions
|
||||
gradientStops
|
||||
constructor:
|
||||
newPaint(PaintKind)
|
||||
procs:
|
||||
newPaint(Paint)
|
||||
|
||||
exportRefObject Path, ["*"]:
|
||||
discard newPath()
|
||||
export
|
||||
pixie.transform,
|
||||
pixie.addPath,
|
||||
pixie.closePath,
|
||||
pixie.computeBounds,
|
||||
pixie.fillOverlaps,
|
||||
pixie.strokeOverlaps
|
||||
exportRefObject Path:
|
||||
constructor:
|
||||
newPath
|
||||
procs:
|
||||
transform(Path, Mat3)
|
||||
addPath(Path, Path)
|
||||
closePath(Path)
|
||||
computeBounds(Path)
|
||||
fillOverlaps
|
||||
strokeOverlaps
|
||||
moveTo(Path, float32, float32)
|
||||
lineTo(Path, float32, float32)
|
||||
bezierCurveTo(Path, float32, float32, float32, float32, float32, float32)
|
||||
quadraticCurveTo(Path, float32, float32, float32, float32)
|
||||
ellipticalArcTo(Path, float32, float32, float32, bool, bool, float32, float32)
|
||||
arc(Path, float32, float32, float32, float32, float32, bool)
|
||||
arcTo(Path, float32, float32, float32, float32, float32)
|
||||
rect(Path, float32, float32, float32, float32)
|
||||
roundedRect(Path, float32, float32, float32, float32, float32, float32, float32, float32, bool)
|
||||
ellipse(Path, float32, float32, float32, float32)
|
||||
circle(Path, float32, float32, float32)
|
||||
polygon(Path, float32, float32, float32, int)
|
||||
|
||||
toggleBasicOnly()
|
||||
exportRefObject Typeface:
|
||||
fields:
|
||||
filePath
|
||||
procs:
|
||||
ascent
|
||||
descent
|
||||
lineGap
|
||||
lineHeight
|
||||
getGlyphPath
|
||||
getAdvance
|
||||
getKerningAdjustment
|
||||
newFont
|
||||
|
||||
export
|
||||
pixie.moveTo,
|
||||
pixie.lineTo,
|
||||
pixie.bezierCurveTo,
|
||||
pixie.quadraticCurveTo,
|
||||
pixie.ellipticalArcTo,
|
||||
pixie.arc,
|
||||
pixie.arcTo,
|
||||
pixie.rect,
|
||||
pixie.roundedRect,
|
||||
pixie.ellipse,
|
||||
pixie.circle,
|
||||
pixie.polygon
|
||||
exportRefObject Font:
|
||||
fields:
|
||||
typeface
|
||||
size
|
||||
lineHeight
|
||||
paints
|
||||
textCase
|
||||
underline
|
||||
strikethrough
|
||||
noKerningAdjustments
|
||||
procs:
|
||||
scale(Font)
|
||||
defaultLineHeight
|
||||
typeset(Font, string, Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
||||
computeBounds(Font, string)
|
||||
|
||||
exportRefObject Typeface, ["*"]:
|
||||
discard
|
||||
export
|
||||
pixie.ascent,
|
||||
pixie.descent,
|
||||
pixie.lineGap,
|
||||
pixie.lineHeight,
|
||||
pixie.getGlyphPath,
|
||||
pixie.getAdvance,
|
||||
pixie.getKerningAdjustment,
|
||||
pixie.newFont
|
||||
exportRefObject Span:
|
||||
fields:
|
||||
text
|
||||
font
|
||||
constructor:
|
||||
newSpan
|
||||
|
||||
exportRefObject Font, ["*"]:
|
||||
discard
|
||||
export
|
||||
pixie.scale,
|
||||
pixie.defaultLineHeight,
|
||||
pixie.typeset,
|
||||
pixie.computeBounds
|
||||
exportRefObject Arrangement:
|
||||
procs:
|
||||
computeBounds(Arrangement)
|
||||
|
||||
exportRefObject Span, ["*"]:
|
||||
discard newSpan("", Font())
|
||||
|
||||
exportRefObject Arrangement, []:
|
||||
discard
|
||||
export
|
||||
pixie.computeBounds
|
||||
|
||||
exportRefObject Context, ["*"]:
|
||||
discard newContext(0, 0)
|
||||
export
|
||||
pixie.save,
|
||||
pixie.saveLayer,
|
||||
pixie.restore,
|
||||
pixie.beginPath,
|
||||
pixie.closePath,
|
||||
pixie.fill,
|
||||
pixie.clip,
|
||||
pixie.stroke,
|
||||
pixie.measureText,
|
||||
pixie.getTransform,
|
||||
pixie.setTransform,
|
||||
pixie.transform,
|
||||
pixie.resetTransform,
|
||||
bindings.drawImage1,
|
||||
bindings.drawImage2,
|
||||
bindings.drawImage3
|
||||
|
||||
toggleBasicOnly()
|
||||
|
||||
export
|
||||
pixie.moveTo,
|
||||
pixie.lineTo,
|
||||
pixie.bezierCurveTo,
|
||||
pixie.quadraticCurveTo,
|
||||
pixie.ellipticalArcTo,
|
||||
pixie.arc,
|
||||
pixie.arcTo,
|
||||
pixie.rect,
|
||||
pixie.roundedRect,
|
||||
pixie.ellipse,
|
||||
pixie.circle,
|
||||
pixie.polygon,
|
||||
pixie.clearRect,
|
||||
pixie.fillRect,
|
||||
pixie.strokeRect,
|
||||
pixie.fillText,
|
||||
pixie.strokeText,
|
||||
pixie.translate,
|
||||
pixie.scale,
|
||||
pixie.rotate,
|
||||
pixie.isPointInPath,
|
||||
pixie.isPointInStroke
|
||||
exportRefObject Context:
|
||||
fields:
|
||||
image
|
||||
fillStyle
|
||||
strokeStyle
|
||||
globalAlpha
|
||||
lineWidth
|
||||
miterLimit
|
||||
lineCap
|
||||
lineJoin
|
||||
font
|
||||
fontSize
|
||||
textAlign
|
||||
constructor:
|
||||
newContext(int, int)
|
||||
procs:
|
||||
save
|
||||
saveLayer
|
||||
restore
|
||||
beginPath
|
||||
closePath(Context)
|
||||
fill(Context, WindingRule)
|
||||
fill(Context, Path, WindingRule)
|
||||
clip(Context, WindingRule)
|
||||
clip(Context, Path, WindingRule)
|
||||
stroke(Context)
|
||||
stroke(Context, Path)
|
||||
measureText
|
||||
getTransform
|
||||
setTransform
|
||||
transform(Context, Mat3)
|
||||
resetTransform
|
||||
drawImage1
|
||||
drawImage2
|
||||
drawImage3
|
||||
moveTo(Context, float32, float32)
|
||||
lineTo(Context, float32, float32)
|
||||
bezierCurveTo(Context, float32, float32, float32, float32, float32, float32)
|
||||
quadraticCurveTo(Context, float32, float32, float32, float32)
|
||||
arc(Context, float32, float32, float32, float32, float32, bool)
|
||||
arcTo(Context, float32, float32, float32, float32, float32)
|
||||
rect(Context, float32, float32, float32, float32)
|
||||
roundedRect(Context, float32, float32, float32, float32, float32, float32, float32, float32)
|
||||
ellipse(Context, float32, float32, float32, float32)
|
||||
circle(Context, float32, float32, float32)
|
||||
polygon(Context, float32, float32, float32, int)
|
||||
clearRect(Context, float32, float32, float32, float32)
|
||||
fillRect(Context, float32, float32, float32, float32)
|
||||
strokeRect(Context, float32, float32, float32, float32)
|
||||
fillText(Context, string, float32, float32)
|
||||
strokeText(Context, string, float32, float32)
|
||||
translate(Context, float32, float32)
|
||||
scale(Context, float32, float32)
|
||||
rotate(Context, float32)
|
||||
isPointInPath(Context, float32, float32, WindingRule)
|
||||
isPointInPath(Context, Path, float32, float32, WindingRule)
|
||||
isPointInStroke(Context, float32, float32)
|
||||
isPointInStroke(Context, Path, float32, float32)
|
||||
|
||||
exportProcs:
|
||||
export
|
||||
pixie.readImage,
|
||||
pixie.readmask,
|
||||
pixie.readTypeface,
|
||||
pixie.readFont,
|
||||
pixie.parsePath,
|
||||
pixie.miterLimitToAngle,
|
||||
pixie.angleToMiterLimit
|
||||
readImage
|
||||
readmask
|
||||
readTypeface
|
||||
readFont
|
||||
parsePath
|
||||
miterLimitToAngle
|
||||
angleToMiterLimit
|
||||
|
||||
writeFiles("bindings/generated", "pixie")
|
||||
|
||||
|
|
|
@ -172,15 +172,15 @@ proc pixie_image_super_image*(image: Image, x: int, y: int, w: int, h: int): Ima
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_mask_draw*(image: Image, mask: Mask, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_image_draw*(a: Image, b: Image, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
draw(image, mask, transform, blend_mode)
|
||||
draw(a, b, transform, blend_mode)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_image_draw*(a: Image, b: Image, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_image_mask_draw*(image: Image, mask: Mask, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
draw(a, b, transform, blend_mode)
|
||||
draw(image, mask, transform, blend_mode)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
|
@ -190,15 +190,21 @@ proc pixie_image_fill_gradient*(image: Image, paint: Paint) {.raises: [], cdecl,
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_fill_text*(target: Image, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, font, text.`$`, transform, bounds, h_align, v_align)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_arrangement_fill_text*(target: Image, arrangement: Arrangement, transform: Mat3) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, arrangement, transform)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_font_fill_text*(target: Image, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_image_stroke_text*(target: Image, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, font, text.`$`, transform, bounds, h_align, v_align)
|
||||
strokeText(target, font, text.`$`, transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes.s)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
|
@ -208,12 +214,6 @@ proc pixie_image_arrangement_stroke_text*(target: Image, arrangement: Arrangemen
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_font_stroke_text*(target: Image, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
strokeText(target, font, text.`$`, transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes.s)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_image_fill_path*(image: Image, path: Path, paint: Paint, transform: Mat3, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillPath(image, path, paint, transform, winding_rule)
|
||||
|
@ -307,7 +307,7 @@ proc pixie_mask_blur*(mask: Mask, radius: float32, out_of_bounds: uint8) {.raise
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_mask_draw*(a: Mask, b: Mask, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_mask_draw*(a: Mask, b: Mask, transform: Mat3, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
draw(a, b, transform, blend_mode)
|
||||
except PixieError as e:
|
||||
|
@ -319,15 +319,21 @@ proc pixie_mask_image_draw*(mask: Mask, image: Image, transform: Mat3, blend_mod
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_fill_text*(target: Mask, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, font, text.`$`, transform, bounds, h_align, v_align)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_arrangement_fill_text*(target: Mask, arrangement: Arrangement, transform: Mat3) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, arrangement, transform)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_font_fill_text*(target: Mask, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_mask_stroke_text*(target: Mask, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillText(target, font, text.`$`, transform, bounds, h_align, v_align)
|
||||
strokeText(target, font, text.`$`, transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes.s)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
|
@ -337,12 +343,6 @@ proc pixie_mask_arrangement_stroke_text*(target: Mask, arrangement: Arrangement,
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_font_stroke_text*(target: Mask, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
strokeText(target, font, text.`$`, transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes.s)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_mask_fill_path*(mask: Mask, path: Path, transform: Mat3, winding_rule: WindingRule, blend_mode: BlendMode) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fillPath(mask, path, transform, winding_rule, blend_mode)
|
||||
|
@ -745,15 +745,21 @@ proc pixie_context_begin_path*(ctx: Context) {.raises: [], cdecl, exportc, dynli
|
|||
proc pixie_context_close_path*(ctx: Context) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
closePath(ctx)
|
||||
|
||||
proc pixie_context_fill*(ctx: Context, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fill(ctx, winding_rule)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_path_fill*(ctx: Context, path: Path, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fill(ctx, path, winding_rule)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_winding_rule_fill*(ctx: Context, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_context_clip*(ctx: Context, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
fill(ctx, winding_rule)
|
||||
clip(ctx, winding_rule)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
|
@ -763,9 +769,9 @@ proc pixie_context_path_clip*(ctx: Context, path: Path, winding_rule: WindingRul
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_winding_rule_clip*(ctx: Context, winding_rule: WindingRule) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
proc pixie_context_stroke*(ctx: Context) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
clip(ctx, winding_rule)
|
||||
stroke(ctx)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
|
@ -775,12 +781,6 @@ proc pixie_context_path_stroke*(ctx: Context, path: Path) {.raises: [], cdecl, e
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_stroke*(ctx: Context) {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
stroke(ctx)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_measure_text*(ctx: Context, text: cstring): TextMetrics {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
result = measureText(ctx, text.`$`)
|
||||
|
@ -901,12 +901,24 @@ proc pixie_context_is_point_in_path*(ctx: Context, x: float32, y: float32, windi
|
|||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_path_is_point_in_path*(ctx: Context, path: Path, x: float32, y: float32, winding_rule: WindingRule): bool {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
result = isPointInPath(ctx, path, x, y, winding_rule)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_is_point_in_stroke*(ctx: Context, x: float32, y: float32): bool {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
result = isPointInStroke(ctx, x, y)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_context_path_is_point_in_stroke*(ctx: Context, path: Path, x: float32, y: float32): bool {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
result = isPointInStroke(ctx, path, x, y)
|
||||
except PixieError as e:
|
||||
lastError = e
|
||||
|
||||
proc pixie_read_image*(file_path: cstring): Image {.raises: [], cdecl, exportc, dynlib.} =
|
||||
try:
|
||||
result = readImage(file_path.`$`)
|
||||
|
|
|
@ -401,7 +401,7 @@ proc invert*(target: Image) {.inline.} =
|
|||
|
||||
proc pixie_image_blur(image: Image, radius: float32, out_of_bounds: Color) {.importc: "pixie_image_blur", cdecl.}
|
||||
|
||||
proc blur*(image: Image, radius: float32, outOfBounds: Color) {.inline.} =
|
||||
proc blur*(image: Image, radius: float32, outOfBounds: Color = Color()) {.inline.} =
|
||||
pixie_image_blur(image, radius, outOfBounds)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
@ -434,6 +434,13 @@ proc superImage*(image: Image, x: int, y: int, w: int, h: int): Image {.inline.}
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_draw(a: Image, b: Image, transform: Mat3, blend_mode: BlendMode) {.importc: "pixie_image_draw", cdecl.}
|
||||
|
||||
proc draw*(a: Image, b: Image, transform: Mat3 = mat3(), blendMode: BlendMode = bmNormal) {.inline.} =
|
||||
pixie_image_draw(a, b, transform, blendMode)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_mask_draw(image: Image, mask: Mask, transform: Mat3, blend_mode: BlendMode) {.importc: "pixie_image_mask_draw", cdecl.}
|
||||
|
||||
proc draw*(image: Image, mask: Mask, transform: Mat3 = mat3(), blendMode: BlendMode = bmMask) {.inline.} =
|
||||
|
@ -441,13 +448,6 @@ proc draw*(image: Image, mask: Mask, transform: Mat3 = mat3(), blendMode: BlendM
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_image_draw(a: Image, b: Image, transform: Mat3, blend_mode: BlendMode) {.importc: "pixie_image_image_draw", cdecl.}
|
||||
|
||||
proc draw*(a: Image, b: Image, transform: Mat3 = mat3(), blendMode: BlendMode = bmNormal) {.inline.} =
|
||||
pixie_image_image_draw(a, b, transform, blendMode)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_fill_gradient(image: Image, paint: Paint) {.importc: "pixie_image_fill_gradient", cdecl.}
|
||||
|
||||
proc fillGradient*(image: Image, paint: Paint) {.inline.} =
|
||||
|
@ -455,6 +455,13 @@ proc fillGradient*(image: Image, paint: Paint) {.inline.} =
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_fill_text(target: Image, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.importc: "pixie_image_fill_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Image, font: Font, text: string, transform: Mat3 = mat3(), bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop) {.inline.} =
|
||||
pixie_image_fill_text(target, font, text.cstring, transform, bounds, hAlign, vAlign)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_arrangement_fill_text(target: Image, arrangement: Arrangement, transform: Mat3) {.importc: "pixie_image_arrangement_fill_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Image, arrangement: Arrangement, transform: Mat3 = mat3()) {.inline.} =
|
||||
|
@ -462,10 +469,10 @@ proc fillText*(target: Image, arrangement: Arrangement, transform: Mat3 = mat3()
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_font_fill_text(target: Image, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.importc: "pixie_image_font_fill_text", cdecl.}
|
||||
proc pixie_image_stroke_text(target: Image, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.importc: "pixie_image_stroke_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Image, font: Font, text: string, transform: Mat3 = mat3(), bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop) {.inline.} =
|
||||
pixie_image_font_fill_text(target, font, text.cstring, transform, bounds, hAlign, vAlign)
|
||||
proc strokeText*(target: Image, font: Font, text: string, transform: Mat3 = mat3(), strokeWidth: float32 = 1.0, bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop, lineCap: LineCap = lcButt, lineJoin: LineJoin = ljMiter, miterLimit: float32 = defaultMiterLimit, dashes: SeqFloat32) {.inline.} =
|
||||
pixie_image_stroke_text(target, font, text.cstring, transform, strokeWidth, bounds, hAlign, vAlign, lineCap, lineJoin, miterLimit, dashes)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
|
@ -476,13 +483,6 @@ proc strokeText*(target: Image, arrangement: Arrangement, transform: Mat3 = mat3
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_font_stroke_text(target: Image, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.importc: "pixie_image_font_stroke_text", cdecl.}
|
||||
|
||||
proc strokeText*(target: Image, font: Font, text: string, transform: Mat3 = mat3(), strokeWidth: float32 = 1.0, bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop, lineCap: LineCap = lcButt, lineJoin: LineJoin = ljMiter, miterLimit: float32 = defaultMiterLimit, dashes: SeqFloat32) {.inline.} =
|
||||
pixie_image_font_stroke_text(target, font, text.cstring, transform, strokeWidth, bounds, hAlign, vAlign, lineCap, lineJoin, miterLimit, dashes)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_image_fill_path(image: Image, path: Path, paint: Paint, transform: Mat3, winding_rule: WindingRule) {.importc: "pixie_image_fill_path", cdecl.}
|
||||
|
||||
proc fillPath*(image: Image, path: Path, paint: Paint, transform: Mat3 = mat3(), windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
|
@ -606,10 +606,10 @@ proc blur*(mask: Mask, radius: float32, outOfBounds: uint8 = 0) {.inline.} =
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_mask_draw(a: Mask, b: Mask, transform: Mat3, blend_mode: BlendMode) {.importc: "pixie_mask_mask_draw", cdecl.}
|
||||
proc pixie_mask_draw(a: Mask, b: Mask, transform: Mat3, blend_mode: BlendMode) {.importc: "pixie_mask_draw", cdecl.}
|
||||
|
||||
proc draw*(a: Mask, b: Mask, transform: Mat3 = mat3(), blendMode: BlendMode = bmMask) {.inline.} =
|
||||
pixie_mask_mask_draw(a, b, transform, blendMode)
|
||||
pixie_mask_draw(a, b, transform, blendMode)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
|
@ -620,6 +620,13 @@ proc draw*(mask: Mask, image: Image, transform: Mat3 = mat3(), blendMode: BlendM
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_fill_text(target: Mask, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.importc: "pixie_mask_fill_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Mask, font: Font, text: string, transform: Mat3 = mat3(), bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop) {.inline.} =
|
||||
pixie_mask_fill_text(target, font, text.cstring, transform, bounds, hAlign, vAlign)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_arrangement_fill_text(target: Mask, arrangement: Arrangement, transform: Mat3) {.importc: "pixie_mask_arrangement_fill_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Mask, arrangement: Arrangement, transform: Mat3 = mat3()) {.inline.} =
|
||||
|
@ -627,10 +634,10 @@ proc fillText*(target: Mask, arrangement: Arrangement, transform: Mat3 = mat3())
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_font_fill_text(target: Mask, font: Font, text: cstring, transform: Mat3, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment) {.importc: "pixie_mask_font_fill_text", cdecl.}
|
||||
proc pixie_mask_stroke_text(target: Mask, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.importc: "pixie_mask_stroke_text", cdecl.}
|
||||
|
||||
proc fillText*(target: Mask, font: Font, text: string, transform: Mat3 = mat3(), bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop) {.inline.} =
|
||||
pixie_mask_font_fill_text(target, font, text.cstring, transform, bounds, hAlign, vAlign)
|
||||
proc strokeText*(target: Mask, font: Font, text: string, transform: Mat3 = mat3(), strokeWidth: float32 = 1.0, bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop, lineCap: LineCap = lcButt, lineJoin: LineJoin = ljMiter, miterLimit: float32 = defaultMiterLimit, dashes: SeqFloat32) {.inline.} =
|
||||
pixie_mask_stroke_text(target, font, text.cstring, transform, strokeWidth, bounds, hAlign, vAlign, lineCap, lineJoin, miterLimit, dashes)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
|
@ -641,13 +648,6 @@ proc strokeText*(target: Mask, arrangement: Arrangement, transform: Mat3 = mat3(
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_font_stroke_text(target: Mask, font: Font, text: cstring, transform: Mat3, stroke_width: float32, bounds: Vec2, h_align: HorizontalAlignment, v_align: VerticalAlignment, line_cap: LineCap, line_join: LineJoin, miter_limit: float32, dashes: SeqFloat32) {.importc: "pixie_mask_font_stroke_text", cdecl.}
|
||||
|
||||
proc strokeText*(target: Mask, font: Font, text: string, transform: Mat3 = mat3(), strokeWidth: float32 = 1.0, bounds: Vec2 = vec2(0, 0), hAlign: HorizontalAlignment = haLeft, vAlign: VerticalAlignment = vaTop, lineCap: LineCap = lcButt, lineJoin: LineJoin = ljMiter, miterLimit: float32 = defaultMiterLimit, dashes: SeqFloat32) {.inline.} =
|
||||
pixie_mask_font_stroke_text(target, font, text.cstring, transform, strokeWidth, bounds, hAlign, vAlign, lineCap, lineJoin, miterLimit, dashes)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_mask_fill_path(mask: Mask, path: Path, transform: Mat3, winding_rule: WindingRule, blend_mode: BlendMode) {.importc: "pixie_mask_fill_path", cdecl.}
|
||||
|
||||
proc fillPath*(mask: Mask, path: Path, transform: Mat3 = mat3(), windingRule: WindingRule = wrNonZero, blendMode: BlendMode = bmNormal) {.inline.} =
|
||||
|
@ -1265,6 +1265,13 @@ proc pixie_context_close_path(ctx: Context) {.importc: "pixie_context_close_path
|
|||
proc closePath*(ctx: Context) {.inline.} =
|
||||
pixie_context_close_path(ctx)
|
||||
|
||||
proc pixie_context_fill(ctx: Context, winding_rule: WindingRule) {.importc: "pixie_context_fill", cdecl.}
|
||||
|
||||
proc fill*(ctx: Context, windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
pixie_context_fill(ctx, windingRule)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_path_fill(ctx: Context, path: Path, winding_rule: WindingRule) {.importc: "pixie_context_path_fill", cdecl.}
|
||||
|
||||
proc fill*(ctx: Context, path: Path, windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
|
@ -1272,10 +1279,10 @@ proc fill*(ctx: Context, path: Path, windingRule: WindingRule = wrNonZero) {.inl
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_winding_rule_fill(ctx: Context, winding_rule: WindingRule) {.importc: "pixie_context_winding_rule_fill", cdecl.}
|
||||
proc pixie_context_clip(ctx: Context, winding_rule: WindingRule) {.importc: "pixie_context_clip", cdecl.}
|
||||
|
||||
proc fill*(ctx: Context, windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
pixie_context_winding_rule_fill(ctx, windingRule)
|
||||
proc clip*(ctx: Context, windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
pixie_context_clip(ctx, windingRule)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
|
@ -1286,10 +1293,10 @@ proc clip*(ctx: Context, path: Path, windingRule: WindingRule = wrNonZero) {.inl
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_winding_rule_clip(ctx: Context, winding_rule: WindingRule) {.importc: "pixie_context_winding_rule_clip", cdecl.}
|
||||
proc pixie_context_stroke(ctx: Context) {.importc: "pixie_context_stroke", cdecl.}
|
||||
|
||||
proc clip*(ctx: Context, windingRule: WindingRule = wrNonZero) {.inline.} =
|
||||
pixie_context_winding_rule_clip(ctx, windingRule)
|
||||
proc stroke*(ctx: Context) {.inline.} =
|
||||
pixie_context_stroke(ctx)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
|
@ -1300,13 +1307,6 @@ proc stroke*(ctx: Context, path: Path) {.inline.} =
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_stroke(ctx: Context) {.importc: "pixie_context_stroke", cdecl.}
|
||||
|
||||
proc stroke*(ctx: Context) {.inline.} =
|
||||
pixie_context_stroke(ctx)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_measure_text(ctx: Context, text: cstring): TextMetrics {.importc: "pixie_context_measure_text", cdecl.}
|
||||
|
||||
proc measureText*(ctx: Context, text: string): TextMetrics {.inline.} =
|
||||
|
@ -1471,6 +1471,13 @@ proc isPointInPath*(ctx: Context, x: float32, y: float32, windingRule: WindingRu
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_path_is_point_in_path(ctx: Context, path: Path, x: float32, y: float32, winding_rule: WindingRule): bool {.importc: "pixie_context_path_is_point_in_path", cdecl.}
|
||||
|
||||
proc isPointInPath*(ctx: Context, path: Path, x: float32, y: float32, windingRule: WindingRule = wrNonZero): bool {.inline.} =
|
||||
result = pixie_context_path_is_point_in_path(ctx, path, x, y, windingRule)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_is_point_in_stroke(ctx: Context, x: float32, y: float32): bool {.importc: "pixie_context_is_point_in_stroke", cdecl.}
|
||||
|
||||
proc isPointInStroke*(ctx: Context, x: float32, y: float32): bool {.inline.} =
|
||||
|
@ -1478,6 +1485,13 @@ proc isPointInStroke*(ctx: Context, x: float32, y: float32): bool {.inline.} =
|
|||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_context_path_is_point_in_stroke(ctx: Context, path: Path, x: float32, y: float32): bool {.importc: "pixie_context_path_is_point_in_stroke", cdecl.}
|
||||
|
||||
proc isPointInStroke*(ctx: Context, path: Path, x: float32, y: float32): bool {.inline.} =
|
||||
result = pixie_context_path_is_point_in_stroke(ctx, path, x, y)
|
||||
if checkError():
|
||||
raise newException(PixieError, $takeError())
|
||||
|
||||
proc pixie_read_image(file_path: cstring): Image {.importc: "pixie_read_image", cdecl.}
|
||||
|
||||
proc readImage*(filePath: string): Image {.inline.} =
|
||||
|
@ -1522,4 +1536,3 @@ proc pixie_angle_to_miter_limit(angle: float32): float32 {.importc: "pixie_angle
|
|||
|
||||
proc angleToMiterLimit*(angle: float32): float32 {.inline.} =
|
||||
result = pixie_angle_to_miter_limit(angle)
|
||||
|
||||
|
|
|
@ -389,6 +389,13 @@ class Image(Structure):
|
|||
raise PixieError(take_error())
|
||||
return result
|
||||
|
||||
def draw(self, b, transform = None, blend_mode = BM_NORMAL):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
dll.pixie_image_draw(self, b, transform, blend_mode)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def mask_draw(self, mask, transform = None, blend_mode = BM_MASK):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
|
@ -396,15 +403,17 @@ class Image(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def image_draw(self, b, transform = None, blend_mode = BM_NORMAL):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
dll.pixie_image_image_draw(self, b, transform, blend_mode)
|
||||
def fill_gradient(self, paint):
|
||||
dll.pixie_image_fill_gradient(self, paint)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def fill_gradient(self, paint):
|
||||
dll.pixie_image_fill_gradient(self, paint)
|
||||
def fill_text(self, font, text, transform = None, bounds = None, h_align = HA_LEFT, v_align = VA_TOP):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_image_fill_text(self, font, text.encode("utf8"), transform, bounds, h_align, v_align)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -415,12 +424,12 @@ class Image(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def font_fill_text(self, font, text, transform = None, bounds = None, h_align = HA_LEFT, v_align = VA_TOP):
|
||||
def stroke_text(self, font, text, transform = None, stroke_width = 1.0, bounds = None, h_align = HA_LEFT, v_align = VA_TOP, line_cap = LC_BUTT, line_join = LJ_MITER, miter_limit = DEFAULT_MITER_LIMIT, dashes = None):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_image_font_fill_text(self, font, text.encode("utf8"), transform, bounds, h_align, v_align)
|
||||
dll.pixie_image_stroke_text(self, font, text.encode("utf8"), transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -431,15 +440,6 @@ class Image(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def font_stroke_text(self, font, text, transform = None, stroke_width = 1.0, bounds = None, h_align = HA_LEFT, v_align = VA_TOP, line_cap = LC_BUTT, line_join = LJ_MITER, miter_limit = DEFAULT_MITER_LIMIT, dashes = None):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_image_font_stroke_text(self, font, text.encode("utf8"), transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def fill_path(self, path, paint, transform = None, winding_rule = WR_NON_ZERO):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
|
@ -548,10 +548,10 @@ class Mask(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def mask_draw(self, b, transform = None, blend_mode = BM_MASK):
|
||||
def draw(self, b, transform = None, blend_mode = BM_MASK):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
dll.pixie_mask_mask_draw(self, b, transform, blend_mode)
|
||||
dll.pixie_mask_draw(self, b, transform, blend_mode)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -562,6 +562,15 @@ class Mask(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def fill_text(self, font, text, transform = None, bounds = None, h_align = HA_LEFT, v_align = VA_TOP):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_mask_fill_text(self, font, text.encode("utf8"), transform, bounds, h_align, v_align)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def arrangement_fill_text(self, arrangement, transform = None):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
|
@ -569,12 +578,12 @@ class Mask(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def font_fill_text(self, font, text, transform = None, bounds = None, h_align = HA_LEFT, v_align = VA_TOP):
|
||||
def stroke_text(self, font, text, transform = None, stroke_width = 1.0, bounds = None, h_align = HA_LEFT, v_align = VA_TOP, line_cap = LC_BUTT, line_join = LJ_MITER, miter_limit = DEFAULT_MITER_LIMIT, dashes = None):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_mask_font_fill_text(self, font, text.encode("utf8"), transform, bounds, h_align, v_align)
|
||||
dll.pixie_mask_stroke_text(self, font, text.encode("utf8"), transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -585,15 +594,6 @@ class Mask(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def font_stroke_text(self, font, text, transform = None, stroke_width = 1.0, bounds = None, h_align = HA_LEFT, v_align = VA_TOP, line_cap = LC_BUTT, line_join = LJ_MITER, miter_limit = DEFAULT_MITER_LIMIT, dashes = None):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
if bounds is None:
|
||||
bounds = Vector2(0, 0)
|
||||
dll.pixie_mask_font_stroke_text(self, font, text.encode("utf8"), transform, stroke_width, bounds, h_align, v_align, line_cap, line_join, miter_limit, dashes)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def fill_path(self, path, transform = None, winding_rule = WR_NON_ZERO, blend_mode = BM_NORMAL):
|
||||
if transform is None:
|
||||
transform = Matrix3()
|
||||
|
@ -1161,13 +1161,18 @@ class Context(Structure):
|
|||
def close_path(self):
|
||||
dll.pixie_context_close_path(self)
|
||||
|
||||
def fill(self, winding_rule = WR_NON_ZERO):
|
||||
dll.pixie_context_fill(self, winding_rule)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def path_fill(self, path, winding_rule = WR_NON_ZERO):
|
||||
dll.pixie_context_path_fill(self, path, winding_rule)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def fill(self, winding_rule = WR_NON_ZERO):
|
||||
dll.pixie_context_winding_rule_fill(self, winding_rule)
|
||||
def clip(self, winding_rule = WR_NON_ZERO):
|
||||
dll.pixie_context_clip(self, winding_rule)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -1176,8 +1181,8 @@ class Context(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def clip(self, winding_rule = WR_NON_ZERO):
|
||||
dll.pixie_context_winding_rule_clip(self, winding_rule)
|
||||
def stroke(self):
|
||||
dll.pixie_context_stroke(self)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
|
@ -1186,11 +1191,6 @@ class Context(Structure):
|
|||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def stroke(self):
|
||||
dll.pixie_context_stroke(self)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
|
||||
def measure_text(self, text):
|
||||
result = dll.pixie_context_measure_text(self, text.encode("utf8"))
|
||||
if check_error():
|
||||
|
@ -1302,12 +1302,24 @@ class Context(Structure):
|
|||
raise PixieError(take_error())
|
||||
return result
|
||||
|
||||
def path_is_point_in_path(self, path, x, y, winding_rule = WR_NON_ZERO):
|
||||
result = dll.pixie_context_path_is_point_in_path(self, path, x, y, winding_rule)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
return result
|
||||
|
||||
def is_point_in_stroke(self, x, y):
|
||||
result = dll.pixie_context_is_point_in_stroke(self, x, y)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
return result
|
||||
|
||||
def path_is_point_in_stroke(self, path, x, y):
|
||||
result = dll.pixie_context_path_is_point_in_stroke(self, path, x, y)
|
||||
if check_error():
|
||||
raise PixieError(take_error())
|
||||
return result
|
||||
|
||||
def read_image(file_path):
|
||||
result = dll.pixie_read_image(file_path.encode("utf8"))
|
||||
if check_error():
|
||||
|
@ -1481,27 +1493,27 @@ dll.pixie_image_shadow.restype = Image
|
|||
dll.pixie_image_super_image.argtypes = [Image, c_longlong, c_longlong, c_longlong, c_longlong]
|
||||
dll.pixie_image_super_image.restype = Image
|
||||
|
||||
dll.pixie_image_draw.argtypes = [Image, Image, Matrix3, BlendMode]
|
||||
dll.pixie_image_draw.restype = None
|
||||
|
||||
dll.pixie_image_mask_draw.argtypes = [Image, Mask, Matrix3, BlendMode]
|
||||
dll.pixie_image_mask_draw.restype = None
|
||||
|
||||
dll.pixie_image_image_draw.argtypes = [Image, Image, Matrix3, BlendMode]
|
||||
dll.pixie_image_image_draw.restype = None
|
||||
|
||||
dll.pixie_image_fill_gradient.argtypes = [Image, Paint]
|
||||
dll.pixie_image_fill_gradient.restype = None
|
||||
|
||||
dll.pixie_image_fill_text.argtypes = [Image, Font, c_char_p, Matrix3, Vector2, HorizontalAlignment, VerticalAlignment]
|
||||
dll.pixie_image_fill_text.restype = None
|
||||
|
||||
dll.pixie_image_arrangement_fill_text.argtypes = [Image, Arrangement, Matrix3]
|
||||
dll.pixie_image_arrangement_fill_text.restype = None
|
||||
|
||||
dll.pixie_image_font_fill_text.argtypes = [Image, Font, c_char_p, Matrix3, Vector2, HorizontalAlignment, VerticalAlignment]
|
||||
dll.pixie_image_font_fill_text.restype = None
|
||||
dll.pixie_image_stroke_text.argtypes = [Image, Font, c_char_p, Matrix3, c_float, Vector2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_image_stroke_text.restype = None
|
||||
|
||||
dll.pixie_image_arrangement_stroke_text.argtypes = [Image, Arrangement, Matrix3, c_float, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_image_arrangement_stroke_text.restype = None
|
||||
|
||||
dll.pixie_image_font_stroke_text.argtypes = [Image, Font, c_char_p, Matrix3, c_float, Vector2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_image_font_stroke_text.restype = None
|
||||
|
||||
dll.pixie_image_fill_path.argtypes = [Image, Path, Paint, Matrix3, WindingRule]
|
||||
dll.pixie_image_fill_path.restype = None
|
||||
|
||||
|
@ -1568,24 +1580,24 @@ dll.pixie_mask_invert.restype = None
|
|||
dll.pixie_mask_blur.argtypes = [Mask, c_float, c_ubyte]
|
||||
dll.pixie_mask_blur.restype = None
|
||||
|
||||
dll.pixie_mask_mask_draw.argtypes = [Mask, Mask, Matrix3, BlendMode]
|
||||
dll.pixie_mask_mask_draw.restype = None
|
||||
dll.pixie_mask_draw.argtypes = [Mask, Mask, Matrix3, BlendMode]
|
||||
dll.pixie_mask_draw.restype = None
|
||||
|
||||
dll.pixie_mask_image_draw.argtypes = [Mask, Image, Matrix3, BlendMode]
|
||||
dll.pixie_mask_image_draw.restype = None
|
||||
|
||||
dll.pixie_mask_fill_text.argtypes = [Mask, Font, c_char_p, Matrix3, Vector2, HorizontalAlignment, VerticalAlignment]
|
||||
dll.pixie_mask_fill_text.restype = None
|
||||
|
||||
dll.pixie_mask_arrangement_fill_text.argtypes = [Mask, Arrangement, Matrix3]
|
||||
dll.pixie_mask_arrangement_fill_text.restype = None
|
||||
|
||||
dll.pixie_mask_font_fill_text.argtypes = [Mask, Font, c_char_p, Matrix3, Vector2, HorizontalAlignment, VerticalAlignment]
|
||||
dll.pixie_mask_font_fill_text.restype = None
|
||||
dll.pixie_mask_stroke_text.argtypes = [Mask, Font, c_char_p, Matrix3, c_float, Vector2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_mask_stroke_text.restype = None
|
||||
|
||||
dll.pixie_mask_arrangement_stroke_text.argtypes = [Mask, Arrangement, Matrix3, c_float, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_mask_arrangement_stroke_text.restype = None
|
||||
|
||||
dll.pixie_mask_font_stroke_text.argtypes = [Mask, Font, c_char_p, Matrix3, c_float, Vector2, HorizontalAlignment, VerticalAlignment, LineCap, LineJoin, c_float, SeqFloat32]
|
||||
dll.pixie_mask_font_stroke_text.restype = None
|
||||
|
||||
dll.pixie_mask_fill_path.argtypes = [Mask, Path, Matrix3, WindingRule, BlendMode]
|
||||
dll.pixie_mask_fill_path.restype = None
|
||||
|
||||
|
@ -1952,24 +1964,24 @@ dll.pixie_context_begin_path.restype = None
|
|||
dll.pixie_context_close_path.argtypes = [Context]
|
||||
dll.pixie_context_close_path.restype = None
|
||||
|
||||
dll.pixie_context_fill.argtypes = [Context, WindingRule]
|
||||
dll.pixie_context_fill.restype = None
|
||||
|
||||
dll.pixie_context_path_fill.argtypes = [Context, Path, WindingRule]
|
||||
dll.pixie_context_path_fill.restype = None
|
||||
|
||||
dll.pixie_context_winding_rule_fill.argtypes = [Context, WindingRule]
|
||||
dll.pixie_context_winding_rule_fill.restype = None
|
||||
dll.pixie_context_clip.argtypes = [Context, WindingRule]
|
||||
dll.pixie_context_clip.restype = None
|
||||
|
||||
dll.pixie_context_path_clip.argtypes = [Context, Path, WindingRule]
|
||||
dll.pixie_context_path_clip.restype = None
|
||||
|
||||
dll.pixie_context_winding_rule_clip.argtypes = [Context, WindingRule]
|
||||
dll.pixie_context_winding_rule_clip.restype = None
|
||||
dll.pixie_context_stroke.argtypes = [Context]
|
||||
dll.pixie_context_stroke.restype = None
|
||||
|
||||
dll.pixie_context_path_stroke.argtypes = [Context, Path]
|
||||
dll.pixie_context_path_stroke.restype = None
|
||||
|
||||
dll.pixie_context_stroke.argtypes = [Context]
|
||||
dll.pixie_context_stroke.restype = None
|
||||
|
||||
dll.pixie_context_measure_text.argtypes = [Context, c_char_p]
|
||||
dll.pixie_context_measure_text.restype = TextMetrics
|
||||
|
||||
|
@ -2054,9 +2066,15 @@ dll.pixie_context_rotate.restype = None
|
|||
dll.pixie_context_is_point_in_path.argtypes = [Context, c_float, c_float, WindingRule]
|
||||
dll.pixie_context_is_point_in_path.restype = c_bool
|
||||
|
||||
dll.pixie_context_path_is_point_in_path.argtypes = [Context, Path, c_float, c_float, WindingRule]
|
||||
dll.pixie_context_path_is_point_in_path.restype = c_bool
|
||||
|
||||
dll.pixie_context_is_point_in_stroke.argtypes = [Context, c_float, c_float]
|
||||
dll.pixie_context_is_point_in_stroke.restype = c_bool
|
||||
|
||||
dll.pixie_context_path_is_point_in_stroke.argtypes = [Context, Path, c_float, c_float]
|
||||
dll.pixie_context_path_is_point_in_stroke.restype = c_bool
|
||||
|
||||
dll.pixie_read_image.argtypes = [c_char_p]
|
||||
dll.pixie_read_image.restype = Image
|
||||
|
||||
|
|
|
@ -360,8 +360,6 @@ proc fill*(
|
|||
## Fills the current path with the current fillStyle.
|
||||
ctx.fill(ctx.path, windingRule)
|
||||
|
||||
proc clip*(ctx: Context, windingRule = wrNonZero) {.inline, raises: [PixieError].}
|
||||
|
||||
proc clip*(
|
||||
ctx: Context, path: Path, windingRule = wrNonZero
|
||||
) {.raises: [PixieError].} =
|
||||
|
@ -382,8 +380,6 @@ proc clip*(
|
|||
## to create the new clipping region.
|
||||
ctx.clip(ctx.path, windingRule)
|
||||
|
||||
proc stroke*(ctx: Context) {.inline, raises: [PixieError].}
|
||||
|
||||
proc stroke*(ctx: Context, path: Path) {.raises: [PixieError].} =
|
||||
## Strokes (outlines) the current or given path with the current strokeStyle.
|
||||
if ctx.mask != nil and ctx.layer == nil:
|
||||
|
|
|
@ -450,7 +450,7 @@ proc invert*(target: Image | Mask) {.raises: [].} =
|
|||
target.data[j] = (255 - target.data[j]).uint8
|
||||
|
||||
proc blur*(
|
||||
image: Image, radius: float32, outOfBounds: SomeColor = ColorRGBX()
|
||||
image: Image, radius: float32, outOfBounds: SomeColor = Color()
|
||||
) {.raises: [PixieError].} =
|
||||
## Applies Gaussian blur to the image given a radius.
|
||||
let radius = round(radius).int
|
||||
|
|
Loading…
Reference in a new issue