@gtkx/cairo 1.2.2
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.
- package/dist/context.d.ts +229 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +646 -0
- package/dist/context.js.map +1 -0
- package/dist/device.d.ts +21 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/device.js +39 -0
- package/dist/device.js.map +1 -0
- package/dist/enums.d.ts +526 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +482 -0
- package/dist/enums.js.map +1 -0
- package/dist/font-face.d.ts +55 -0
- package/dist/font-face.d.ts.map +1 -0
- package/dist/font-face.js +103 -0
- package/dist/font-face.js.map +1 -0
- package/dist/font-options.d.ts +43 -0
- package/dist/font-options.d.ts.map +1 -0
- package/dist/font-options.js +95 -0
- package/dist/font-options.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +36 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +120 -0
- package/dist/lib.js.map +1 -0
- package/dist/matrix.d.ts +40 -0
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +93 -0
- package/dist/matrix.js.map +1 -0
- package/dist/path.d.ts +14 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +67 -0
- package/dist/path.js.map +1 -0
- package/dist/pattern.d.ts +95 -0
- package/dist/pattern.d.ts.map +1 -0
- package/dist/pattern.js +250 -0
- package/dist/pattern.js.map +1 -0
- package/dist/region.d.ts +59 -0
- package/dist/region.d.ts.map +1 -0
- package/dist/region.js +154 -0
- package/dist/region.js.map +1 -0
- package/dist/scaled-font.d.ts +43 -0
- package/dist/scaled-font.d.ts.map +1 -0
- package/dist/scaled-font.js +156 -0
- package/dist/scaled-font.js.map +1 -0
- package/dist/structs.d.ts +120 -0
- package/dist/structs.d.ts.map +1 -0
- package/dist/structs.js +185 -0
- package/dist/structs.js.map +1 -0
- package/dist/surface.d.ts +98 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +274 -0
- package/dist/surface.js.map +1 -0
- package/dist/text.d.ts +10 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +45 -0
- package/dist/text.js.map +1 -0
- package/dist/types.d.ts +245 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/package.json +64 -0
- package/src/context.ts +899 -0
- package/src/device.ts +50 -0
- package/src/enums.ts +571 -0
- package/src/font-face.ts +157 -0
- package/src/font-options.ts +142 -0
- package/src/index.ts +28 -0
- package/src/lib.ts +186 -0
- package/src/matrix.ts +135 -0
- package/src/path.ts +87 -0
- package/src/pattern.ts +423 -0
- package/src/region.ts +216 -0
- package/src/scaled-font.ts +268 -0
- package/src/structs.ts +306 -0
- package/src/surface.ts +411 -0
- package/src/text.ts +56 -0
- package/src/types.ts +290 -0
- package/src/version.ts +16 -0
package/dist/structs.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { alloc, getHandle, read, registerWrapperClass, resolveType, setHandle, t, toNative, write, } from "@gtkx/runtime";
|
|
2
|
+
const CAIRO_GOBJECT_LIBRARY = "libcairo-gobject.so.2";
|
|
3
|
+
const RECTANGLE_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, "cairo_gobject_rectangle_get_type");
|
|
4
|
+
const RECTANGLE_INT_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, "cairo_gobject_rectangle_int_get_type");
|
|
5
|
+
const GLYPH_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, "cairo_gobject_glyph_get_type");
|
|
6
|
+
const TEXT_CLUSTER_TYPE = resolveType(CAIRO_GOBJECT_LIBRARY, "cairo_gobject_text_cluster_get_type");
|
|
7
|
+
const RECTANGLE_SIZE = 32;
|
|
8
|
+
const RECTANGLE_INT_SIZE = 16;
|
|
9
|
+
const GLYPH_SIZE = 24;
|
|
10
|
+
const TEXT_CLUSTER_SIZE = 8;
|
|
11
|
+
const DOUBLE = t.float64;
|
|
12
|
+
const INT = t.int32;
|
|
13
|
+
const ULONG = t.biguint64;
|
|
14
|
+
const readField = (instance, descriptor, offset) => read(getHandle(instance), descriptor, offset);
|
|
15
|
+
const writeField = (instance, descriptor, offset, value) => {
|
|
16
|
+
write(getHandle(instance), descriptor, offset, toNative(descriptor, value));
|
|
17
|
+
};
|
|
18
|
+
const writeInitial = (handle, descriptor, offset, value) => {
|
|
19
|
+
if (value != null) {
|
|
20
|
+
write(handle, descriptor, offset, toNative(descriptor, value));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/** A rectangle with double-precision edges, as `copyClipRectangleList` and recording surfaces report. */
|
|
24
|
+
class Rectangle {
|
|
25
|
+
static {
|
|
26
|
+
registerWrapperClass(this, RECTANGLE_TYPE);
|
|
27
|
+
}
|
|
28
|
+
/** Allocates a rectangle, writing the given fields and leaving the others at zero. */
|
|
29
|
+
constructor(props = {}) {
|
|
30
|
+
const handle = alloc(RECTANGLE_SIZE, RECTANGLE_TYPE);
|
|
31
|
+
writeInitial(handle, DOUBLE, 0, props.x);
|
|
32
|
+
writeInitial(handle, DOUBLE, 8, props.y);
|
|
33
|
+
writeInitial(handle, DOUBLE, 16, props.width);
|
|
34
|
+
writeInitial(handle, DOUBLE, 24, props.height);
|
|
35
|
+
setHandle(this, handle);
|
|
36
|
+
}
|
|
37
|
+
/** Horizontal position of the left edge. */
|
|
38
|
+
get x() {
|
|
39
|
+
return readField(this, DOUBLE, 0);
|
|
40
|
+
}
|
|
41
|
+
/** Horizontal position of the left edge. */
|
|
42
|
+
set x(value) {
|
|
43
|
+
writeField(this, DOUBLE, 0, value);
|
|
44
|
+
}
|
|
45
|
+
/** Vertical position of the top edge. */
|
|
46
|
+
get y() {
|
|
47
|
+
return readField(this, DOUBLE, 8);
|
|
48
|
+
}
|
|
49
|
+
/** Vertical position of the top edge. */
|
|
50
|
+
set y(value) {
|
|
51
|
+
writeField(this, DOUBLE, 8, value);
|
|
52
|
+
}
|
|
53
|
+
/** Width of the rectangle. */
|
|
54
|
+
get width() {
|
|
55
|
+
return readField(this, DOUBLE, 16);
|
|
56
|
+
}
|
|
57
|
+
/** Width of the rectangle. */
|
|
58
|
+
set width(value) {
|
|
59
|
+
writeField(this, DOUBLE, 16, value);
|
|
60
|
+
}
|
|
61
|
+
/** Height of the rectangle. */
|
|
62
|
+
get height() {
|
|
63
|
+
return readField(this, DOUBLE, 24);
|
|
64
|
+
}
|
|
65
|
+
/** Height of the rectangle. */
|
|
66
|
+
set height(value) {
|
|
67
|
+
writeField(this, DOUBLE, 24, value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** A rectangle with integer edges, as regions and `Surface.mapToImage` use. */
|
|
71
|
+
class RectangleInt {
|
|
72
|
+
static {
|
|
73
|
+
registerWrapperClass(this, RECTANGLE_INT_TYPE);
|
|
74
|
+
}
|
|
75
|
+
/** Allocates a rectangle, writing the given fields and leaving the others at zero. */
|
|
76
|
+
constructor(props = {}) {
|
|
77
|
+
const handle = alloc(RECTANGLE_INT_SIZE, RECTANGLE_INT_TYPE);
|
|
78
|
+
writeInitial(handle, INT, 0, props.x);
|
|
79
|
+
writeInitial(handle, INT, 4, props.y);
|
|
80
|
+
writeInitial(handle, INT, 8, props.width);
|
|
81
|
+
writeInitial(handle, INT, 12, props.height);
|
|
82
|
+
setHandle(this, handle);
|
|
83
|
+
}
|
|
84
|
+
/** Horizontal position of the left edge. */
|
|
85
|
+
get x() {
|
|
86
|
+
return readField(this, INT, 0);
|
|
87
|
+
}
|
|
88
|
+
/** Horizontal position of the left edge. */
|
|
89
|
+
set x(value) {
|
|
90
|
+
writeField(this, INT, 0, value);
|
|
91
|
+
}
|
|
92
|
+
/** Vertical position of the top edge. */
|
|
93
|
+
get y() {
|
|
94
|
+
return readField(this, INT, 4);
|
|
95
|
+
}
|
|
96
|
+
/** Vertical position of the top edge. */
|
|
97
|
+
set y(value) {
|
|
98
|
+
writeField(this, INT, 4, value);
|
|
99
|
+
}
|
|
100
|
+
/** Width of the rectangle. */
|
|
101
|
+
get width() {
|
|
102
|
+
return readField(this, INT, 8);
|
|
103
|
+
}
|
|
104
|
+
/** Width of the rectangle. */
|
|
105
|
+
set width(value) {
|
|
106
|
+
writeField(this, INT, 8, value);
|
|
107
|
+
}
|
|
108
|
+
/** Height of the rectangle. */
|
|
109
|
+
get height() {
|
|
110
|
+
return readField(this, INT, 12);
|
|
111
|
+
}
|
|
112
|
+
/** Height of the rectangle. */
|
|
113
|
+
set height(value) {
|
|
114
|
+
writeField(this, INT, 12, value);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** A `cairo_glyph_t`: one glyph index and where to draw it. */
|
|
118
|
+
class Glyph {
|
|
119
|
+
static {
|
|
120
|
+
registerWrapperClass(this, GLYPH_TYPE);
|
|
121
|
+
}
|
|
122
|
+
/** Allocates a glyph, writing the given fields and leaving the others at zero. */
|
|
123
|
+
constructor(props = {}) {
|
|
124
|
+
const handle = alloc(GLYPH_SIZE, GLYPH_TYPE);
|
|
125
|
+
writeInitial(handle, ULONG, 0, props.index);
|
|
126
|
+
writeInitial(handle, DOUBLE, 8, props.x);
|
|
127
|
+
writeInitial(handle, DOUBLE, 16, props.y);
|
|
128
|
+
setHandle(this, handle);
|
|
129
|
+
}
|
|
130
|
+
/** Index of the glyph in the font. */
|
|
131
|
+
get index() {
|
|
132
|
+
return read(getHandle(this), ULONG, 0);
|
|
133
|
+
}
|
|
134
|
+
/** Index of the glyph in the font. */
|
|
135
|
+
set index(value) {
|
|
136
|
+
writeField(this, ULONG, 0, value);
|
|
137
|
+
}
|
|
138
|
+
/** Horizontal position of the glyph origin. */
|
|
139
|
+
get x() {
|
|
140
|
+
return readField(this, DOUBLE, 8);
|
|
141
|
+
}
|
|
142
|
+
/** Horizontal position of the glyph origin. */
|
|
143
|
+
set x(value) {
|
|
144
|
+
writeField(this, DOUBLE, 8, value);
|
|
145
|
+
}
|
|
146
|
+
/** Vertical position of the glyph origin. */
|
|
147
|
+
get y() {
|
|
148
|
+
return readField(this, DOUBLE, 16);
|
|
149
|
+
}
|
|
150
|
+
/** Vertical position of the glyph origin. */
|
|
151
|
+
set y(value) {
|
|
152
|
+
writeField(this, DOUBLE, 16, value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** A `cairo_text_cluster_t`: how many bytes of text map to how many glyphs. */
|
|
156
|
+
class TextCluster {
|
|
157
|
+
static {
|
|
158
|
+
registerWrapperClass(this, TEXT_CLUSTER_TYPE);
|
|
159
|
+
}
|
|
160
|
+
/** Allocates a cluster, writing the given fields and leaving the others at zero. */
|
|
161
|
+
constructor(props = {}) {
|
|
162
|
+
const handle = alloc(TEXT_CLUSTER_SIZE, TEXT_CLUSTER_TYPE);
|
|
163
|
+
writeInitial(handle, INT, 0, props.numBytes);
|
|
164
|
+
writeInitial(handle, INT, 4, props.numGlyphs);
|
|
165
|
+
setHandle(this, handle);
|
|
166
|
+
}
|
|
167
|
+
/** Number of UTF-8 bytes the cluster covers. */
|
|
168
|
+
get numBytes() {
|
|
169
|
+
return readField(this, INT, 0);
|
|
170
|
+
}
|
|
171
|
+
/** Number of UTF-8 bytes the cluster covers. */
|
|
172
|
+
set numBytes(value) {
|
|
173
|
+
writeField(this, INT, 0, value);
|
|
174
|
+
}
|
|
175
|
+
/** Number of glyphs the cluster covers. */
|
|
176
|
+
get numGlyphs() {
|
|
177
|
+
return readField(this, INT, 4);
|
|
178
|
+
}
|
|
179
|
+
/** Number of glyphs the cluster covers. */
|
|
180
|
+
set numGlyphs(value) {
|
|
181
|
+
writeField(this, INT, 4, value);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export { Glyph, Rectangle, RectangleInt, TextCluster, };
|
|
185
|
+
//# s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AAG,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 regions and `Surface.mapToImage` 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"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type ExternalObject, type Handle } from "@gtkx/runtime";
|
|
2
|
+
import type { RectangleInt } from "./structs.js";
|
|
3
|
+
import type { DeviceOffset, DeviceScale, FallbackResolution, InkExtents, RectangleData } from "./types.js";
|
|
4
|
+
import { type Content, type Format, type Status, SurfaceType } from "./enums.js";
|
|
5
|
+
import { FontOptions } from "./font-options.js";
|
|
6
|
+
/**
|
|
7
|
+
* A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`
|
|
8
|
+
* statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their
|
|
9
|
+
* backend reports (`instanceof ImageSurface` for an image surface).
|
|
10
|
+
*/
|
|
11
|
+
declare abstract class Surface {
|
|
12
|
+
/** Creates a surface of the given `content` and size as compatible as possible with `other`. */
|
|
13
|
+
static createSimilar(other: Surface, content: Content, width: number, height: number): Surface;
|
|
14
|
+
/** Creates an image surface of the given `format` and size as compatible as possible with `other`. */
|
|
15
|
+
static createSimilarImage(other: Surface, format: Format, width: number, height: number): Surface;
|
|
16
|
+
/** Creates a surface that draws onto the given rectangle of `target`. */
|
|
17
|
+
static createForRectangle(target: Surface, x: number, y: number, width: number, height: number): Surface;
|
|
18
|
+
/** GType of `CairoSurface`, the boxed type this class is registered under. */
|
|
19
|
+
__type__: bigint;
|
|
20
|
+
/** Writes the surface to a PNG file at `filename` and returns the resulting status. */
|
|
21
|
+
writeToPng(filename: string): Status;
|
|
22
|
+
/** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */
|
|
23
|
+
status(): Status;
|
|
24
|
+
/** Finishes the surface and drops its backend resources; further drawing reports an error. */
|
|
25
|
+
finish(): void;
|
|
26
|
+
/** Performs any pending drawing so the backend storage is up to date. */
|
|
27
|
+
flush(): void;
|
|
28
|
+
/** Returns the raw handle of the device behind the surface, or null when it has none. */
|
|
29
|
+
getDevice(): ExternalObject<Handle> | null;
|
|
30
|
+
/** Returns the font options the surface's backend prefers for rendering text. */
|
|
31
|
+
getFontOptions(): FontOptions;
|
|
32
|
+
/** Returns whether the surface holds color, alpha or both. */
|
|
33
|
+
getContent(): Content;
|
|
34
|
+
/** Tells cairo the surface's storage was modified outside of cairo. */
|
|
35
|
+
markDirty(): void;
|
|
36
|
+
/** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */
|
|
37
|
+
markDirtyRectangle(x: number, y: number, width: number, height: number): void;
|
|
38
|
+
/** Sets the offset added to device coordinates when drawing onto the surface. */
|
|
39
|
+
setDeviceOffset(xOffset: number, yOffset: number): void;
|
|
40
|
+
/** Returns the offset added to device coordinates when drawing onto the surface. */
|
|
41
|
+
getDeviceOffset(): DeviceOffset;
|
|
42
|
+
/** Returns the scale applied between user and device units. */
|
|
43
|
+
getDeviceScale(): DeviceScale;
|
|
44
|
+
/** Sets the scale applied between user and device units. */
|
|
45
|
+
setDeviceScale(xScale: number, yScale: number): void;
|
|
46
|
+
/** Sets the resolution used when vector content has to be rasterized. */
|
|
47
|
+
setFallbackResolution(xPixelsPerInch: number, yPixelsPerInch: number): void;
|
|
48
|
+
/** Returns the resolution used when vector content has to be rasterized. */
|
|
49
|
+
getFallbackResolution(): FallbackResolution;
|
|
50
|
+
/** Returns the backend type of the surface. */
|
|
51
|
+
getType(): SurfaceType;
|
|
52
|
+
/** Returns the reference count of the surface. */
|
|
53
|
+
getReferenceCount(): number;
|
|
54
|
+
/** Emits the current page and keeps its content for the next one, on paged backends. */
|
|
55
|
+
copyPage(): void;
|
|
56
|
+
/** Emits the current page and starts a blank one, on paged backends. */
|
|
57
|
+
showPage(): void;
|
|
58
|
+
/** Returns whether the surface supports `Context.showTextGlyphs` natively. */
|
|
59
|
+
hasShowTextGlyphs(): boolean;
|
|
60
|
+
/** Returns whether the surface can embed data of the given MIME type. */
|
|
61
|
+
supportsMimeType(mimeType: string): boolean;
|
|
62
|
+
/** Returns an image surface giving direct access to the pixels of `extents`; release it with `unmapImage`. */
|
|
63
|
+
mapToImage(extents: RectangleInt): Surface;
|
|
64
|
+
/** Uploads the pixels of `image`, obtained from `mapToImage`, back to the surface and releases it. */
|
|
65
|
+
unmapImage(image: Surface): void;
|
|
66
|
+
}
|
|
67
|
+
/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */
|
|
68
|
+
declare class ImageSurface extends Surface {
|
|
69
|
+
/** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */
|
|
70
|
+
static create(format: Format, width: number, height: number): ImageSurface;
|
|
71
|
+
/** Loads a PNG file into a new image surface; a missing or invalid file yields a surface in an error status. */
|
|
72
|
+
static createFromPng(filename: string): ImageSurface;
|
|
73
|
+
/** Creates an image surface of the given pixel `format` and size. */
|
|
74
|
+
constructor(format: Format, width: number, height: number);
|
|
75
|
+
/** Returns the width of the surface in pixels. */
|
|
76
|
+
getWidth(): number;
|
|
77
|
+
/** Returns the height of the surface in pixels. */
|
|
78
|
+
getHeight(): number;
|
|
79
|
+
/** Returns the pixel format of the surface. */
|
|
80
|
+
getFormat(): Format;
|
|
81
|
+
/** Returns the number of bytes between the starts of consecutive rows. */
|
|
82
|
+
getStride(): number;
|
|
83
|
+
/** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */
|
|
84
|
+
getData(): Uint8Array;
|
|
85
|
+
}
|
|
86
|
+
/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */
|
|
87
|
+
declare class RecordingSurface extends Surface {
|
|
88
|
+
/** Creates a recording surface, the same as `new RecordingSurface(...)`. */
|
|
89
|
+
static create(content: Content, extents?: RectangleData): RecordingSurface;
|
|
90
|
+
/** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */
|
|
91
|
+
constructor(content: Content, extents?: RectangleData);
|
|
92
|
+
/** Returns the area that has been drawn on so far. */
|
|
93
|
+
inkExtents(): InkExtents;
|
|
94
|
+
/** Returns the extents the surface was created with, or null for an unbounded surface. */
|
|
95
|
+
getExtents(): RectangleData | null;
|
|
96
|
+
}
|
|
97
|
+
export { ImageSurface, RecordingSurface, Surface };
|
|
98
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,cAAc,EAEnB,KAAK,MAAM,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,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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AA4E;IAC5E,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,gBAAgB;IAI1E,0GAA0G;gBAC9F,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa;IAKrD,sDAAsD;IACtD,UAAU,IAAI,UAAU;IAUxB,0FAA0F;IAC1F,UAAU,IAAI,aAAa,GAAG,IAAI;CAMrC;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/surface.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { alloc, getHandle, read, registerWrapperClass, registerWrapperClassResolver, setHandle, t, wrapHandle, write, } from "@gtkx/runtime";
|
|
2
|
+
import { SurfaceType } from "./enums.js";
|
|
3
|
+
import { FontOptions } from "./font-options.js";
|
|
4
|
+
import { bindCairo, cairoGType, DEVICE_T, FONT_OPTIONS_T, RECTANGLE_INT_T, RECTANGLE_T, SURFACE_FULL_T, SURFACE_T, } from "./lib.js";
|
|
5
|
+
const SURFACE_TYPE = cairoGType("cairo_gobject_surface_get_type");
|
|
6
|
+
const RECTANGLE_SIZE = 32;
|
|
7
|
+
const DEVICE_PAIR_ARGS = [SURFACE_T, t.float64, t.float64];
|
|
8
|
+
const DEVICE_PAIR_OUT_ARGS = [SURFACE_T, t.ref(t.float64), t.ref(t.float64)];
|
|
9
|
+
const SIMILAR_ARGS = [SURFACE_T, t.int32, t.int32, t.int32];
|
|
10
|
+
const cairoSurfaceCreateSimilar = bindCairo("cairo_surface_create_similar", SIMILAR_ARGS, SURFACE_FULL_T);
|
|
11
|
+
const cairoSurfaceCreateSimilarImage = bindCairo("cairo_surface_create_similar_image", SIMILAR_ARGS, SURFACE_FULL_T);
|
|
12
|
+
const cairoSurfaceCreateForRectangle = bindCairo("cairo_surface_create_for_rectangle", [SURFACE_T, t.float64, t.float64, t.float64, t.float64], SURFACE_FULL_T);
|
|
13
|
+
const cairoSurfaceWriteToPng = bindCairo("cairo_surface_write_to_png", [SURFACE_T, t.string("full")], t.int32);
|
|
14
|
+
const cairoSurfaceStatus = bindCairo("cairo_surface_status", [SURFACE_T], t.int32);
|
|
15
|
+
const cairoSurfaceFinish = bindCairo("cairo_surface_finish", [SURFACE_T], t.void);
|
|
16
|
+
const cairoSurfaceFlush = bindCairo("cairo_surface_flush", [SURFACE_T], t.void);
|
|
17
|
+
const cairoSurfaceGetDevice = bindCairo("cairo_surface_get_device", [SURFACE_T], DEVICE_T);
|
|
18
|
+
const cairoSurfaceGetFontOptions = bindCairo("cairo_surface_get_font_options", [SURFACE_T, FONT_OPTIONS_T], t.void);
|
|
19
|
+
const cairoSurfaceGetContent = bindCairo("cairo_surface_get_content", [SURFACE_T], t.int32);
|
|
20
|
+
const cairoSurfaceMarkDirty = bindCairo("cairo_surface_mark_dirty", [SURFACE_T], t.void);
|
|
21
|
+
const cairoSurfaceMarkDirtyRectangle = bindCairo("cairo_surface_mark_dirty_rectangle", [SURFACE_T, t.int32, t.int32, t.int32, t.int32], t.void);
|
|
22
|
+
const cairoSurfaceSetDeviceOffset = bindCairo("cairo_surface_set_device_offset", DEVICE_PAIR_ARGS, t.void);
|
|
23
|
+
const cairoSurfaceGetDeviceOffset = bindCairo("cairo_surface_get_device_offset", DEVICE_PAIR_OUT_ARGS, t.void);
|
|
24
|
+
const cairoSurfaceGetDeviceScale = bindCairo("cairo_surface_get_device_scale", DEVICE_PAIR_OUT_ARGS, t.void);
|
|
25
|
+
const cairoSurfaceSetDeviceScale = bindCairo("cairo_surface_set_device_scale", DEVICE_PAIR_ARGS, t.void);
|
|
26
|
+
const cairoSurfaceSetFallbackResolution = bindCairo("cairo_surface_set_fallback_resolution", DEVICE_PAIR_ARGS, t.void);
|
|
27
|
+
const cairoSurfaceGetFallbackResolution = bindCairo("cairo_surface_get_fallback_resolution", DEVICE_PAIR_OUT_ARGS, t.void);
|
|
28
|
+
const cairoSurfaceGetType = bindCairo("cairo_surface_get_type", [SURFACE_T], t.int32);
|
|
29
|
+
const cairoSurfaceGetReferenceCount = bindCairo("cairo_surface_get_reference_count", [SURFACE_T], t.int32);
|
|
30
|
+
const cairoSurfaceCopyPage = bindCairo("cairo_surface_copy_page", [SURFACE_T], t.void);
|
|
31
|
+
const cairoSurfaceShowPage = bindCairo("cairo_surface_show_page", [SURFACE_T], t.void);
|
|
32
|
+
const cairoSurfaceHasShowTextGlyphs = bindCairo("cairo_surface_has_show_text_glyphs", [SURFACE_T], t.boolean);
|
|
33
|
+
const cairoSurfaceSupportsMimeType = bindCairo("cairo_surface_supports_mime_type", [SURFACE_T, t.string("full")], t.boolean);
|
|
34
|
+
const cairoSurfaceMapToImage = bindCairo("cairo_surface_map_to_image", [SURFACE_T, RECTANGLE_INT_T], SURFACE_T);
|
|
35
|
+
const cairoSurfaceUnmapImage = bindCairo("cairo_surface_unmap_image", [SURFACE_T, SURFACE_T], t.void);
|
|
36
|
+
const cairoImageSurfaceCreate = bindCairo("cairo_image_surface_create", [t.int32, t.int32, t.int32], SURFACE_FULL_T);
|
|
37
|
+
const cairoImageSurfaceCreateFromPng = bindCairo("cairo_image_surface_create_from_png", [t.string("full")], SURFACE_FULL_T);
|
|
38
|
+
const cairoImageSurfaceGetWidth = bindCairo("cairo_image_surface_get_width", [SURFACE_T], t.int32);
|
|
39
|
+
const cairoImageSurfaceGetHeight = bindCairo("cairo_image_surface_get_height", [SURFACE_T], t.int32);
|
|
40
|
+
const cairoImageSurfaceGetFormat = bindCairo("cairo_image_surface_get_format", [SURFACE_T], t.int32);
|
|
41
|
+
const cairoImageSurfaceGetStride = bindCairo("cairo_image_surface_get_stride", [SURFACE_T], t.int32);
|
|
42
|
+
const cairoRecordingSurfaceCreate = bindCairo("cairo_recording_surface_create", [t.int32, RECTANGLE_T], SURFACE_FULL_T);
|
|
43
|
+
const cairoRecordingSurfaceCreateUnbounded = bindCairo("cairo_recording_surface_create", [t.int32, t.uint64], SURFACE_FULL_T);
|
|
44
|
+
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);
|
|
45
|
+
const cairoRecordingSurfaceGetExtents = bindCairo("cairo_recording_surface_get_extents", [SURFACE_T, RECTANGLE_T], t.boolean);
|
|
46
|
+
const wrapSurface = (handle) => wrapHandle(handle, Surface);
|
|
47
|
+
const readPair = (boundFn, self, build) => {
|
|
48
|
+
const first = { value: 0 };
|
|
49
|
+
const second = { value: 0 };
|
|
50
|
+
boundFn(getHandle(self), first, second);
|
|
51
|
+
return build(first.value, second.value);
|
|
52
|
+
};
|
|
53
|
+
const allocRectangle = (rect) => {
|
|
54
|
+
const buffer = alloc(RECTANGLE_SIZE);
|
|
55
|
+
write(buffer, t.float64, 0, rect.x);
|
|
56
|
+
write(buffer, t.float64, 8, rect.y);
|
|
57
|
+
write(buffer, t.float64, 16, rect.width);
|
|
58
|
+
write(buffer, t.float64, 24, rect.height);
|
|
59
|
+
return buffer;
|
|
60
|
+
};
|
|
61
|
+
const readRectangle = (buffer) => ({
|
|
62
|
+
x: read(buffer, t.float64, 0),
|
|
63
|
+
y: read(buffer, t.float64, 8),
|
|
64
|
+
width: read(buffer, t.float64, 16),
|
|
65
|
+
height: read(buffer, t.float64, 24),
|
|
66
|
+
});
|
|
67
|
+
const createRecordingSurface = (content, extents) => (extents === undefined
|
|
68
|
+
? cairoRecordingSurfaceCreateUnbounded(content, 0)
|
|
69
|
+
: cairoRecordingSurfaceCreate(content, allocRectangle(extents)));
|
|
70
|
+
const surfaceClassFor = (handle) => {
|
|
71
|
+
const type = cairoSurfaceGetType(handle);
|
|
72
|
+
if (type === SurfaceType.IMAGE) {
|
|
73
|
+
return ImageSurface;
|
|
74
|
+
}
|
|
75
|
+
if (type === SurfaceType.RECORDING) {
|
|
76
|
+
return RecordingSurface;
|
|
77
|
+
}
|
|
78
|
+
return Surface;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A cairo surface (`cairo_surface_t`): the target a context draws onto. Surfaces come from the `create*`
|
|
82
|
+
* statics, from `ImageSurface` and `RecordingSurface`, or from GTK, and wrap as the concrete class their
|
|
83
|
+
* backend reports (`instanceof ImageSurface` for an image surface).
|
|
84
|
+
*/
|
|
85
|
+
class Surface {
|
|
86
|
+
static {
|
|
87
|
+
registerWrapperClass(this, SURFACE_TYPE);
|
|
88
|
+
registerWrapperClassResolver(this, surfaceClassFor);
|
|
89
|
+
}
|
|
90
|
+
/** Creates a surface of the given `content` and size as compatible as possible with `other`. */
|
|
91
|
+
static createSimilar(other, content, width, height) {
|
|
92
|
+
return wrapSurface(cairoSurfaceCreateSimilar(getHandle(other), content, width, height));
|
|
93
|
+
}
|
|
94
|
+
/** Creates an image surface of the given `format` and size as compatible as possible with `other`. */
|
|
95
|
+
static createSimilarImage(other, format, width, height) {
|
|
96
|
+
return wrapSurface(cairoSurfaceCreateSimilarImage(getHandle(other), format, width, height));
|
|
97
|
+
}
|
|
98
|
+
/** Creates a surface that draws onto the given rectangle of `target`. */
|
|
99
|
+
static createForRectangle(target, x, y, width, height) {
|
|
100
|
+
return wrapSurface(cairoSurfaceCreateForRectangle(getHandle(target), x, y, width, height));
|
|
101
|
+
}
|
|
102
|
+
/** Writes the surface to a PNG file at `filename` and returns the resulting status. */
|
|
103
|
+
writeToPng(filename) {
|
|
104
|
+
return cairoSurfaceWriteToPng(getHandle(this), filename);
|
|
105
|
+
}
|
|
106
|
+
/** Returns the error status of the surface, `Status.SUCCESS` when it is usable. */
|
|
107
|
+
status() {
|
|
108
|
+
return cairoSurfaceStatus(getHandle(this));
|
|
109
|
+
}
|
|
110
|
+
/** Finishes the surface and drops its backend resources; further drawing reports an error. */
|
|
111
|
+
finish() {
|
|
112
|
+
cairoSurfaceFinish(getHandle(this));
|
|
113
|
+
}
|
|
114
|
+
/** Performs any pending drawing so the backend storage is up to date. */
|
|
115
|
+
flush() {
|
|
116
|
+
cairoSurfaceFlush(getHandle(this));
|
|
117
|
+
}
|
|
118
|
+
/** Returns the raw handle of the device behind the surface, or null when it has none. */
|
|
119
|
+
getDevice() {
|
|
120
|
+
return cairoSurfaceGetDevice(getHandle(this));
|
|
121
|
+
}
|
|
122
|
+
/** Returns the font options the surface's backend prefers for rendering text. */
|
|
123
|
+
getFontOptions() {
|
|
124
|
+
const options = FontOptions.create();
|
|
125
|
+
cairoSurfaceGetFontOptions(getHandle(this), getHandle(options));
|
|
126
|
+
return options;
|
|
127
|
+
}
|
|
128
|
+
/** Returns whether the surface holds color, alpha or both. */
|
|
129
|
+
getContent() {
|
|
130
|
+
return cairoSurfaceGetContent(getHandle(this));
|
|
131
|
+
}
|
|
132
|
+
/** Tells cairo the surface's storage was modified outside of cairo. */
|
|
133
|
+
markDirty() {
|
|
134
|
+
cairoSurfaceMarkDirty(getHandle(this));
|
|
135
|
+
}
|
|
136
|
+
/** Tells cairo the given rectangle of the surface's storage was modified outside of cairo. */
|
|
137
|
+
markDirtyRectangle(x, y, width, height) {
|
|
138
|
+
cairoSurfaceMarkDirtyRectangle(getHandle(this), x, y, width, height);
|
|
139
|
+
}
|
|
140
|
+
/** Sets the offset added to device coordinates when drawing onto the surface. */
|
|
141
|
+
setDeviceOffset(xOffset, yOffset) {
|
|
142
|
+
cairoSurfaceSetDeviceOffset(getHandle(this), xOffset, yOffset);
|
|
143
|
+
}
|
|
144
|
+
/** Returns the offset added to device coordinates when drawing onto the surface. */
|
|
145
|
+
getDeviceOffset() {
|
|
146
|
+
return readPair(cairoSurfaceGetDeviceOffset, this, (xOffset, yOffset) => ({ xOffset, yOffset }));
|
|
147
|
+
}
|
|
148
|
+
/** Returns the scale applied between user and device units. */
|
|
149
|
+
getDeviceScale() {
|
|
150
|
+
return readPair(cairoSurfaceGetDeviceScale, this, (xScale, yScale) => ({ xScale, yScale }));
|
|
151
|
+
}
|
|
152
|
+
/** Sets the scale applied between user and device units. */
|
|
153
|
+
setDeviceScale(xScale, yScale) {
|
|
154
|
+
cairoSurfaceSetDeviceScale(getHandle(this), xScale, yScale);
|
|
155
|
+
}
|
|
156
|
+
/** Sets the resolution used when vector content has to be rasterized. */
|
|
157
|
+
setFallbackResolution(xPixelsPerInch, yPixelsPerInch) {
|
|
158
|
+
cairoSurfaceSetFallbackResolution(getHandle(this), xPixelsPerInch, yPixelsPerInch);
|
|
159
|
+
}
|
|
160
|
+
/** Returns the resolution used when vector content has to be rasterized. */
|
|
161
|
+
getFallbackResolution() {
|
|
162
|
+
return readPair(cairoSurfaceGetFallbackResolution, this, (xPixelsPerInch, yPixelsPerInch) => ({
|
|
163
|
+
xPixelsPerInch,
|
|
164
|
+
yPixelsPerInch,
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
/** Returns the backend type of the surface. */
|
|
168
|
+
getType() {
|
|
169
|
+
return cairoSurfaceGetType(getHandle(this));
|
|
170
|
+
}
|
|
171
|
+
/** Returns the reference count of the surface. */
|
|
172
|
+
getReferenceCount() {
|
|
173
|
+
return cairoSurfaceGetReferenceCount(getHandle(this));
|
|
174
|
+
}
|
|
175
|
+
/** Emits the current page and keeps its content for the next one, on paged backends. */
|
|
176
|
+
copyPage() {
|
|
177
|
+
cairoSurfaceCopyPage(getHandle(this));
|
|
178
|
+
}
|
|
179
|
+
/** Emits the current page and starts a blank one, on paged backends. */
|
|
180
|
+
showPage() {
|
|
181
|
+
cairoSurfaceShowPage(getHandle(this));
|
|
182
|
+
}
|
|
183
|
+
/** Returns whether the surface supports `Context.showTextGlyphs` natively. */
|
|
184
|
+
hasShowTextGlyphs() {
|
|
185
|
+
return cairoSurfaceHasShowTextGlyphs(getHandle(this));
|
|
186
|
+
}
|
|
187
|
+
/** Returns whether the surface can embed data of the given MIME type. */
|
|
188
|
+
supportsMimeType(mimeType) {
|
|
189
|
+
return cairoSurfaceSupportsMimeType(getHandle(this), mimeType);
|
|
190
|
+
}
|
|
191
|
+
/** Returns an image surface giving direct access to the pixels of `extents`; release it with `unmapImage`. */
|
|
192
|
+
mapToImage(extents) {
|
|
193
|
+
return wrapSurface(cairoSurfaceMapToImage(getHandle(this), getHandle(extents)));
|
|
194
|
+
}
|
|
195
|
+
/** Uploads the pixels of `image`, obtained from `mapToImage`, back to the surface and releases it. */
|
|
196
|
+
unmapImage(image) {
|
|
197
|
+
cairoSurfaceUnmapImage(getHandle(this), getHandle(image));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/** A surface backed by an in-memory pixel buffer, the usual target for offscreen drawing. */
|
|
201
|
+
class ImageSurface extends Surface {
|
|
202
|
+
/** Creates an image surface of the given pixel `format` and size, the same as `new ImageSurface(...)`. */
|
|
203
|
+
static create(format, width, height) {
|
|
204
|
+
return wrapHandle(cairoImageSurfaceCreate(format, width, height), this);
|
|
205
|
+
}
|
|
206
|
+
/** Loads a PNG file into a new image surface; a missing or invalid file yields a surface in an error status. */
|
|
207
|
+
static createFromPng(filename) {
|
|
208
|
+
return wrapHandle(cairoImageSurfaceCreateFromPng(filename), this);
|
|
209
|
+
}
|
|
210
|
+
/** Creates an image surface of the given pixel `format` and size. */
|
|
211
|
+
constructor(format, width, height) {
|
|
212
|
+
super();
|
|
213
|
+
setHandle(this, cairoImageSurfaceCreate(format, width, height));
|
|
214
|
+
}
|
|
215
|
+
/** Returns the width of the surface in pixels. */
|
|
216
|
+
getWidth() {
|
|
217
|
+
return cairoImageSurfaceGetWidth(getHandle(this));
|
|
218
|
+
}
|
|
219
|
+
/** Returns the height of the surface in pixels. */
|
|
220
|
+
getHeight() {
|
|
221
|
+
return cairoImageSurfaceGetHeight(getHandle(this));
|
|
222
|
+
}
|
|
223
|
+
/** Returns the pixel format of the surface. */
|
|
224
|
+
getFormat() {
|
|
225
|
+
return cairoImageSurfaceGetFormat(getHandle(this));
|
|
226
|
+
}
|
|
227
|
+
/** Returns the number of bytes between the starts of consecutive rows. */
|
|
228
|
+
getStride() {
|
|
229
|
+
return cairoImageSurfaceGetStride(getHandle(this));
|
|
230
|
+
}
|
|
231
|
+
/** Returns a copy of the pixel data, `getStride() * getHeight()` bytes in the surface's format. */
|
|
232
|
+
getData() {
|
|
233
|
+
this.flush();
|
|
234
|
+
const totalBytes = this.getStride() * this.getHeight();
|
|
235
|
+
if (totalBytes === 0) {
|
|
236
|
+
return new Uint8Array(0);
|
|
237
|
+
}
|
|
238
|
+
const getImageData = bindCairo("cairo_image_surface_get_data", [SURFACE_T], t.struct("borrowed", { size: totalBytes }));
|
|
239
|
+
const data = getImageData(getHandle(this));
|
|
240
|
+
if (data === null) {
|
|
241
|
+
return new Uint8Array(0);
|
|
242
|
+
}
|
|
243
|
+
return Uint8Array.from({ length: totalBytes }, (_, index) => read(data, t.uint8, index));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/** A surface that records the drawing operations applied to it, for replaying them onto other surfaces. */
|
|
247
|
+
class RecordingSurface extends Surface {
|
|
248
|
+
/** Creates a recording surface, the same as `new RecordingSurface(...)`. */
|
|
249
|
+
static create(content, extents) {
|
|
250
|
+
return new RecordingSurface(content, extents);
|
|
251
|
+
}
|
|
252
|
+
/** Creates a recording surface of the given `content`, bounded to `extents` or unbounded when omitted. */
|
|
253
|
+
constructor(content, extents) {
|
|
254
|
+
super();
|
|
255
|
+
setHandle(this, createRecordingSurface(content, extents));
|
|
256
|
+
}
|
|
257
|
+
/** Returns the area that has been drawn on so far. */
|
|
258
|
+
inkExtents() {
|
|
259
|
+
const x0 = { value: 0 };
|
|
260
|
+
const y0 = { value: 0 };
|
|
261
|
+
const width = { value: 0 };
|
|
262
|
+
const height = { value: 0 };
|
|
263
|
+
cairoRecordingSurfaceInkExtents(getHandle(this), x0, y0, width, height);
|
|
264
|
+
return { x0: x0.value, y0: y0.value, width: width.value, height: height.value };
|
|
265
|
+
}
|
|
266
|
+
/** Returns the extents the surface was created with, or null for an unbounded surface. */
|
|
267
|
+
getExtents() {
|
|
268
|
+
const buffer = alloc(RECTANGLE_SIZE);
|
|
269
|
+
const isBounded = cairoRecordingSurfaceGetExtents(getHandle(this), buffer);
|
|
270
|
+
return isBounded ? readRectangle(buffer) : null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export { ImageSurface, RecordingSurface, Surface };
|
|
274
|
+
//# sourceMappingURL=surface.js.map
|