@gtkx/cairo 2.0.0-beta.10 → 2.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +8 -168
  2. package/dist/context.d.ts.map +1 -1
  3. package/dist/context.js +8 -7
  4. package/dist/context.js.map +1 -1
  5. package/dist/device.d.ts.map +1 -1
  6. package/dist/enums.d.ts +10 -1
  7. package/dist/enums.d.ts.map +1 -1
  8. package/dist/enums.js +9 -0
  9. package/dist/enums.js.map +1 -1
  10. package/dist/font-face.d.ts +1 -1
  11. package/dist/font-face.d.ts.map +1 -1
  12. package/dist/font-face.js +1 -1
  13. package/dist/font-face.js.map +1 -1
  14. package/dist/font-options.d.ts +2 -2
  15. package/dist/font-options.d.ts.map +1 -1
  16. package/dist/font-options.js +1 -1
  17. package/dist/font-options.js.map +1 -1
  18. package/dist/lib.d.ts.map +1 -1
  19. package/dist/lib.js +7 -35
  20. package/dist/lib.js.map +1 -1
  21. package/dist/matrix.d.ts.map +1 -1
  22. package/dist/path.d.ts.map +1 -1
  23. package/dist/path.js +9 -22
  24. package/dist/path.js.map +1 -1
  25. package/dist/pattern.d.ts.map +1 -1
  26. package/dist/pattern.js +5 -5
  27. package/dist/pattern.js.map +1 -1
  28. package/dist/region.d.ts.map +1 -1
  29. package/dist/scaled-font.d.ts.map +1 -1
  30. package/dist/scaled-font.js +3 -1
  31. package/dist/scaled-font.js.map +1 -1
  32. package/dist/status.d.ts.map +1 -1
  33. package/dist/structs.d.ts.map +1 -1
  34. package/dist/structs.js +32 -36
  35. package/dist/structs.js.map +1 -1
  36. package/dist/surface.d.ts +3 -3
  37. package/dist/surface.d.ts.map +1 -1
  38. package/dist/surface.js +18 -16
  39. package/dist/surface.js.map +1 -1
  40. package/dist/text.d.ts.map +1 -1
  41. package/dist/version.d.ts.map +1 -1
  42. package/package.json +6 -17
  43. package/src/context.ts +8 -7
  44. package/src/enums.ts +10 -1
  45. package/src/font-face.ts +3 -7
  46. package/src/font-options.ts +5 -9
  47. package/src/lib.ts +7 -35
  48. package/src/path.ts +11 -27
  49. package/src/pattern.ts +7 -12
  50. package/src/scaled-font.ts +4 -6
  51. package/src/structs.ts +32 -48
  52. package/src/surface.ts +29 -33
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,SAAS,EAET,IAAI,EACJ,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,CAAC,EACD,QAAQ,EACR,KAAK,GACR,MAAM,eAAe,CAAC;AA8CvB,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,MAAM,cAAc,GAAG,WAAW,CAAC,qBAAqB,EAAE,kCAAkC,CAAC,CAAC;AAC9F,MAAM,kBAAkB,GAAG,WAAW,CAAC,qBAAqB,EAAE,sCAAsC,CAAC,CAAC;AACtG,MAAM,UAAU,GAAG,WAAW,CAAC,qBAAqB,EAAE,8BAA8B,CAAC,CAAC;AACtF,MAAM,iBAAiB,GAAG,WAAW,CAAC,qBAAqB,EAAE,qCAAqC,CAAC,CAAC;AACpG,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;AACzB,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC;AACpB,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC;AAE1B,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,UAA2B,EAAE,MAAc,EAAU,EAAE,CACxF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAW,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,UAA2B,EAAE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FAAoF;IACpF,YAAY,QAAqC,EAAE;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAC3D,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7C,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC9C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,gDAAgD;IAChD,IAAI,QAAQ;QACR,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,gDAAgD;IAChD,IAAI,QAAQ,CAAC,KAAa;QACtB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,2CAA2C;IAC3C,IAAI,SAAS;QACT,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,2CAA2C;IAC3C,IAAI,SAAS,CAAC,KAAa;QACvB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACJ;AAED,OAAO,EACH,KAAK,EAEL,SAAS,EAET,YAAY,EAEZ,WAAW,GAEd,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n read,\n registerWrapperClass,\n resolveType,\n setHandle,\n t,\n toNative,\n write,\n} from \"@gtkx/runtime\";\n\ntype FieldDescriptor = typeof t.float64 | typeof t.int32 | typeof t.biguint64;\n\n/** Initial field values for a `Rectangle`; a field left out or set to null keeps zero. */\ntype RectangleConstructorProps = {\n /** Horizontal position of the left edge. */\n x?: number | null;\n /** Vertical position of the top edge. */\n y?: number | null;\n /** Width of the rectangle. */\n width?: number | null;\n /** Height of the rectangle. */\n height?: number | null;\n};\n\n/** Initial field values for a `RectangleInt`; a field left out or set to null keeps zero. */\ntype RectangleIntConstructorProps = {\n /** Horizontal position of the left edge. */\n x?: number | null;\n /** Vertical position of the top edge. */\n y?: number | null;\n /** Width of the rectangle. */\n width?: number | null;\n /** Height of the rectangle. */\n height?: number | null;\n};\n\n/** Initial field values for a `Glyph`; a field left out or set to null keeps zero. */\ntype GlyphConstructorProps = {\n /** Index of the glyph in the font. */\n index?: bigint | null;\n /** Horizontal position of the glyph origin. */\n x?: number | null;\n /** Vertical position of the glyph origin. */\n y?: number | null;\n};\n\n/** Initial field values for a `TextCluster`; a field left out or set to null keeps zero. */\ntype TextClusterConstructorProps = {\n /** Number of UTF-8 bytes the cluster covers. */\n numBytes?: number | null;\n /** Number of glyphs the cluster covers. */\n numGlyphs?: number | null;\n};\n\nconst CAIRO_GOBJECT_LIBRARY = \"libcairo-gobject.so.2\";\nconst RECTANGLE_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_rectangle_get_type\");\nconst RECTANGLE_INT_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_rectangle_int_get_type\");\nconst GLYPH_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_glyph_get_type\");\nconst TEXT_CLUSTER_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_text_cluster_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst RECTANGLE_INT_SIZE = 16;\nconst GLYPH_SIZE = 24;\nconst TEXT_CLUSTER_SIZE = 8;\nconst DOUBLE = t.float64;\nconst INT = t.int32;\nconst ULONG = t.biguint64;\n\nconst readField = (instance: object, descriptor: FieldDescriptor, offset: number): number =>\n read(getHandle(instance), descriptor, offset) as number;\n\nconst writeField = (instance: object, descriptor: FieldDescriptor, offset: number, value: unknown): void => {\n write(getHandle(instance), descriptor, offset, toNative(descriptor, value));\n};\n\nconst writeInitial = (\n handle: ExternalObject<Handle>,\n descriptor: FieldDescriptor,\n offset: number,\n value: unknown,\n): void => {\n if (value != null) {\n write(handle, descriptor, offset, toNative(descriptor, value));\n }\n};\n\n/** A rectangle with double-precision edges, as `copyClipRectangleList` and recording surfaces report. */\nclass Rectangle {\n static {\n registerWrapperClass(this, RECTANGLE_TYPE);\n }\n\n /** GType of `CairoRectangle`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a rectangle, writing the given fields and leaving the others at zero. */\n constructor(props: RectangleConstructorProps = {}) {\n const handle = alloc(RECTANGLE_SIZE, RECTANGLE_TYPE);\n writeInitial(handle, DOUBLE, 0, props.x);\n writeInitial(handle, DOUBLE, 8, props.y);\n writeInitial(handle, DOUBLE, 16, props.width);\n writeInitial(handle, DOUBLE, 24, props.height);\n setHandle(this, handle);\n }\n\n /** Horizontal position of the left edge. */\n get x(): number {\n return readField(this, DOUBLE, 0);\n }\n\n /** Horizontal position of the left edge. */\n set x(value: number) {\n writeField(this, DOUBLE, 0, value);\n }\n\n /** Vertical position of the top edge. */\n get y(): number {\n return readField(this, DOUBLE, 8);\n }\n\n /** Vertical position of the top edge. */\n set y(value: number) {\n writeField(this, DOUBLE, 8, value);\n }\n\n /** Width of the rectangle. */\n get width(): number {\n return readField(this, DOUBLE, 16);\n }\n\n /** Width of the rectangle. */\n set width(value: number) {\n writeField(this, DOUBLE, 16, value);\n }\n\n /** Height of the rectangle. */\n get height(): number {\n return readField(this, DOUBLE, 24);\n }\n\n /** Height of the rectangle. */\n set height(value: number) {\n writeField(this, DOUBLE, 24, value);\n }\n}\n\n/** A rectangle with integer edges, as Cairo regions use. */\nclass RectangleInt {\n static {\n registerWrapperClass(this, RECTANGLE_INT_TYPE);\n }\n\n /** GType of `CairoRectangleInt`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a rectangle, writing the given fields and leaving the others at zero. */\n constructor(props: RectangleIntConstructorProps = {}) {\n const handle = alloc(RECTANGLE_INT_SIZE, RECTANGLE_INT_TYPE);\n writeInitial(handle, INT, 0, props.x);\n writeInitial(handle, INT, 4, props.y);\n writeInitial(handle, INT, 8, props.width);\n writeInitial(handle, INT, 12, props.height);\n setHandle(this, handle);\n }\n\n /** Horizontal position of the left edge. */\n get x(): number {\n return readField(this, INT, 0);\n }\n\n /** Horizontal position of the left edge. */\n set x(value: number) {\n writeField(this, INT, 0, value);\n }\n\n /** Vertical position of the top edge. */\n get y(): number {\n return readField(this, INT, 4);\n }\n\n /** Vertical position of the top edge. */\n set y(value: number) {\n writeField(this, INT, 4, value);\n }\n\n /** Width of the rectangle. */\n get width(): number {\n return readField(this, INT, 8);\n }\n\n /** Width of the rectangle. */\n set width(value: number) {\n writeField(this, INT, 8, value);\n }\n\n /** Height of the rectangle. */\n get height(): number {\n return readField(this, INT, 12);\n }\n\n /** Height of the rectangle. */\n set height(value: number) {\n writeField(this, INT, 12, value);\n }\n}\n\n/** A `cairo_glyph_t`: one glyph index and where to draw it. */\nclass Glyph {\n static {\n registerWrapperClass(this, GLYPH_TYPE);\n }\n\n /** GType of `CairoGlyph`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a glyph, writing the given fields and leaving the others at zero. */\n constructor(props: GlyphConstructorProps = {}) {\n const handle = alloc(GLYPH_SIZE, GLYPH_TYPE);\n writeInitial(handle, ULONG, 0, props.index);\n writeInitial(handle, DOUBLE, 8, props.x);\n writeInitial(handle, DOUBLE, 16, props.y);\n setHandle(this, handle);\n }\n\n /** Index of the glyph in the font. */\n get index(): bigint {\n return read(getHandle(this), ULONG, 0) as bigint;\n }\n\n /** Index of the glyph in the font. */\n set index(value: bigint) {\n writeField(this, ULONG, 0, value);\n }\n\n /** Horizontal position of the glyph origin. */\n get x(): number {\n return readField(this, DOUBLE, 8);\n }\n\n /** Horizontal position of the glyph origin. */\n set x(value: number) {\n writeField(this, DOUBLE, 8, value);\n }\n\n /** Vertical position of the glyph origin. */\n get y(): number {\n return readField(this, DOUBLE, 16);\n }\n\n /** Vertical position of the glyph origin. */\n set y(value: number) {\n writeField(this, DOUBLE, 16, value);\n }\n}\n\n/** A `cairo_text_cluster_t`: how many bytes of text map to how many glyphs. */\nclass TextCluster {\n static {\n registerWrapperClass(this, TEXT_CLUSTER_TYPE);\n }\n\n /** GType of `CairoTextCluster`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a cluster, writing the given fields and leaving the others at zero. */\n constructor(props: TextClusterConstructorProps = {}) {\n const handle = alloc(TEXT_CLUSTER_SIZE, TEXT_CLUSTER_TYPE);\n writeInitial(handle, INT, 0, props.numBytes);\n writeInitial(handle, INT, 4, props.numGlyphs);\n setHandle(this, handle);\n }\n\n /** Number of UTF-8 bytes the cluster covers. */\n get numBytes(): number {\n return readField(this, INT, 0);\n }\n\n /** Number of UTF-8 bytes the cluster covers. */\n set numBytes(value: number) {\n writeField(this, INT, 0, value);\n }\n\n /** Number of glyphs the cluster covers. */\n get numGlyphs(): number {\n return readField(this, INT, 4);\n }\n\n /** Number of glyphs the cluster covers. */\n set numGlyphs(value: number) {\n writeField(this, INT, 4, value);\n }\n}\n\nexport {\n Glyph,\n type GlyphConstructorProps,\n Rectangle,\n type RectangleConstructorProps,\n RectangleInt,\n type RectangleIntConstructorProps,\n TextCluster,\n type TextClusterConstructorProps,\n};\n"]}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,SAAS,EAET,oBAAoB,EACpB,WAAW,EACX,SAAS,EAET,CAAC,GACJ,MAAM,eAAe,CAAC;AA4CvB,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,MAAM,cAAc,GAAG,WAAW,CAAC,qBAAqB,EAAE,kCAAkC,CAAC,CAAC;AAC9F,MAAM,kBAAkB,GAAG,WAAW,CAAC,qBAAqB,EAAE,sCAAsC,CAAC,CAAC;AACtG,MAAM,UAAU,GAAG,WAAW,CAAC,qBAAqB,EAAE,8BAA8B,CAAC,CAAC;AACtF,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,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,2CAA2C;IAC3C,IAAI,SAAS;QACT,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAW,CAAC;IAClD,CAAC;IAED,2CAA2C;IAC3C,IAAI,SAAS,CAAC,KAAa;QACvB,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;CACJ;AAED,OAAO,EACH,KAAK,EAEL,SAAS,EAET,YAAY,EAEZ,WAAW,GAEd,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n registerWrapperClass,\n resolveType,\n setHandle,\n type StridedField,\n t,\n} from \"@gtkx/runtime\";\n\n/** Initial field values for a `Rectangle`; a field left out or set to null keeps zero. */\ntype RectangleConstructorProps = {\n /** Horizontal position of the left edge. */\n x?: number | null;\n /** Vertical position of the top edge. */\n y?: number | null;\n /** Width of the rectangle. */\n width?: number | null;\n /** Height of the rectangle. */\n height?: number | null;\n};\n\n/** Initial field values for a `RectangleInt`; a field left out or set to null keeps zero. */\ntype RectangleIntConstructorProps = {\n /** Horizontal position of the left edge. */\n x?: number | null;\n /** Vertical position of the top edge. */\n y?: number | null;\n /** Width of the rectangle. */\n width?: number | null;\n /** Height of the rectangle. */\n height?: number | null;\n};\n\n/** Initial field values for a `Glyph`; a field left out or set to null keeps zero. */\ntype GlyphConstructorProps = {\n /** Index of the glyph in the font. */\n index?: bigint | null;\n /** Horizontal position of the glyph origin. */\n x?: number | null;\n /** Vertical position of the glyph origin. */\n y?: number | null;\n};\n\n/** Initial field values for a `TextCluster`; a field left out or set to null keeps zero. */\ntype TextClusterConstructorProps = {\n /** Number of UTF-8 bytes the cluster covers. */\n numBytes?: number | null;\n /** Number of glyphs the cluster covers. */\n numGlyphs?: number | null;\n};\n\nconst CAIRO_GOBJECT_LIBRARY = \"libcairo-gobject.so.2\";\nconst RECTANGLE_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_rectangle_get_type\");\nconst RECTANGLE_INT_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_rectangle_int_get_type\");\nconst GLYPH_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_glyph_get_type\");\nconst TEXT_CLUSTER_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, \"cairo_gobject_text_cluster_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst RECTANGLE_INT_SIZE = 16;\nconst GLYPH_SIZE = 24;\nconst TEXT_CLUSTER_SIZE = 8;\nconst DOUBLE = t.fieldAt(t.float64);\nconst INT = t.fieldAt(t.int32);\nconst ULONG = t.fieldAt(t.biguint64);\n\nconst writeInitial = (handle: ExternalObject<Handle>, field: StridedField, offset: number, value: unknown): void => {\n if (value != null) {\n field.write(handle, offset, value);\n }\n};\n\n/** A rectangle with double-precision edges, as `copyClipRectangleList` and recording surfaces report. */\nclass Rectangle {\n static {\n registerWrapperClass(this, RECTANGLE_TYPE);\n }\n\n /** GType of `CairoRectangle`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a rectangle, writing the given fields and leaving the others at zero. */\n constructor(props: RectangleConstructorProps = {}) {\n const handle = alloc(RECTANGLE_SIZE, RECTANGLE_TYPE);\n writeInitial(handle, DOUBLE, 0, props.x);\n writeInitial(handle, DOUBLE, 8, props.y);\n writeInitial(handle, DOUBLE, 16, props.width);\n writeInitial(handle, DOUBLE, 24, props.height);\n setHandle(this, handle);\n }\n\n /** Horizontal position of the left edge. */\n get x(): number {\n return DOUBLE.read(getHandle(this), 0) as number;\n }\n\n /** Horizontal position of the left edge. */\n set x(value: number) {\n DOUBLE.write(getHandle(this), 0, value);\n }\n\n /** Vertical position of the top edge. */\n get y(): number {\n return DOUBLE.read(getHandle(this), 8) as number;\n }\n\n /** Vertical position of the top edge. */\n set y(value: number) {\n DOUBLE.write(getHandle(this), 8, value);\n }\n\n /** Width of the rectangle. */\n get width(): number {\n return DOUBLE.read(getHandle(this), 16) as number;\n }\n\n /** Width of the rectangle. */\n set width(value: number) {\n DOUBLE.write(getHandle(this), 16, value);\n }\n\n /** Height of the rectangle. */\n get height(): number {\n return DOUBLE.read(getHandle(this), 24) as number;\n }\n\n /** Height of the rectangle. */\n set height(value: number) {\n DOUBLE.write(getHandle(this), 24, value);\n }\n}\n\n/** A rectangle with integer edges, as Cairo regions use. */\nclass RectangleInt {\n static {\n registerWrapperClass(this, RECTANGLE_INT_TYPE);\n }\n\n /** GType of `CairoRectangleInt`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a rectangle, writing the given fields and leaving the others at zero. */\n constructor(props: RectangleIntConstructorProps = {}) {\n const handle = alloc(RECTANGLE_INT_SIZE, RECTANGLE_INT_TYPE);\n writeInitial(handle, INT, 0, props.x);\n writeInitial(handle, INT, 4, props.y);\n writeInitial(handle, INT, 8, props.width);\n writeInitial(handle, INT, 12, props.height);\n setHandle(this, handle);\n }\n\n /** Horizontal position of the left edge. */\n get x(): number {\n return INT.read(getHandle(this), 0) as number;\n }\n\n /** Horizontal position of the left edge. */\n set x(value: number) {\n INT.write(getHandle(this), 0, value);\n }\n\n /** Vertical position of the top edge. */\n get y(): number {\n return INT.read(getHandle(this), 4) as number;\n }\n\n /** Vertical position of the top edge. */\n set y(value: number) {\n INT.write(getHandle(this), 4, value);\n }\n\n /** Width of the rectangle. */\n get width(): number {\n return INT.read(getHandle(this), 8) as number;\n }\n\n /** Width of the rectangle. */\n set width(value: number) {\n INT.write(getHandle(this), 8, value);\n }\n\n /** Height of the rectangle. */\n get height(): number {\n return INT.read(getHandle(this), 12) as number;\n }\n\n /** Height of the rectangle. */\n set height(value: number) {\n INT.write(getHandle(this), 12, value);\n }\n}\n\n/** A `cairo_glyph_t`: one glyph index and where to draw it. */\nclass Glyph {\n static {\n registerWrapperClass(this, GLYPH_TYPE);\n }\n\n /** GType of `CairoGlyph`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a glyph, writing the given fields and leaving the others at zero. */\n constructor(props: GlyphConstructorProps = {}) {\n const handle = alloc(GLYPH_SIZE, GLYPH_TYPE);\n writeInitial(handle, ULONG, 0, props.index);\n writeInitial(handle, DOUBLE, 8, props.x);\n writeInitial(handle, DOUBLE, 16, props.y);\n setHandle(this, handle);\n }\n\n /** Index of the glyph in the font. */\n get index(): bigint {\n return ULONG.read(getHandle(this), 0) as bigint;\n }\n\n /** Index of the glyph in the font. */\n set index(value: bigint) {\n ULONG.write(getHandle(this), 0, value);\n }\n\n /** Horizontal position of the glyph origin. */\n get x(): number {\n return DOUBLE.read(getHandle(this), 8) as number;\n }\n\n /** Horizontal position of the glyph origin. */\n set x(value: number) {\n DOUBLE.write(getHandle(this), 8, value);\n }\n\n /** Vertical position of the glyph origin. */\n get y(): number {\n return DOUBLE.read(getHandle(this), 16) as number;\n }\n\n /** Vertical position of the glyph origin. */\n set y(value: number) {\n DOUBLE.write(getHandle(this), 16, value);\n }\n}\n\n/** A `cairo_text_cluster_t`: how many bytes of text map to how many glyphs. */\nclass TextCluster {\n static {\n registerWrapperClass(this, TEXT_CLUSTER_TYPE);\n }\n\n /** GType of `CairoTextCluster`, the boxed type this struct is registered under. */\n declare __type__: bigint;\n\n /** Allocates a cluster, writing the given fields and leaving the others at zero. */\n constructor(props: TextClusterConstructorProps = {}) {\n const handle = alloc(TEXT_CLUSTER_SIZE, TEXT_CLUSTER_TYPE);\n writeInitial(handle, INT, 0, props.numBytes);\n writeInitial(handle, INT, 4, props.numGlyphs);\n setHandle(this, handle);\n }\n\n /** Number of UTF-8 bytes the cluster covers. */\n get numBytes(): number {\n return INT.read(getHandle(this), 0) as number;\n }\n\n /** Number of UTF-8 bytes the cluster covers. */\n set numBytes(value: number) {\n INT.write(getHandle(this), 0, value);\n }\n\n /** Number of glyphs the cluster covers. */\n get numGlyphs(): number {\n return INT.read(getHandle(this), 4) as number;\n }\n\n /** Number of glyphs the cluster covers. */\n set numGlyphs(value: number) {\n INT.write(getHandle(this), 4, value);\n }\n}\n\nexport {\n Glyph,\n type GlyphConstructorProps,\n Rectangle,\n type RectangleConstructorProps,\n RectangleInt,\n type RectangleIntConstructorProps,\n TextCluster,\n type TextClusterConstructorProps,\n};\n"]}
package/dist/surface.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { type ExternalObject, type Handle } from "@gtkx/runtime";
2
1
  import type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from "./types.js";
2
+ import { Device } from "./device.js";
3
3
  import { type Content, type Format, type Status, SurfaceType } from "./enums.js";
4
4
  import { FontOptions } from "./font-options.js";
5
5
  /**
@@ -24,8 +24,8 @@ declare abstract class Surface {
24
24
  finish(): void;
25
25
  /** Performs any pending drawing so the backend storage is up to date. */
26
26
  flush(): void;
27
- /** Returns the raw handle of the device behind the surface, or null when it has none. */
28
- getDevice(): ExternalObject<Handle> | null;
27
+ /** Returns the managed device behind the surface, or null when it has none. */
28
+ getDevice(): Device | null;
29
29
  /** Returns the font options the surface's backend prefers for rendering text. */
30
30
  getFontOptions(): FontOptions;
31
31
  /** Returns whether the surface holds color, alpha or both. */
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,cAAc,EAEnB,KAAK,MAAM,EAQd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3G,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkJhD;;;;GAIG;AACH,uBAAe,OAAO;IAMlB,gGAAgG;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CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAEzE;IAED,6FAA6F;IAC7F,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAEnD;IAED,qEAAqE;IACrE,YAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAGxD;IAED,kDAAkD;IAClD,QAAQ,IAAI,MAAM,CAEjB;IAED,mDAAmD;IACnD,SAAS,IAAI,MAAM,CAElB;IAED,+CAA+C;IAC/C,SAAS,IAAI,MAAM,CAElB;IAED,0EAA0E;IAC1E,SAAS,IAAI,MAAM,CAElB;IAED,mGAAmG;IACnG,OAAO,IAAI,UAAU,CAmBpB;CACJ;AAED,2GAA2G;AAC3G,cAAM,gBAAiB,SAAQ,OAAO;IAClC,4EAA4E;IAC5E,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAEzE;IAED,0GAA0G;IAC1G,YAAY,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,EAGpD;IAED,sDAAsD;IACtD,UAAU,IAAI,UAAU,CAQvB;IAED,0FAA0F;IAC1F,UAAU,IAAI,aAAa,GAAG,IAAI,CAKjC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC"}
package/dist/surface.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { alloc, getHandle, registerWrapperClass, registerWrapperClassResolver, setHandle, t, wrapHandle, write, } from "@gtkx/runtime";
2
+ import { Context } from "./context.js";
3
+ import { Device } from "./device.js";
2
4
  import { SurfaceType } from "./enums.js";
3
5
  import { FontOptions } from "./font-options.js";
4
6
  import { bindCairo, cairoGType, DEVICE_T, FONT_OPTIONS_T, RECTANGLE_T, SURFACE_FULL_T, SURFACE_T, } from "./lib.js";
@@ -6,14 +8,13 @@ import { checkSurface } from "./status.js";
6
8
  const SURFACE_TYPE = cairoGType("cairo_gobject_surface_get_type");
7
9
  const RECTANGLE_SIZE = 32;
8
10
  const DOUBLE = t.fieldAt(t.float64);
9
- const UINT8 = t.fieldAt(t.uint8);
10
11
  const DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];
11
12
  const DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];
12
13
  const SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];
13
14
  const cairoSurfaceCreateSimilar = bindCairo("cairo_surface_create_similar", SIMILAR_ARGS, SURFACE_FULL_T);
14
15
  const cairoSurfaceCreateSimilarImage = bindCairo("cairo_surface_create_similar_image", SIMILAR_ARGS, SURFACE_FULL_T);
15
16
  const cairoSurfaceCreateForRectangle = bindCairo("cairo_surface_create_for_rectangle", [SURFACE_T, t.float64, t.float64, t.float64, t.float64], SURFACE_FULL_T);
16
- const cairoSurfaceWriteToPng = bindCairo("cairo_surface_write_to_png", [SURFACE_T, t.string("full")], t.int32);
17
+ const cairoSurfaceWriteToPng = bindCairo("cairo_surface_write_to_png", [SURFACE_T, t.string("borrowed")], t.int32);
17
18
  const cairoSurfaceStatus = bindCairo("cairo_surface_status", [SURFACE_T], t.int32);
18
19
  const cairoSurfaceFinish = bindCairo("cairo_surface_finish", [SURFACE_T], t.void);
19
20
  const cairoSurfaceFlush = bindCairo("cairo_surface_flush", [SURFACE_T], t.void);
@@ -33,15 +34,14 @@ const cairoSurfaceGetReferenceCount = bindCairo("cairo_surface_get_reference_cou
33
34
  const cairoSurfaceCopyPage = bindCairo("cairo_surface_copy_page", [SURFACE_T], t.void);
34
35
  const cairoSurfaceShowPage = bindCairo("cairo_surface_show_page", [SURFACE_T], t.void);
35
36
  const cairoSurfaceHasShowTextGlyphs = bindCairo("cairo_surface_has_show_text_glyphs", [SURFACE_T], t.boolean);
36
- const cairoSurfaceSupportsMimeType = bindCairo("cairo_surface_supports_mime_type", [SURFACE_T, t.string("full")], t.boolean);
37
+ const cairoSurfaceSupportsMimeType = bindCairo("cairo_surface_supports_mime_type", [SURFACE_T, t.string("borrowed")], t.boolean);
37
38
  const cairoImageSurfaceCreate = bindCairo("cairo_image_surface_create", [t.int32, t.int32, t.int32], SURFACE_FULL_T);
38
- const cairoImageSurfaceCreateFromPng = bindCairo("cairo_image_surface_create_from_png", [t.string("full")], SURFACE_FULL_T);
39
+ const cairoImageSurfaceCreateFromPng = bindCairo("cairo_image_surface_create_from_png", [t.string("borrowed")], SURFACE_FULL_T);
39
40
  const cairoImageSurfaceGetWidth = bindCairo("cairo_image_surface_get_width", [SURFACE_T], t.int32);
40
41
  const cairoImageSurfaceGetHeight = bindCairo("cairo_image_surface_get_height", [SURFACE_T], t.int32);
41
42
  const cairoImageSurfaceGetFormat = bindCairo("cairo_image_surface_get_format", [SURFACE_T], t.int32);
42
43
  const cairoImageSurfaceGetStride = bindCairo("cairo_image_surface_get_stride", [SURFACE_T], t.int32);
43
44
  const cairoRecordingSurfaceCreate = bindCairo("cairo_recording_surface_create", [t.int32, RECTANGLE_T], SURFACE_FULL_T);
44
- const cairoRecordingSurfaceCreateUnbounded = bindCairo("cairo_recording_surface_create", [t.int32, t.uint64], SURFACE_FULL_T);
45
45
  const cairoRecordingSurfaceInkExtents = bindCairo("cairo_recording_surface_ink_extents", [SURFACE_T, t.ref(t.float64), t.ref(t.float64), t.ref(t.float64), t.ref(t.float64)], t.void);
46
46
  const cairoRecordingSurfaceGetExtents = bindCairo("cairo_recording_surface_get_extents", [SURFACE_T, RECTANGLE_T], t.boolean);
47
47
  const wrapSurface = (handle) => wrapHandle(handle, Surface);
@@ -65,9 +65,10 @@ const readRectangle = (buffer) => ({
65
65
  width: DOUBLE.read(buffer, 16),
66
66
  height: DOUBLE.read(buffer, 24),
67
67
  });
68
- const createRecordingSurface = (content, extents) => (extents === undefined
69
- ? cairoRecordingSurfaceCreateUnbounded(content, 0)
70
- : cairoRecordingSurfaceCreate(content, allocRectangle(extents)));
68
+ const createRecordingSurface = (content, extents) => {
69
+ const rectangle = extents === undefined ? null : allocRectangle(extents);
70
+ return cairoRecordingSurfaceCreate(content, rectangle);
71
+ };
71
72
  const surfaceClassFor = (handle) => {
72
73
  const type = cairoSurfaceGetType(handle);
73
74
  if (type === SurfaceType.IMAGE) {
@@ -119,9 +120,10 @@ class Surface {
119
120
  flush() {
120
121
  cairoSurfaceFlush(getHandle(this));
121
122
  }
122
- /** Returns the raw handle of the device behind the surface, or null when it has none. */
123
+ /** Returns the managed device behind the surface, or null when it has none. */
123
124
  getDevice() {
124
- return cairoSurfaceGetDevice(getHandle(this));
125
+ const handle = cairoSurfaceGetDevice(getHandle(this));
126
+ return handle === null ? null : wrapHandle(handle, Device);
125
127
  }
126
128
  /** Returns the font options the surface's backend prefers for rendering text. */
127
129
  getFontOptions() {
@@ -226,17 +228,17 @@ class ImageSurface extends Surface {
226
228
  }
227
229
  /** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */
228
230
  getData() {
231
+ /* TODO: Keep this finished-state check until Cairo stops exposing released image storage.
232
+ * https://github.com/gtkx-org/gtkx/issues/730
233
+ */
234
+ Context.create(this);
229
235
  this.flush();
230
236
  const totalBytes = this.getStride() * this.getHeight();
231
237
  if (totalBytes === 0) {
232
238
  return new Uint8Array(0);
233
239
  }
234
- const getImageData = bindCairo("cairo_image_surface_get_data", [SURFACE_T], t.struct("borrowed", { size: totalBytes }));
235
- const data = getImageData(getHandle(this));
236
- if (data === null) {
237
- return new Uint8Array(0);
238
- }
239
- return Uint8Array.from({ length: totalBytes }, (_, index) => UINT8.read(data, index));
240
+ const getImageData = bindCairo("cairo_image_surface_get_data", [SURFACE_T], t.fixedArray(t.uint8, totalBytes, "borrowed", { isBytes: true }));
241
+ return getImageData(getHandle(this));
240
242
  }
241
243
  }
242
244
  /** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */
@@ -1 +1 @@
1
- {"version":3,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M,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACpF,CAAC;IAED,0FAA0F;IAC1F,UAAU;QACN,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAY,CAAC;QAEtF,OAAO,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,CAAC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n registerWrapperClass,\n registerWrapperClassResolver,\n setHandle,\n t,\n wrapHandle,\n type WrapperClassResolver,\n write,\n} from \"@gtkx/runtime\";\nimport type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from \"./types.js\";\nimport { type Content, type Format, type Status, SurfaceType } from \"./enums.js\";\nimport { FontOptions } from \"./font-options.js\";\nimport {\n bindCairo,\n type BoundFunction,\n cairoGType,\n DEVICE_T,\n FONT_OPTIONS_T,\n RECTANGLE_T,\n SURFACE_FULL_T,\n SURFACE_T,\n} from \"./lib.js\";\nimport { checkSurface } from \"./status.js\";\n\nconst SURFACE_TYPE = cairoGType(\"cairo_gobject_surface_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst DOUBLE = t.fieldAt(t.float64);\nconst UINT8 = t.fieldAt(t.uint8);\nconst DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];\nconst DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];\nconst SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];\nconst cairoSurfaceCreateSimilar = bindCairo(\"cairo_surface_create_similar\", SIMILAR_ARGS, SURFACE_FULL_T);\nconst cairoSurfaceCreateSimilarImage = bindCairo(\"cairo_surface_create_similar_image\", SIMILAR_ARGS, SURFACE_FULL_T);\n\nconst cairoSurfaceCreateForRectangle = bindCairo(\n \"cairo_surface_create_for_rectangle\",\n [SURFACE_T, t.float64, t.float64, t.float64, t.float64],\n SURFACE_FULL_T,\n);\n\nconst cairoSurfaceWriteToPng = bindCairo(\"cairo_surface_write_to_png\", [SURFACE_T, t.string(\"full\")], t.int32);\nconst cairoSurfaceStatus = bindCairo(\"cairo_surface_status\", [SURFACE_T], t.int32);\nconst cairoSurfaceFinish = bindCairo(\"cairo_surface_finish\", [SURFACE_T], t.void);\nconst cairoSurfaceFlush = bindCairo(\"cairo_surface_flush\", [SURFACE_T], t.void);\nconst cairoSurfaceGetDevice = bindCairo(\"cairo_surface_get_device\", [SURFACE_T], DEVICE_T);\nconst cairoSurfaceGetFontOptions = bindCairo(\"cairo_surface_get_font_options\", [SURFACE_T, FONT_OPTIONS_T], t.void);\nconst cairoSurfaceGetContent = bindCairo(\"cairo_surface_get_content\", [SURFACE_T], t.int32);\nconst cairoSurfaceMarkDirty = bindCairo(\"cairo_surface_mark_dirty\", [SURFACE_T], t.void);\n\nconst cairoSurfaceMarkDirtyRectangle = bindCairo(\n \"cairo_surface_mark_dirty_rectangle\",\n [SURFACE_T, t.int32, t.int32, t.int32, t.int32],\n t.void,\n);\n\nconst cairoSurfaceSetDeviceOffset = bindCairo(\"cairo_surface_set_device_offset\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceGetDeviceOffset = bindCairo(\"cairo_surface_get_device_offset\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceGetDeviceScale = bindCairo(\"cairo_surface_get_device_scale\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceSetDeviceScale = bindCairo(\"cairo_surface_set_device_scale\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceSetFallbackResolution = bindCairo(\"cairo_surface_set_fallback_resolution\", DEVICE_PAIR_ARGS, t.void);\n\nconst cairoSurfaceGetFallbackResolution = bindCairo(\n \"cairo_surface_get_fallback_resolution\",\n DEVICE_PAIR_OUT_ARGS,\n t.void,\n);\n\nconst cairoSurfaceGetType = bindCairo(\"cairo_surface_get_type\", [SURFACE_T], t.int32);\nconst cairoSurfaceGetReferenceCount = bindCairo(\"cairo_surface_get_reference_count\", [SURFACE_T], t.int32);\nconst cairoSurfaceCopyPage = bindCairo(\"cairo_surface_copy_page\", [SURFACE_T], t.void);\nconst cairoSurfaceShowPage = bindCairo(\"cairo_surface_show_page\", [SURFACE_T], t.void);\nconst cairoSurfaceHasShowTextGlyphs = bindCairo(\"cairo_surface_has_show_text_glyphs\", [SURFACE_T], t.boolean);\n\nconst cairoSurfaceSupportsMimeType = bindCairo(\n \"cairo_surface_supports_mime_type\",\n [SURFACE_T, t.string(\"full\")],\n t.boolean,\n);\n\nconst cairoImageSurfaceCreate = bindCairo(\"cairo_image_surface_create\", [t.int32, t.int32, t.int32], SURFACE_FULL_T);\n\nconst cairoImageSurfaceCreateFromPng = bindCairo(\n \"cairo_image_surface_create_from_png\",\n [t.string(\"full\")],\n SURFACE_FULL_T,\n);\n\nconst cairoImageSurfaceGetWidth = bindCairo(\"cairo_image_surface_get_width\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetHeight = bindCairo(\"cairo_image_surface_get_height\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetFormat = bindCairo(\"cairo_image_surface_get_format\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetStride = bindCairo(\"cairo_image_surface_get_stride\", [SURFACE_T], t.int32);\nconst cairoRecordingSurfaceCreate = bindCairo(\"cairo_recording_surface_create\", [t.int32, RECTANGLE_T], SURFACE_FULL_T);\n\nconst cairoRecordingSurfaceCreateUnbounded = bindCairo(\n \"cairo_recording_surface_create\",\n [t.int32, t.uint64],\n SURFACE_FULL_T,\n);\n\nconst cairoRecordingSurfaceInkExtents = bindCairo(\n \"cairo_recording_surface_ink_extents\",\n [SURFACE_T, t.ref(t.float64), t.ref(t.float64), t.ref(t.float64), t.ref(t.float64)],\n t.void,\n);\n\nconst cairoRecordingSurfaceGetExtents = bindCairo(\n \"cairo_recording_surface_get_extents\",\n [SURFACE_T, RECTANGLE_T],\n t.boolean,\n);\n\nconst wrapSurface = (handle: unknown): Surface => wrapHandle(handle as ExternalObject<Handle>, Surface);\n\nconst readPair = <T>(boundFn: BoundFunction, self: object, build: (first: number, second: number) => T): T => {\n const first = { value: 0 };\n const second = { value: 0 };\n boundFn(getHandle(self), first, second);\n\n return build(first.value, second.value);\n};\n\nconst allocRectangle = (rect: RectangleData): ExternalObject<Handle> => {\n const buffer = alloc(RECTANGLE_SIZE);\n write(buffer, t.float64, 0, rect.x);\n write(buffer, t.float64, 8, rect.y);\n write(buffer, t.float64, 16, rect.width);\n write(buffer, t.float64, 24, rect.height);\n\n return buffer;\n};\n\nconst readRectangle = (buffer: ExternalObject<Handle>): RectangleData => ({\n x: DOUBLE.read(buffer, 0) as number,\n y: DOUBLE.read(buffer, 8) as number,\n width: DOUBLE.read(buffer, 16) as number,\n height: DOUBLE.read(buffer, 24) as number,\n});\n\nconst createRecordingSurface = (content: Content, extents?: RectangleData): ExternalObject<Handle> =>\n (extents === undefined\n ? cairoRecordingSurfaceCreateUnbounded(content, 0)\n : cairoRecordingSurfaceCreate(content, allocRectangle(extents))) as ExternalObject<Handle>;\n\nconst surfaceClassFor: WrapperClassResolver = (handle) => {\n const type = cairoSurfaceGetType(handle) as SurfaceType;\n\n if (type === SurfaceType.IMAGE) {\n return ImageSurface;\n }\n\n if (type === SurfaceType.RECORDING) {\n return RecordingSurface;\n }\n\n return Surface;\n};\n\n/**\n * A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`\n * statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their\n * backend reports (`instanceof ImageSurface` for an image surface).\n */\nabstract class Surface {\n static {\n registerWrapperClass(this, SURFACE_TYPE);\n registerWrapperClassResolver(this, surfaceClassFor);\n }\n\n /** Creates a surface of the given `content` and size as compatible as possible with `other`. */\n static createSimilar(other: Surface, content: Content, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateSimilar(getHandle(other), content, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** Creates an image surface of the given `format` and size as compatible as possible with `other`. */\n static createSimilarImage(other: Surface, format: Format, width: number, height: number): ImageSurface {\n const handle =\n cairoSurfaceCreateSimilarImage(getHandle(other), format, width, height) as ExternalObject<Handle>;\n\n return wrapHandle(checkSurface(handle), ImageSurface);\n }\n\n /** Creates a surface that draws onto the given rectangle of `target`. */\n static createForRectangle(target: Surface, x: number, y: number, width: number, height: number): Surface {\n const handle =\n cairoSurfaceCreateForRectangle(getHandle(target), x, y, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** GType of `CairoSurface`, the boxed type this class is registered under. */\n declare __type__: bigint;\n\n /** Writes the surface to a PNG file at `filename` and returns the resulting status. */\n writeToPng(filename: string): Status {\n return cairoSurfaceWriteToPng(getHandle(this), filename) as Status;\n }\n\n /** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */\n status(): Status {\n return cairoSurfaceStatus(getHandle(this)) as Status;\n }\n\n /** Finishes the surface and drops its backend resources; further drawing reports an error. */\n finish(): void {\n cairoSurfaceFinish(getHandle(this));\n }\n\n /** Performs any pending drawing so the backend storage is up to date. */\n flush(): void {\n cairoSurfaceFlush(getHandle(this));\n }\n\n /** Returns the raw handle of the device behind the surface, or null when it has none. */\n getDevice(): ExternalObject<Handle> | null {\n return cairoSurfaceGetDevice(getHandle(this)) as ExternalObject<Handle> | null;\n }\n\n /** Returns the font options the surface's backend prefers for rendering text. */\n getFontOptions(): FontOptions {\n const options = FontOptions.create();\n cairoSurfaceGetFontOptions(getHandle(this), getHandle(options));\n\n return options;\n }\n\n /** Returns whether the surface holds color, alpha or both. */\n getContent(): Content {\n return cairoSurfaceGetContent(getHandle(this)) as Content;\n }\n\n /** Tells cairo the surface's storage was modified outside of cairo. */\n markDirty(): void {\n cairoSurfaceMarkDirty(getHandle(this));\n }\n\n /** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */\n markDirtyRectangle(x: number, y: number, width: number, height: number): void {\n cairoSurfaceMarkDirtyRectangle(getHandle(this), x, y, width, height);\n }\n\n /** Sets the offset added to device coordinates when drawing onto the surface. */\n setDeviceOffset(xOffset: number, yOffset: number): void {\n cairoSurfaceSetDeviceOffset(getHandle(this), xOffset, yOffset);\n }\n\n /** Returns the offset added to device coordinates when drawing onto the surface. */\n getDeviceOffset(): DeviceOffset {\n return readPair(cairoSurfaceGetDeviceOffset, this, (xOffset, yOffset) => ({ xOffset, yOffset }));\n }\n\n /** Returns the scale applied between user and device units. */\n getDeviceScale(): DeviceScale {\n return readPair(cairoSurfaceGetDeviceScale, this, (xScale, yScale) => ({ xScale, yScale }));\n }\n\n /** Sets the scale applied between user and device units. */\n setDeviceScale(xScale: number, yScale: number): void {\n cairoSurfaceSetDeviceScale(getHandle(this), xScale, yScale);\n }\n\n /** Sets the resolution used when vector content has to be rasterized. */\n setFallbackResolution(xPixelsPerInch: number, yPixelsPerInch: number): void {\n cairoSurfaceSetFallbackResolution(getHandle(this), xPixelsPerInch, yPixelsPerInch);\n }\n\n /** Returns the resolution used when vector content has to be rasterized. */\n getFallbackResolution(): FallbackResolution {\n return readPair(cairoSurfaceGetFallbackResolution, this, (xPixelsPerInch, yPixelsPerInch) => ({\n xPixelsPerInch,\n yPixelsPerInch,\n }));\n }\n\n /** Returns the backend type of the surface. */\n getType(): SurfaceType {\n return cairoSurfaceGetType(getHandle(this)) as SurfaceType;\n }\n\n /** Returns the reference count of the surface. */\n getReferenceCount(): number {\n return cairoSurfaceGetReferenceCount(getHandle(this)) as number;\n }\n\n /** Emits the current page and keeps its content for the next one, on paged backends. */\n copyPage(): void {\n cairoSurfaceCopyPage(getHandle(this));\n }\n\n /** Emits the current page and starts a blank one, on paged backends. */\n showPage(): void {\n cairoSurfaceShowPage(getHandle(this));\n }\n\n /** Returns whether the surface supports `Context.showTextGlyphs` natively. */\n hasShowTextGlyphs(): boolean {\n return cairoSurfaceHasShowTextGlyphs(getHandle(this)) as boolean;\n }\n\n /** Returns whether the surface can embed data of the given MIME type. */\n supportsMimeType(mimeType: string): boolean {\n return cairoSurfaceSupportsMimeType(getHandle(this), mimeType) as boolean;\n }\n}\n\n/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */\nclass ImageSurface extends Surface {\n /** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */\n static create(format: Format, width: number, height: number): ImageSurface {\n return wrapHandle(\n checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>),\n this,\n );\n }\n\n /** Loads a PNG file into a new image surface; throws when the file is missing or invalid. */\n static createFromPng(filename: string): ImageSurface {\n return wrapHandle(checkSurface(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>), this);\n }\n\n /** Creates an image surface of the given pixel `format` and size. */\n constructor(format: Format, width: number, height: number) {\n super();\n setHandle(this, checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>));\n }\n\n /** Returns the width of the surface in pixels. */\n getWidth(): number {\n return cairoImageSurfaceGetWidth(getHandle(this)) as number;\n }\n\n /** Returns the height of the surface in pixels. */\n getHeight(): number {\n return cairoImageSurfaceGetHeight(getHandle(this)) as number;\n }\n\n /** Returns the pixel format of the surface. */\n getFormat(): Format {\n return cairoImageSurfaceGetFormat(getHandle(this)) as Format;\n }\n\n /** Returns the number of bytes between the starts of consecutive rows. */\n getStride(): number {\n return cairoImageSurfaceGetStride(getHandle(this)) as number;\n }\n\n /** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */\n getData(): Uint8Array {\n this.flush();\n const totalBytes = this.getStride() * this.getHeight();\n\n if (totalBytes === 0) {\n return new Uint8Array(0);\n }\n\n const getImageData = bindCairo(\n \"cairo_image_surface_get_data\",\n [SURFACE_T],\n t.struct(\"borrowed\", { size: totalBytes }),\n );\n\n const data = getImageData(getHandle(this)) as ExternalObject<Handle> | null;\n\n if (data === null) {\n return new Uint8Array(0);\n }\n\n return Uint8Array.from({ length: totalBytes }, (_, index) => UINT8.read(data, index) as number);\n }\n}\n\n/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */\nclass RecordingSurface extends Surface {\n /** Creates a recording surface, the same as `new RecordingSurface(...)`. */\n static create(content: Content, extents?: RectangleData): RecordingSurface {\n return new RecordingSurface(content, extents);\n }\n\n /** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */\n constructor(content: Content, extents?: RectangleData) {\n super();\n setHandle(this, checkSurface(createRecordingSurface(content, extents)));\n }\n\n /** Returns the area that has been drawn on so far. */\n inkExtents(): InkExtents {\n const x0 = { value: 0 };\n const y0 = { value: 0 };\n const width = { value: 0 };\n const height = { value: 0 };\n cairoRecordingSurfaceInkExtents(getHandle(this), x0, y0, width, height);\n\n return { x0: x0.value, y0: y0.value, width: width.value, height: height.value };\n }\n\n /** Returns the extents the surface was created with, or null for an unbounded surface. */\n getExtents(): RectangleData | null {\n const buffer = alloc(RECTANGLE_SIZE);\n const isBounded = cairoRecordingSurfaceGetExtents(getHandle(this), buffer) as boolean;\n\n return isBounded ? readRectangle(buffer) : null;\n }\n}\n\nexport { ImageSurface, RecordingSurface, Surface };\n"]}
1
+ {"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,SAAS,EAET,oBAAoB,EACpB,4BAA4B,EAC5B,SAAS,EACT,CAAC,EACD,UAAU,EAEV,KAAK,GACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA0C,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAC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0G;IAC1G,YAAY,OAAgB,EAAE,OAAuB;QACjD,KAAK,EAAE,CAAC;QACR,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,sDAAsD;IACtD,UAAU;QACN,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC5B,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAExE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACpF,CAAC;IAED,0FAA0F;IAC1F,UAAU;QACN,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,+BAA+B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAY,CAAC;QAEtF,OAAO,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,CAAC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import {\n alloc,\n type ExternalObject,\n getHandle,\n type Handle,\n registerWrapperClass,\n registerWrapperClassResolver,\n setHandle,\n t,\n wrapHandle,\n type WrapperClassResolver,\n write,\n} from \"@gtkx/runtime\";\nimport type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from \"./types.js\";\nimport { Context } from \"./context.js\";\nimport { Device } from \"./device.js\";\nimport { type Content, type Format, type Status, SurfaceType } from \"./enums.js\";\nimport { FontOptions } from \"./font-options.js\";\nimport {\n bindCairo,\n type BoundFunction,\n cairoGType,\n DEVICE_T,\n FONT_OPTIONS_T,\n RECTANGLE_T,\n SURFACE_FULL_T,\n SURFACE_T,\n} from \"./lib.js\";\nimport { checkSurface } from \"./status.js\";\n\nconst SURFACE_TYPE = cairoGType(\"cairo_gobject_surface_get_type\");\nconst RECTANGLE_SIZE = 32;\nconst DOUBLE = t.fieldAt(t.float64);\nconst DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];\nconst DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];\nconst SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];\nconst cairoSurfaceCreateSimilar = bindCairo(\"cairo_surface_create_similar\", SIMILAR_ARGS, SURFACE_FULL_T);\nconst cairoSurfaceCreateSimilarImage = bindCairo(\"cairo_surface_create_similar_image\", SIMILAR_ARGS, SURFACE_FULL_T);\n\nconst cairoSurfaceCreateForRectangle = bindCairo(\n \"cairo_surface_create_for_rectangle\",\n [SURFACE_T, t.float64, t.float64, t.float64, t.float64],\n SURFACE_FULL_T,\n);\n\nconst cairoSurfaceWriteToPng = bindCairo(\"cairo_surface_write_to_png\", [SURFACE_T, t.string(\"borrowed\")], t.int32);\nconst cairoSurfaceStatus = bindCairo(\"cairo_surface_status\", [SURFACE_T], t.int32);\nconst cairoSurfaceFinish = bindCairo(\"cairo_surface_finish\", [SURFACE_T], t.void);\nconst cairoSurfaceFlush = bindCairo(\"cairo_surface_flush\", [SURFACE_T], t.void);\nconst cairoSurfaceGetDevice = bindCairo(\"cairo_surface_get_device\", [SURFACE_T], DEVICE_T);\nconst cairoSurfaceGetFontOptions = bindCairo(\"cairo_surface_get_font_options\", [SURFACE_T, FONT_OPTIONS_T], t.void);\nconst cairoSurfaceGetContent = bindCairo(\"cairo_surface_get_content\", [SURFACE_T], t.int32);\nconst cairoSurfaceMarkDirty = bindCairo(\"cairo_surface_mark_dirty\", [SURFACE_T], t.void);\n\nconst cairoSurfaceMarkDirtyRectangle = bindCairo(\n \"cairo_surface_mark_dirty_rectangle\",\n [SURFACE_T, t.int32, t.int32, t.int32, t.int32],\n t.void,\n);\n\nconst cairoSurfaceSetDeviceOffset = bindCairo(\"cairo_surface_set_device_offset\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceGetDeviceOffset = bindCairo(\"cairo_surface_get_device_offset\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceGetDeviceScale = bindCairo(\"cairo_surface_get_device_scale\", DEVICE_PAIR_OUT_ARGS, t.void);\nconst cairoSurfaceSetDeviceScale = bindCairo(\"cairo_surface_set_device_scale\", DEVICE_PAIR_ARGS, t.void);\nconst cairoSurfaceSetFallbackResolution = bindCairo(\"cairo_surface_set_fallback_resolution\", DEVICE_PAIR_ARGS, t.void);\n\nconst cairoSurfaceGetFallbackResolution = bindCairo(\n \"cairo_surface_get_fallback_resolution\",\n DEVICE_PAIR_OUT_ARGS,\n t.void,\n);\n\nconst cairoSurfaceGetType = bindCairo(\"cairo_surface_get_type\", [SURFACE_T], t.int32);\nconst cairoSurfaceGetReferenceCount = bindCairo(\"cairo_surface_get_reference_count\", [SURFACE_T], t.int32);\nconst cairoSurfaceCopyPage = bindCairo(\"cairo_surface_copy_page\", [SURFACE_T], t.void);\nconst cairoSurfaceShowPage = bindCairo(\"cairo_surface_show_page\", [SURFACE_T], t.void);\nconst cairoSurfaceHasShowTextGlyphs = bindCairo(\"cairo_surface_has_show_text_glyphs\", [SURFACE_T], t.boolean);\n\nconst cairoSurfaceSupportsMimeType = bindCairo(\n \"cairo_surface_supports_mime_type\",\n [SURFACE_T, t.string(\"borrowed\")],\n t.boolean,\n);\n\nconst cairoImageSurfaceCreate = bindCairo(\"cairo_image_surface_create\", [t.int32, t.int32, t.int32], SURFACE_FULL_T);\n\nconst cairoImageSurfaceCreateFromPng = bindCairo(\n \"cairo_image_surface_create_from_png\",\n [t.string(\"borrowed\")],\n SURFACE_FULL_T,\n);\n\nconst cairoImageSurfaceGetWidth = bindCairo(\"cairo_image_surface_get_width\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetHeight = bindCairo(\"cairo_image_surface_get_height\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetFormat = bindCairo(\"cairo_image_surface_get_format\", [SURFACE_T], t.int32);\nconst cairoImageSurfaceGetStride = bindCairo(\"cairo_image_surface_get_stride\", [SURFACE_T], t.int32);\nconst cairoRecordingSurfaceCreate = bindCairo(\"cairo_recording_surface_create\", [t.int32, RECTANGLE_T], SURFACE_FULL_T);\n\nconst cairoRecordingSurfaceInkExtents = bindCairo(\n \"cairo_recording_surface_ink_extents\",\n [SURFACE_T, t.ref(t.float64), t.ref(t.float64), t.ref(t.float64), t.ref(t.float64)],\n t.void,\n);\n\nconst cairoRecordingSurfaceGetExtents = bindCairo(\n \"cairo_recording_surface_get_extents\",\n [SURFACE_T, RECTANGLE_T],\n t.boolean,\n);\n\nconst wrapSurface = (handle: unknown): Surface => wrapHandle(handle as ExternalObject<Handle>, Surface);\n\nconst readPair = <T>(boundFn: BoundFunction, self: object, build: (first: number, second: number) => T): T => {\n const first = { value: 0 };\n const second = { value: 0 };\n boundFn(getHandle(self), first, second);\n\n return build(first.value, second.value);\n};\n\nconst allocRectangle = (rect: RectangleData): ExternalObject<Handle> => {\n const buffer = alloc(RECTANGLE_SIZE);\n write(buffer, t.float64, 0, rect.x);\n write(buffer, t.float64, 8, rect.y);\n write(buffer, t.float64, 16, rect.width);\n write(buffer, t.float64, 24, rect.height);\n\n return buffer;\n};\n\nconst readRectangle = (buffer: ExternalObject<Handle>): RectangleData => ({\n x: DOUBLE.read(buffer, 0) as number,\n y: DOUBLE.read(buffer, 8) as number,\n width: DOUBLE.read(buffer, 16) as number,\n height: DOUBLE.read(buffer, 24) as number,\n});\n\nconst createRecordingSurface = (content: Content, extents?: RectangleData): ExternalObject<Handle> => {\n const rectangle = extents === undefined ? null : allocRectangle(extents);\n\n return cairoRecordingSurfaceCreate(content, rectangle) as ExternalObject<Handle>;\n};\n\nconst surfaceClassFor: WrapperClassResolver = (handle) => {\n const type = cairoSurfaceGetType(handle) as SurfaceType;\n\n if (type === SurfaceType.IMAGE) {\n return ImageSurface;\n }\n\n if (type === SurfaceType.RECORDING) {\n return RecordingSurface;\n }\n\n return Surface;\n};\n\n/**\n * A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`\n * statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their\n * backend reports (`instanceof ImageSurface` for an image surface).\n */\nabstract class Surface {\n static {\n registerWrapperClass(this, SURFACE_TYPE);\n registerWrapperClassResolver(this, surfaceClassFor);\n }\n\n /** Creates a surface of the given `content` and size as compatible as possible with `other`. */\n static createSimilar(other: Surface, content: Content, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateSimilar(getHandle(other), content, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** Creates an image surface of the given `format` and size as compatible as possible with `other`. */\n static createSimilarImage(other: Surface, format: Format, width: number, height: number): ImageSurface {\n const handle = cairoSurfaceCreateSimilarImage(\n getHandle(other),\n format,\n width,\n height,\n ) as ExternalObject<Handle>;\n\n return wrapHandle(checkSurface(handle), ImageSurface);\n }\n\n /** Creates a surface that draws onto the given rectangle of `target`. */\n static createForRectangle(target: Surface, x: number, y: number, width: number, height: number): Surface {\n const handle = cairoSurfaceCreateForRectangle(getHandle(target), x, y, width, height) as ExternalObject<Handle>;\n\n return wrapSurface(checkSurface(handle));\n }\n\n /** GType of `CairoSurface`, the boxed type this class is registered under. */\n declare __type__: bigint;\n\n /** Writes the surface to a PNG file at `filename` and returns the resulting status. */\n writeToPng(filename: string): Status {\n return cairoSurfaceWriteToPng(getHandle(this), filename) as Status;\n }\n\n /** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */\n status(): Status {\n return cairoSurfaceStatus(getHandle(this)) as Status;\n }\n\n /** Finishes the surface and drops its backend resources; further drawing reports an error. */\n finish(): void {\n cairoSurfaceFinish(getHandle(this));\n }\n\n /** Performs any pending drawing so the backend storage is up to date. */\n flush(): void {\n cairoSurfaceFlush(getHandle(this));\n }\n\n /** Returns the managed device behind the surface, or null when it has none. */\n getDevice(): Device | null {\n const handle = cairoSurfaceGetDevice(getHandle(this)) as ExternalObject<Handle> | null;\n\n return handle === null ? null : wrapHandle(handle, Device);\n }\n\n /** Returns the font options the surface's backend prefers for rendering text. */\n getFontOptions(): FontOptions {\n const options = FontOptions.create();\n cairoSurfaceGetFontOptions(getHandle(this), getHandle(options));\n\n return options;\n }\n\n /** Returns whether the surface holds color, alpha or both. */\n getContent(): Content {\n return cairoSurfaceGetContent(getHandle(this)) as Content;\n }\n\n /** Tells cairo the surface's storage was modified outside of cairo. */\n markDirty(): void {\n cairoSurfaceMarkDirty(getHandle(this));\n }\n\n /** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */\n markDirtyRectangle(x: number, y: number, width: number, height: number): void {\n cairoSurfaceMarkDirtyRectangle(getHandle(this), x, y, width, height);\n }\n\n /** Sets the offset added to device coordinates when drawing onto the surface. */\n setDeviceOffset(xOffset: number, yOffset: number): void {\n cairoSurfaceSetDeviceOffset(getHandle(this), xOffset, yOffset);\n }\n\n /** Returns the offset added to device coordinates when drawing onto the surface. */\n getDeviceOffset(): DeviceOffset {\n return readPair(cairoSurfaceGetDeviceOffset, this, (xOffset, yOffset) => ({ xOffset, yOffset }));\n }\n\n /** Returns the scale applied between user and device units. */\n getDeviceScale(): DeviceScale {\n return readPair(cairoSurfaceGetDeviceScale, this, (xScale, yScale) => ({ xScale, yScale }));\n }\n\n /** Sets the scale applied between user and device units. */\n setDeviceScale(xScale: number, yScale: number): void {\n cairoSurfaceSetDeviceScale(getHandle(this), xScale, yScale);\n }\n\n /** Sets the resolution used when vector content has to be rasterized. */\n setFallbackResolution(xPixelsPerInch: number, yPixelsPerInch: number): void {\n cairoSurfaceSetFallbackResolution(getHandle(this), xPixelsPerInch, yPixelsPerInch);\n }\n\n /** Returns the resolution used when vector content has to be rasterized. */\n getFallbackResolution(): FallbackResolution {\n return readPair(cairoSurfaceGetFallbackResolution, this, (xPixelsPerInch, yPixelsPerInch) => ({\n xPixelsPerInch,\n yPixelsPerInch,\n }));\n }\n\n /** Returns the backend type of the surface. */\n getType(): SurfaceType {\n return cairoSurfaceGetType(getHandle(this)) as SurfaceType;\n }\n\n /** Returns the reference count of the surface. */\n getReferenceCount(): number {\n return cairoSurfaceGetReferenceCount(getHandle(this)) as number;\n }\n\n /** Emits the current page and keeps its content for the next one, on paged backends. */\n copyPage(): void {\n cairoSurfaceCopyPage(getHandle(this));\n }\n\n /** Emits the current page and starts a blank one, on paged backends. */\n showPage(): void {\n cairoSurfaceShowPage(getHandle(this));\n }\n\n /** Returns whether the surface supports `Context.showTextGlyphs` natively. */\n hasShowTextGlyphs(): boolean {\n return cairoSurfaceHasShowTextGlyphs(getHandle(this)) as boolean;\n }\n\n /** Returns whether the surface can embed data of the given MIME type. */\n supportsMimeType(mimeType: string): boolean {\n return cairoSurfaceSupportsMimeType(getHandle(this), mimeType) as boolean;\n }\n}\n\n/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */\nclass ImageSurface extends Surface {\n /** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */\n static create(format: Format, width: number, height: number): ImageSurface {\n return wrapHandle(checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>), this);\n }\n\n /** Loads a PNG file into a new image surface; throws when the file is missing or invalid. */\n static createFromPng(filename: string): ImageSurface {\n return wrapHandle(checkSurface(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>), this);\n }\n\n /** Creates an image surface of the given pixel `format` and size. */\n constructor(format: Format, width: number, height: number) {\n super();\n setHandle(this, checkSurface(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>));\n }\n\n /** Returns the width of the surface in pixels. */\n getWidth(): number {\n return cairoImageSurfaceGetWidth(getHandle(this)) as number;\n }\n\n /** Returns the height of the surface in pixels. */\n getHeight(): number {\n return cairoImageSurfaceGetHeight(getHandle(this)) as number;\n }\n\n /** Returns the pixel format of the surface. */\n getFormat(): Format {\n return cairoImageSurfaceGetFormat(getHandle(this)) as Format;\n }\n\n /** Returns the number of bytes between the starts of consecutive rows. */\n getStride(): number {\n return cairoImageSurfaceGetStride(getHandle(this)) as number;\n }\n\n /** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */\n getData(): Uint8Array {\n /* TODO: Keep this finished-state check until Cairo stops exposing released image storage.\n * https://github.com/gtkx-org/gtkx/issues/730\n */\n Context.create(this);\n this.flush();\n const totalBytes = this.getStride() * this.getHeight();\n\n if (totalBytes === 0) {\n return new Uint8Array(0);\n }\n\n const getImageData = bindCairo(\n \"cairo_image_surface_get_data\",\n [SURFACE_T],\n t.fixedArray(t.uint8, totalBytes, \"borrowed\", { isBytes: true }),\n );\n\n return getImageData(getHandle(this)) as Uint8Array;\n }\n}\n\n/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */\nclass RecordingSurface extends Surface {\n /** Creates a recording surface, the same as `new RecordingSurface(...)`. */\n static create(content: Content, extents?: RectangleData): RecordingSurface {\n return new RecordingSurface(content, extents);\n }\n\n /** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */\n constructor(content: Content, extents?: RectangleData) {\n super();\n setHandle(this, checkSurface(createRecordingSurface(content, extents)));\n }\n\n /** Returns the area that has been drawn on so far. */\n inkExtents(): InkExtents {\n const x0 = { value: 0 };\n const y0 = { value: 0 };\n const width = { value: 0 };\n const height = { value: 0 };\n cairoRecordingSurfaceInkExtents(getHandle(this), x0, y0, width, height);\n\n return { x0: x0.value, y0: y0.value, width: width.value, height: height.value };\n }\n\n /** Returns the extents the surface was created with, or null for an unbounded surface. */\n getExtents(): RectangleData | null {\n const buffer = alloc(RECTANGLE_SIZE);\n const isBounded = cairoRecordingSurfaceGetExtents(getHandle(this), buffer) as boolean;\n\n return isBounded ? readRectangle(buffer) : null;\n }\n}\n\nexport { ImageSurface, RecordingSurface, Surface };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,cAAc,EAAE,KAAK,MAAM,EAAK,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUzF,QAAA,MAAM,gBAAgB,GAAI,QAAQ,UAAU,EAAE,KAAG,cAAc,CAAC,MAAM,CAYrE,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAU,gBAAgB,EAAE,KAAG,cAAc,CAAC,MAAM,CAW/E,CAAC;AAEF,QAAA,MAAM,gBAAgB,QAAO,cAAc,CAAC,MAAM,CAA6B,CAAC;AAChF,QAAA,MAAM,gBAAgB,QAAO,cAAc,CAAC,MAAM,CAA6B,CAAC;AAEhF,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,CAAC,MAAM,CAAC,KAAG,WAOxD,CAAC;AAEH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,CAAC,MAAM,CAAC,KAAG,WAMxD,CAAC;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,cAAc,EAAE,KAAK,MAAM,EAAK,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUzF,QAAA,MAAM,gBAAgB,WAAY,UAAU,EAAE,KAAG,cAAc,CAAC,MAAM,CAYrE,CAAC;AAEF,QAAA,MAAM,kBAAkB,aAAc,gBAAgB,EAAE,KAAG,cAAc,CAAC,MAAM,CAW/E,CAAC;AAEF,QAAA,MAAM,gBAAgB,QAAO,cAAc,CAAC,MAAM,CAA6B,CAAC;AAChF,QAAA,MAAM,gBAAgB,QAAO,cAAc,CAAC,MAAM,CAA6B,CAAC;AAEhF,QAAA,MAAM,eAAe,WAAY,cAAc,CAAC,MAAM,CAAC,KAAG,WAOxD,CAAC;AAEH,QAAA,MAAM,eAAe,WAAY,cAAc,CAAC,MAAM,CAAC,KAAG,WAMxD,CAAC;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAOzC,yGAAyG;AACzG,QAAA,MAAM,OAAO,QAAO,MAAkC,CAAC;AACvD,sFAAsF;AACtF,QAAA,MAAM,aAAa,QAAO,MAAwC,CAAC;AACnE,6DAA6D;AAC7D,QAAA,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAA+C,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAOzC,yGAAyG;AACzG,QAAA,MAAM,OAAO,QAAO,MAAkC,CAAC;AACvD,sFAAsF;AACtF,QAAA,MAAM,aAAa,QAAO,MAAwC,CAAC;AACnE,6DAA6D;AAC7D,QAAA,MAAM,cAAc,WAAY,MAAM,KAAG,MAA+C,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gtkx/cairo",
3
- "version": "2.0.0-beta.10",
4
- "description": "Cairo drawing for GTKX GNOME apps: contexts, surfaces, patterns, fonts.",
3
+ "version": "2.0.0-beta.12",
4
+ "description": "Cairo drawing for GTKX applications.",
5
5
  "keywords": [
6
6
  "gtkx",
7
7
  "gtk",
@@ -40,28 +40,17 @@
40
40
  "dist",
41
41
  "src"
42
42
  ],
43
- "nx": {
44
- "targets": {
45
- "lint": {
46
- "options": {
47
- "cwd": ".",
48
- "command": "eslint {projectRoot}"
49
- }
50
- }
51
- }
52
- },
53
43
  "engines": {
54
44
  "node": ">=26.7.0"
55
45
  },
56
46
  "dependencies": {
57
- "@gtkx/runtime": "2.0.0-beta.10"
47
+ "@gtkx/runtime": "2.0.0-beta.12"
58
48
  },
59
49
  "devDependencies": {
60
- "@gtkx/vitest": "2.0.0-beta.10",
61
- "@types/node": "^26.5.0",
62
- "fast-xml-parser": "^5.11.1"
50
+ "@gtkx/vitest": "2.0.0-beta.12",
51
+ "@types/node": "^26.5.1"
63
52
  },
64
53
  "scripts": {
65
- "release": "tsx ../../scripts/release-package.ts"
54
+ "release": "node ../../scripts/release/publish-package.ts"
66
55
  }
67
56
  }
package/src/context.ts CHANGED
@@ -138,14 +138,14 @@ const cairoGetOperator = bindCairo("cairo_get_operator", [CONTEXT_T], t.int32);
138
138
 
139
139
  const cairoSelectFontFace = bindCairo(
140
140
  "cairo_select_font_face",
141
- [CONTEXT_T, t.string("full"), t.int32, t.int32],
141
+ [CONTEXT_T, t.string("borrowed"), t.int32, t.int32],
142
142
  t.void,
143
143
  );
144
144
 
145
145
  const cairoSetFontSize = bindCairo("cairo_set_font_size", [CONTEXT_T, t.float64], t.void);
146
- const cairoShowText = bindCairo("cairo_show_text", [CONTEXT_T, t.string("full")], t.void);
147
- const cairoTextPath = bindCairo("cairo_text_path", [CONTEXT_T, t.string("full")], t.void);
148
- const cairoTextExtents = bindCairo("cairo_text_extents", [CONTEXT_T, t.string("full"), TEXT_EXTENTS_T], t.void);
146
+ const cairoShowText = bindCairo("cairo_show_text", [CONTEXT_T, t.string("borrowed")], t.void);
147
+ const cairoTextPath = bindCairo("cairo_text_path", [CONTEXT_T, t.string("borrowed")], t.void);
148
+ const cairoTextExtents = bindCairo("cairo_text_extents", [CONTEXT_T, t.string("borrowed"), TEXT_EXTENTS_T], t.void);
149
149
  const cairoFontExtents = bindCairo("cairo_font_extents", [CONTEXT_T, FONT_EXTENTS_T], t.void);
150
150
  const cairoSetFontOptions = bindCairo("cairo_set_font_options", [CONTEXT_T, FONT_OPTIONS_T], t.void);
151
151
  const cairoGetFontOptions = bindCairo("cairo_get_font_options", [CONTEXT_T, FONT_OPTIONS_T], t.void);
@@ -200,12 +200,12 @@ const cairoGlyphPath = bindCairo("cairo_glyph_path", [CONTEXT_T, GLYPH_T, t.int3
200
200
  const cairoGlyphExtents = bindCairo("cairo_glyph_extents", [CONTEXT_T, GLYPH_T, t.int32, TEXT_EXTENTS_T], t.void);
201
201
  const cairoCopyPath = bindCairo("cairo_copy_path", [CONTEXT_T], PATH_T);
202
202
  const cairoCopyPathFlat = bindCairo("cairo_copy_path_flat", [CONTEXT_T], PATH_T);
203
- const cairoTagBegin = bindCairo("cairo_tag_begin", [CONTEXT_T, t.string("full"), t.string("full")], t.void);
204
- const cairoTagEnd = bindCairo("cairo_tag_end", [CONTEXT_T, t.string("full")], t.void);
203
+ const cairoTagBegin = bindCairo("cairo_tag_begin", [CONTEXT_T, t.string("borrowed"), t.string("borrowed")], t.void);
204
+ const cairoTagEnd = bindCairo("cairo_tag_end", [CONTEXT_T, t.string("borrowed")], t.void);
205
205
 
206
206
  const cairoShowTextGlyphs = bindCairo(
207
207
  "cairo_show_text_glyphs",
208
- [CONTEXT_T, t.string("full"), t.int32, GLYPH_T, t.int32, TEXT_CLUSTER_T, t.int32, t.int32],
208
+ [CONTEXT_T, t.string("borrowed"), t.int32, GLYPH_T, t.int32, TEXT_CLUSTER_T, t.int32, t.int32],
209
209
  t.void,
210
210
  );
211
211
 
@@ -253,6 +253,7 @@ const readRectangle = (rects: ExternalObject<Handle>, base: number): RectangleDa
253
253
  });
254
254
 
255
255
  const readRectangleList = (listHandle: ExternalObject<Handle>): RectangleData[] => {
256
+ checkStatus(read(listHandle, t.int32, 0) as Status, "clip rectangle list");
256
257
  const count = RECTANGLE_LIST_COUNT.read(listHandle) as number;
257
258
 
258
259
  if (count === 0) {
package/src/enums.ts CHANGED
@@ -13,7 +13,7 @@ type LineCap = (typeof LineCap)[keyof typeof LineCap];
13
13
  /** One of the `LineJoin` styles for the corners of a stroked path. */
14
14
  type LineJoin = (typeof LineJoin)[keyof typeof LineJoin];
15
15
  /** One of the `TextClusterFlags` values describing a cluster mapping. */
16
- type TextClusterFlags = (typeof TextClusterFlags)[keyof typeof TextClusterFlags];
16
+ type TextClusterFlags = number;
17
17
  /** One of the `FontSlant` values for a toy font face. */
18
18
  type FontSlant = (typeof FontSlant)[keyof typeof FontSlant];
19
19
  /** One of the `FontWeight` values for a toy font face. */
@@ -126,6 +126,12 @@ const Status = {
126
126
  DEVICE_FINISHED: 37,
127
127
  /** A JBIG2 global data stream was attached without its global identifier. */
128
128
  JBIG2_GLOBAL_MISSING: 38,
129
+ PNG_ERROR: 39,
130
+ FREETYPE_ERROR: 40,
131
+ WIN32_GDI_ERROR: 41,
132
+ TAG_ERROR: 42,
133
+ DWRITE_ERROR: 43,
134
+ SVG_FONT_ERROR: 44,
129
135
  } as const;
130
136
 
131
137
  /**
@@ -359,6 +365,7 @@ const FontType = {
359
365
  QUARTZ: 3,
360
366
  /** A font created with the user font API. */
361
367
  USER: 4,
368
+ DWRITE: 5,
362
369
  } as const;
363
370
 
364
371
  /**
@@ -477,6 +484,8 @@ const Format = {
477
484
  RGB16_565: 4,
478
485
  /** 30 bits per pixel with 10 bits per color channel. */
479
486
  RGB30: 5,
487
+ RGB96F: 6,
488
+ RGBA128F: 7,
480
489
  } as const;
481
490
 
482
491
  /**
package/src/font-face.ts CHANGED
@@ -12,7 +12,7 @@ import { type FontSlant, FontType, type FontWeight, type Status } from "./enums.
12
12
  import { bindCairo, cairoGType, FONT_FACE_FULL_T, FONT_FACE_T } from "./lib.js";
13
13
 
14
14
  /** One of the `FtSynthesize` styles a FreeType font face synthesizes. */
15
- type FtSynthesize = (typeof FtSynthesize)[keyof typeof FtSynthesize];
15
+ type FtSynthesize = number;
16
16
 
17
17
  const FONT_FACE_TYPE = cairoGType("cairo_gobject_font_face_get_type");
18
18
  const cairoFontFaceStatus = bindCairo("cairo_font_face_status", [FONT_FACE_T], t.int32);
@@ -26,15 +26,11 @@ const cairoToyFontFaceGetFamily = bindCairo("cairo_toy_font_face_get_family", [F
26
26
 
27
27
  const cairoToyFontFaceCreate = bindCairo(
28
28
  "cairo_toy_font_face_create",
29
- [t.string("full"), t.int32, t.int32],
29
+ [t.string("borrowed"), t.int32, t.int32],
30
30
  FONT_FACE_FULL_T,
31
31
  );
32
32
 
33
- const cairoFtFontFaceUnsetSynthesize = bindCairo(
34
- "cairo_ft_font_face_unset_synthesize",
35
- [FONT_FACE_T, t.int32],
36
- t.void,
37
- );
33
+ const cairoFtFontFaceUnsetSynthesize = bindCairo("cairo_ft_font_face_unset_synthesize", [FONT_FACE_T, t.int32], t.void);
38
34
 
39
35
  /**
40
36
  * Styles a FreeType font face synthesizes when the font itself lacks them.
@@ -23,7 +23,7 @@ const cairoFontOptionsGetVariations = bindCairo(
23
23
 
24
24
  const cairoFontOptionsSetVariations = bindCairo(
25
25
  "cairo_font_options_set_variations",
26
- [FONT_OPTIONS_T, t.string("full")],
26
+ [FONT_OPTIONS_T, t.string("borrowed")],
27
27
  t.void,
28
28
  );
29
29
 
@@ -39,11 +39,7 @@ const cairoFontOptionsSetSubpixelOrder = bindCairo(
39
39
  t.void,
40
40
  );
41
41
 
42
- const cairoFontOptionsGetSubpixelOrder = bindCairo(
43
- "cairo_font_options_get_subpixel_order",
44
- [FONT_OPTIONS_T],
45
- t.int32,
46
- );
42
+ const cairoFontOptionsGetSubpixelOrder = bindCairo("cairo_font_options_get_subpixel_order", [FONT_OPTIONS_T], t.int32);
47
43
 
48
44
  /**
49
45
  * Cairo font options (`cairo_font_options_t`): the rendering settings applied to text, such as antialiasing,
@@ -129,13 +125,13 @@ class FontOptions {
129
125
  }
130
126
 
131
127
  /** Sets the OpenType font variations to apply, as a comma-separated `axis=value` string. */
132
- setVariations(variations: string): void {
128
+ setVariations(variations: string | null): void {
133
129
  cairoFontOptionsSetVariations(getHandle(this), variations);
134
130
  }
135
131
 
136
132
  /** Returns the OpenType font variations to apply. */
137
- getVariations(): string {
138
- return cairoFontOptionsGetVariations(getHandle(this)) as string;
133
+ getVariations(): string | null {
134
+ return cairoFontOptionsGetVariations(getHandle(this)) as string | null;
139
135
  }
140
136
  }
141
137