2021-09-01 18:15:33 +00:00
|
|
|
import genny, pixie, unicode
|
2021-08-24 01:21:10 +00:00
|
|
|
|
|
|
|
var lastError*: ref PixieError
|
|
|
|
|
|
|
|
proc takeError*(): string =
|
|
|
|
result = lastError.msg
|
|
|
|
lastError = nil
|
|
|
|
|
2021-08-31 17:17:17 +00:00
|
|
|
proc checkError*(): bool =
|
2021-08-24 01:21:10 +00:00
|
|
|
result = lastError != nil
|
|
|
|
|
2021-08-27 03:18:39 +00:00
|
|
|
type
|
|
|
|
Vector2* = object
|
|
|
|
x*, y*: float32
|
|
|
|
|
|
|
|
Matrix3* = object
|
|
|
|
a*, b*, c*, d*, e*, f*, g*, h*, i*: float32
|
|
|
|
|
|
|
|
proc matrix3*(): Matrix3 =
|
|
|
|
Matrix3(a: 1, b: 0, c: 0, d: 0, e: 1, f: 0, g: 0, h: 0, i: 1)
|
|
|
|
|
2021-08-24 01:21:10 +00:00
|
|
|
proc drawImage1*(
|
|
|
|
ctx: Context, image: Image, dx, dy: float32
|
|
|
|
) {.raises: [PixieError].} =
|
|
|
|
ctx.drawImage(image, dx, dy)
|
|
|
|
|
|
|
|
proc drawImage2*(
|
|
|
|
ctx: Context, image: Image, dx, dy, dWidth, dHeight: float32
|
|
|
|
) {.raises: [PixieError].} =
|
|
|
|
ctx.drawImage(image, dx, dy, dWidth, dHeight)
|
|
|
|
|
|
|
|
proc drawImage3*(
|
|
|
|
ctx: Context,
|
|
|
|
image: Image,
|
|
|
|
sx, sy, sWidth, sHeight,
|
|
|
|
dx, dy, dWidth, dHeight: float32
|
|
|
|
) {.raises: [PixieError].} =
|
|
|
|
ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight)
|
|
|
|
|
2021-08-27 01:32:07 +00:00
|
|
|
exportConsts:
|
2021-08-31 22:51:44 +00:00
|
|
|
defaultMiterLimit
|
|
|
|
autoLineHeight
|
2021-08-27 01:32:07 +00:00
|
|
|
|
2021-08-24 22:31:35 +00:00
|
|
|
exportEnums:
|
2021-08-31 22:51:44 +00:00
|
|
|
FileFormat
|
|
|
|
BlendMode
|
|
|
|
PaintKind
|
|
|
|
WindingRule
|
|
|
|
LineCap
|
|
|
|
LineJoin
|
|
|
|
HorizontalAlignment
|
|
|
|
VerticalAlignment
|
|
|
|
TextCase
|
2021-08-24 01:21:10 +00:00
|
|
|
|
|
|
|
exportProcs:
|
2021-08-31 22:51:44 +00:00
|
|
|
checkError
|
|
|
|
takeError
|
2021-08-24 01:21:10 +00:00
|
|
|
|
2021-08-27 03:18:39 +00:00
|
|
|
exportObject Vector2:
|
2021-08-31 16:51:22 +00:00
|
|
|
discard
|
2021-08-27 03:18:39 +00:00
|
|
|
|
|
|
|
exportObject Matrix3:
|
2021-08-31 22:51:44 +00:00
|
|
|
constructor:
|
|
|
|
matrix3
|
2021-08-27 03:18:39 +00:00
|
|
|
|
|
|
|
exportObject Rect:
|
|
|
|
discard
|
|
|
|
|
|
|
|
exportObject Color:
|
|
|
|
discard
|
|
|
|
|
|
|
|
exportObject ColorStop:
|
2021-08-31 16:51:22 +00:00
|
|
|
discard
|
2021-08-27 03:18:39 +00:00
|
|
|
|
|
|
|
exportObject TextMetrics:
|
|
|
|
discard
|
|
|
|
|
2021-08-24 01:21:10 +00:00
|
|
|
exportSeq seq[float32]:
|
|
|
|
discard
|
|
|
|
|
|
|
|
exportSeq seq[Span]:
|
2021-08-31 22:51:44 +00:00
|
|
|
procs:
|
|
|
|
typeset(seq[Span], Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
|
|
|
computeBounds(seq[Span])
|
|
|
|
|
|
|
|
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:
|
|
|
|
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:
|
|
|
|
fields:
|
|
|
|
kind
|
|
|
|
blendMode
|
|
|
|
opacity
|
|
|
|
color
|
|
|
|
image
|
|
|
|
imageMat
|
|
|
|
gradientHandlePositions
|
|
|
|
gradientStops
|
|
|
|
constructor:
|
|
|
|
newPaint(PaintKind)
|
|
|
|
procs:
|
|
|
|
newPaint(Paint)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
exportRefObject Typeface:
|
|
|
|
fields:
|
|
|
|
filePath
|
|
|
|
procs:
|
|
|
|
ascent
|
|
|
|
descent
|
|
|
|
lineGap
|
|
|
|
lineHeight
|
|
|
|
getGlyphPath
|
|
|
|
getAdvance
|
|
|
|
getKerningAdjustment
|
|
|
|
newFont
|
|
|
|
|
|
|
|
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 Span:
|
|
|
|
fields:
|
|
|
|
text
|
|
|
|
font
|
|
|
|
constructor:
|
|
|
|
newSpan
|
|
|
|
|
|
|
|
exportRefObject Arrangement:
|
|
|
|
procs:
|
|
|
|
computeBounds(Arrangement)
|
|
|
|
|
|
|
|
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)
|
2021-08-24 01:21:10 +00:00
|
|
|
|
|
|
|
exportProcs:
|
2021-08-31 22:51:44 +00:00
|
|
|
readImage
|
|
|
|
readmask
|
|
|
|
readTypeface
|
|
|
|
readFont
|
|
|
|
parsePath
|
|
|
|
miterLimitToAngle
|
|
|
|
angleToMiterLimit
|
2021-08-24 01:21:10 +00:00
|
|
|
|
|
|
|
writeFiles("bindings/generated", "pixie")
|
|
|
|
|
2021-08-25 03:19:28 +00:00
|
|
|
include generated/internal
|