@gtkx/codegen 1.2.2 → 1.4.0
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/README.md +6 -4
- package/dist/analysis/descriptor-render.d.ts +7 -1
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +37 -15
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +5 -1
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +12 -2
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/param-capability.d.ts +5 -2
- package/dist/analysis/param-capability.d.ts.map +1 -1
- package/dist/analysis/param-capability.js +36 -4
- package/dist/analysis/param-capability.js.map +1 -1
- package/dist/analysis/param-structure.d.ts +1 -1
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +28 -10
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/compile.js +1 -1
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +6 -0
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +11 -2
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/pipeline.d.ts +3 -0
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +10 -1
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/fingerprint.d.ts +5 -0
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +111 -15
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +3 -0
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +33 -7
- package/dist/gi.js.map +1 -1
- package/dist/gir/external-namespaces.d.ts +8 -0
- package/dist/gir/external-namespaces.d.ts.map +1 -0
- package/dist/gir/external-namespaces.js +4 -0
- package/dist/gir/external-namespaces.js.map +1 -0
- package/dist/gir/finish-overrides.d.ts +3 -0
- package/dist/gir/finish-overrides.d.ts.map +1 -0
- package/dist/gir/finish-overrides.js +5 -0
- package/dist/gir/finish-overrides.js.map +1 -0
- package/dist/gir/function.d.ts +5 -2
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +34 -5
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/hidden-symbols.d.ts +3 -0
- package/dist/gir/hidden-symbols.d.ts.map +1 -0
- package/dist/gir/hidden-symbols.js +39 -0
- package/dist/gir/hidden-symbols.js.map +1 -0
- package/dist/gir/library.d.ts +22 -2
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +21 -3
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/ucs4-overrides.d.ts +3 -0
- package/dist/gir/ucs4-overrides.d.ts.map +1 -0
- package/dist/gir/ucs4-overrides.js +7 -0
- package/dist/gir/ucs4-overrides.js.map +1 -0
- package/dist/guards.d.ts +2 -1
- package/dist/guards.d.ts.map +1 -1
- package/dist/guards.js +3 -1
- package/dist/guards.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +27 -8
- package/dist/jsx.js.map +1 -1
- package/dist/runner.d.ts +8 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +9 -3
- package/dist/runner.js.map +1 -1
- package/dist/store/external-package-links.d.ts +6 -0
- package/dist/store/external-package-links.d.ts.map +1 -0
- package/dist/store/external-package-links.js +158 -0
- package/dist/store/external-package-links.js.map +1 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -1
- package/dist/store/gi/callable-doc.js +4 -4
- package/dist/store/gi/callable-doc.js.map +1 -1
- package/dist/store/gi/callables.js +1 -1
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +17 -0
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/constructor-props.js +1 -1
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +2 -1
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/generated-libraries.d.ts +26 -0
- package/dist/store/gi/generated-libraries.d.ts.map +1 -0
- package/dist/store/gi/generated-libraries.js +53 -0
- package/dist/store/gi/generated-libraries.js.map +1 -0
- package/dist/store/gi/gtype-binding.d.ts +2 -1
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +6 -1
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/method.d.ts +7 -2
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +126 -30
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +8 -1
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +52 -4
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +2 -3
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +2 -1
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +9 -3
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/runtime-override.js +1 -1
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.js +2 -2
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +82 -12
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +12 -2
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +24 -5
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +3 -1
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.d.ts.map +1 -1
- package/dist/store/jsx/metadata.js +35 -60
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx-store.d.ts +8 -1
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +9 -2
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +2 -1
- package/dist/store/resolve-store.d.ts.map +1 -1
- package/dist/store/resolve-store.js +3 -1
- package/dist/store/resolve-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +2 -1
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +8 -3
- package/dist/store/store-fs.js.map +1 -1
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +8 -0
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +27 -1
- package/dist/writer/gtk-doc.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +15 -1
- package/overrides/glib/index.ts.ejs +3 -0
- package/overrides/glib/regex.ts.ejs +66 -0
- package/overrides/gobject/index.ts.ejs +3 -0
- package/overrides/gobject/object-class.ts.ejs +27 -0
- package/overrides/gobject/param-spec-getters.ts.ejs +57 -0
- package/overrides/gobject/param-spec.ts.ejs +21 -0
- package/overrides/gobject/value.ts.ejs +6 -1
- package/overrides/graphene/structs.ts.ejs +38 -3
- package/overrides/gtk/index.ts.ejs +2 -0
- package/overrides/gtk/widget-class.ts.ejs +28 -0
- package/package.json +7 -6
- package/src/analysis/descriptor-render.ts +60 -16
- package/src/analysis/descriptor.ts +17 -3
- package/src/analysis/param-capability.ts +68 -5
- package/src/analysis/param-structure.ts +1 -1
- package/src/analysis/ts-type.ts +45 -11
- package/src/compile.ts +1 -1
- package/src/docs/api-reference.ts +20 -2
- package/src/docs/pipeline.ts +15 -1
- package/src/fingerprint.ts +151 -16
- package/src/gi.ts +48 -9
- package/src/gir/external-namespaces.ts +8 -0
- package/src/gir/finish-overrides.ts +5 -0
- package/src/gir/function.ts +52 -14
- package/src/gir/hidden-symbols.ts +39 -0
- package/src/gir/library.ts +36 -3
- package/src/gir/ucs4-overrides.ts +7 -0
- package/src/guards.ts +6 -1
- package/src/index.ts +2 -0
- package/src/jsx.ts +33 -8
- package/src/runner.ts +17 -3
- package/src/store/external-package-links.ts +226 -0
- package/src/store/gi/callable-doc.ts +8 -4
- package/src/store/gi/callables.ts +1 -1
- package/src/store/gi/class.ts +29 -0
- package/src/store/gi/constructor-props.ts +1 -1
- package/src/store/gi/function.ts +2 -1
- package/src/store/gi/generated-libraries.ts +91 -0
- package/src/store/gi/gtype-binding.ts +8 -1
- package/src/store/gi/method.ts +189 -36
- package/src/store/gi/param-marshal.ts +67 -4
- package/src/store/gi/record-constructor.ts +8 -3
- package/src/store/gi/record-field-accessor.ts +11 -2
- package/src/store/gi/runtime-override.ts +1 -1
- package/src/store/gi/signal.ts +2 -2
- package/src/store/gi/vtable.ts +118 -11
- package/src/store/gi-store.ts +48 -5
- package/src/store/jsx/jsx.ts +3 -1
- package/src/store/jsx/metadata.ts +46 -99
- package/src/store/jsx-store.ts +23 -7
- package/src/store/resolve-store.ts +3 -1
- package/src/store/store-fs.ts +10 -2
- package/src/writer/context.ts +11 -0
- package/src/writer/gtk-doc.ts +38 -1
- package/overrides/cairo/context.ts.ejs +0 -1269
- package/overrides/cairo/font-face.ts.ejs +0 -151
- package/overrides/cairo/font-options.ts.ejs +0 -199
- package/overrides/cairo/image-surface.ts.ejs +0 -132
- package/overrides/cairo/index.ts.ejs +0 -22
- package/overrides/cairo/matrix.ts.ejs +0 -171
- package/overrides/cairo/pattern.ts.ejs +0 -476
- package/overrides/cairo/recording-surface.ts.ejs +0 -102
- package/overrides/cairo/region.ts.ejs +0 -237
- package/overrides/cairo/scaled-font.ts.ejs +0 -330
- package/overrides/cairo/surface.ts.ejs +0 -296
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { type ExternalObject, getHandle, type Handle, t, wrapHandle } from "@gtkx/runtime";
|
|
2
|
-
import type { FontSlant, FontType, FontWeight, Status } from "../cairo.js";
|
|
3
|
-
import { FontFace } from "../cairo.js";
|
|
4
|
-
|
|
5
|
-
const { bind } = t;
|
|
6
|
-
const FONT_FACE_T = t.boxed("CairoFontFace", {
|
|
7
|
-
ownership: "borrowed",
|
|
8
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
9
|
-
getTypeFnName: "cairo_gobject_font_face_get_type",
|
|
10
|
-
});
|
|
11
|
-
const FC_PATTERN_T = t.boxed("FcPattern", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" });
|
|
12
|
-
const FT_FACE_T = t.boxed("FT_Face", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" });
|
|
13
|
-
|
|
14
|
-
declare module "../cairo.js" {
|
|
15
|
-
interface FontFace {
|
|
16
|
-
status(): Status;
|
|
17
|
-
getType(): FontType;
|
|
18
|
-
getReferenceCount(): number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
namespace FontFace {
|
|
22
|
-
function create(family: string, slant: FontSlant, weight: FontWeight): ToyFontFace;
|
|
23
|
-
function createForFtFace(face: ExternalObject<Handle>, loadFlags: number): FtFontFace;
|
|
24
|
-
function createForPattern(pattern: ExternalObject<Handle>): FtFontFace;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const cairoFontFaceStatus = bind("libcairo.so.2", "cairo_font_face_status", [FONT_FACE_T], t.int32);
|
|
29
|
-
FontFace.prototype.status = function (): Status {
|
|
30
|
-
return cairoFontFaceStatus(getHandle(this)) as Status;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const cairoFontFaceGetType = bind("libcairo.so.2", "cairo_font_face_get_type", [FONT_FACE_T], t.int32);
|
|
34
|
-
FontFace.prototype.getType = function (): FontType {
|
|
35
|
-
return cairoFontFaceGetType(getHandle(this)) as FontType;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const cairoFontFaceGetReferenceCount = bind(
|
|
39
|
-
"libcairo.so.2",
|
|
40
|
-
"cairo_font_face_get_reference_count",
|
|
41
|
-
[FONT_FACE_T],
|
|
42
|
-
t.int32,
|
|
43
|
-
);
|
|
44
|
-
FontFace.prototype.getReferenceCount = function (): number {
|
|
45
|
-
return cairoFontFaceGetReferenceCount(getHandle(this)) as number;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const cairoToyFontFaceGetFamily = bind(
|
|
49
|
-
"libcairo.so.2",
|
|
50
|
-
"cairo_toy_font_face_get_family",
|
|
51
|
-
[FONT_FACE_T],
|
|
52
|
-
t.string("borrowed"),
|
|
53
|
-
);
|
|
54
|
-
const cairoToyFontFaceGetSlant = bind("libcairo.so.2", "cairo_toy_font_face_get_slant", [FONT_FACE_T], t.int32);
|
|
55
|
-
const cairoToyFontFaceGetWeight = bind("libcairo.so.2", "cairo_toy_font_face_get_weight", [FONT_FACE_T], t.int32);
|
|
56
|
-
const cairoFtFontFaceGetSynthesize = bind("libcairo.so.2", "cairo_ft_font_face_get_synthesize", [FONT_FACE_T], t.int32);
|
|
57
|
-
const cairoFtFontFaceSetSynthesize = bind(
|
|
58
|
-
"libcairo.so.2",
|
|
59
|
-
"cairo_ft_font_face_set_synthesize",
|
|
60
|
-
[FONT_FACE_T, t.int32],
|
|
61
|
-
t.void,
|
|
62
|
-
);
|
|
63
|
-
const cairoFtFontFaceUnsetSynthesize = bind(
|
|
64
|
-
"libcairo.so.2",
|
|
65
|
-
"cairo_ft_font_face_unset_synthesize",
|
|
66
|
-
[FONT_FACE_T, t.int32],
|
|
67
|
-
t.void,
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
export class ToyFontFace extends FontFace {
|
|
71
|
-
getFamily(): string {
|
|
72
|
-
return cairoToyFontFaceGetFamily(getHandle(this)) as string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getSlant(): FontSlant {
|
|
76
|
-
return cairoToyFontFaceGetSlant(getHandle(this)) as FontSlant;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getWeight(): FontWeight {
|
|
80
|
-
return cairoToyFontFaceGetWeight(getHandle(this)) as FontWeight;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export enum FtSynthesize {
|
|
85
|
-
BOLD = 1,
|
|
86
|
-
OBLIQUE = 2,
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export class FtFontFace extends FontFace {
|
|
90
|
-
getSynthesize(): FtSynthesize {
|
|
91
|
-
return cairoFtFontFaceGetSynthesize(getHandle(this)) as FtSynthesize;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setSynthesize(synthFlags: FtSynthesize): void {
|
|
95
|
-
cairoFtFontFaceSetSynthesize(getHandle(this), synthFlags);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
unsetSynthesize(synthFlags: FtSynthesize): void {
|
|
99
|
-
cairoFtFontFaceUnsetSynthesize(getHandle(this), synthFlags);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
type FontFaceStatic = {
|
|
104
|
-
create(family: string, slant: FontSlant, weight: FontWeight): ToyFontFace;
|
|
105
|
-
createForFtFace(face: ExternalObject<Handle>, loadFlags: number): FtFontFace;
|
|
106
|
-
createForPattern(pattern: ExternalObject<Handle>): FtFontFace;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const FontFaceWithStatics = FontFace as typeof FontFace & FontFaceStatic;
|
|
110
|
-
|
|
111
|
-
const cairoToyFontFaceCreate = bind(
|
|
112
|
-
"libcairo.so.2",
|
|
113
|
-
"cairo_toy_font_face_create",
|
|
114
|
-
[t.string("full"), t.int32, t.int32],
|
|
115
|
-
t.boxed("CairoFontFace", {
|
|
116
|
-
ownership: "full",
|
|
117
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
118
|
-
getTypeFnName: "cairo_gobject_font_face_get_type",
|
|
119
|
-
}),
|
|
120
|
-
);
|
|
121
|
-
FontFaceWithStatics.create = (family: string, slant: FontSlant, weight: FontWeight): ToyFontFace => {
|
|
122
|
-
return wrapHandle(cairoToyFontFaceCreate(family, slant, weight) as ExternalObject<Handle>, ToyFontFace);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const cairoFtFontFaceCreateForFtFace = bind(
|
|
126
|
-
"libcairo.so.2",
|
|
127
|
-
"cairo_ft_font_face_create_for_ft_face",
|
|
128
|
-
[FT_FACE_T, t.int32],
|
|
129
|
-
t.boxed("CairoFontFace", {
|
|
130
|
-
ownership: "full",
|
|
131
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
132
|
-
getTypeFnName: "cairo_gobject_font_face_get_type",
|
|
133
|
-
}),
|
|
134
|
-
);
|
|
135
|
-
FontFaceWithStatics.createForFtFace = (face: ExternalObject<Handle>, loadFlags: number): FtFontFace => {
|
|
136
|
-
return wrapHandle(cairoFtFontFaceCreateForFtFace(face, loadFlags) as ExternalObject<Handle>, FtFontFace);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const cairoFtFontFaceCreateForPattern = bind(
|
|
140
|
-
"libcairo.so.2",
|
|
141
|
-
"cairo_ft_font_face_create_for_pattern",
|
|
142
|
-
[FC_PATTERN_T],
|
|
143
|
-
t.boxed("CairoFontFace", {
|
|
144
|
-
ownership: "full",
|
|
145
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
146
|
-
getTypeFnName: "cairo_gobject_font_face_get_type",
|
|
147
|
-
}),
|
|
148
|
-
);
|
|
149
|
-
FontFaceWithStatics.createForPattern = (pattern: ExternalObject<Handle>): FtFontFace => {
|
|
150
|
-
return wrapHandle(cairoFtFontFaceCreateForPattern(pattern) as ExternalObject<Handle>, FtFontFace);
|
|
151
|
-
};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { type ExternalObject, getHandle, type Handle, setHandle, t } from "@gtkx/runtime";
|
|
2
|
-
import type { Antialias, HintMetrics, HintStyle, Status, SubpixelOrder } from "../cairo.js";
|
|
3
|
-
import { FontOptions } from "../cairo.js";
|
|
4
|
-
|
|
5
|
-
const { bind } = t;
|
|
6
|
-
const FONT_OPTIONS_T = t.boxed("CairoFontOptions", {
|
|
7
|
-
ownership: "borrowed",
|
|
8
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
9
|
-
getTypeFnName: "cairo_gobject_font_options_get_type",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
declare module "../cairo.js" {
|
|
13
|
-
interface FontOptions {
|
|
14
|
-
setHintStyle(hintStyle: HintStyle): void;
|
|
15
|
-
getHintStyle(): HintStyle;
|
|
16
|
-
setAntialias(antialias: Antialias): void;
|
|
17
|
-
getAntialias(): Antialias;
|
|
18
|
-
setHintMetrics(hintMetrics: HintMetrics): void;
|
|
19
|
-
getHintMetrics(): HintMetrics;
|
|
20
|
-
setSubpixelOrder(subpixelOrder: SubpixelOrder): void;
|
|
21
|
-
getSubpixelOrder(): SubpixelOrder;
|
|
22
|
-
equal(other: FontOptions): boolean;
|
|
23
|
-
merge(other: FontOptions): void;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const cairoFontOptionsCreate = bind(
|
|
28
|
-
"libcairo.so.2",
|
|
29
|
-
"cairo_font_options_create",
|
|
30
|
-
[],
|
|
31
|
-
t.boxed("CairoFontOptions", {
|
|
32
|
-
ownership: "full",
|
|
33
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
34
|
-
getTypeFnName: "cairo_gobject_font_options_get_type",
|
|
35
|
-
}),
|
|
36
|
-
);
|
|
37
|
-
const cairoFontOptionsCopy = bind(
|
|
38
|
-
"libcairo.so.2",
|
|
39
|
-
"cairo_font_options_copy",
|
|
40
|
-
[FONT_OPTIONS_T],
|
|
41
|
-
t.boxed("CairoFontOptions", {
|
|
42
|
-
ownership: "full",
|
|
43
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
44
|
-
getTypeFnName: "cairo_gobject_font_options_get_type",
|
|
45
|
-
}),
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
class FontOptionsImpl extends FontOptions {
|
|
49
|
-
constructor(other?: FontOptions) {
|
|
50
|
-
super();
|
|
51
|
-
const handle = other === undefined ? cairoFontOptionsCreate() : cairoFontOptionsCopy(getHandle(other));
|
|
52
|
-
setHandle(this, handle as ExternalObject<Handle>);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static create(): FontOptionsImpl {
|
|
56
|
-
return new FontOptionsImpl();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { FontOptionsImpl as FontOptions };
|
|
61
|
-
|
|
62
|
-
const cairoFontOptionsSetHintStyle = bind(
|
|
63
|
-
"libcairo.so.2",
|
|
64
|
-
"cairo_font_options_set_hint_style",
|
|
65
|
-
[FONT_OPTIONS_T, t.int32],
|
|
66
|
-
t.void,
|
|
67
|
-
);
|
|
68
|
-
FontOptions.prototype.setHintStyle = function (hintStyle: HintStyle): void {
|
|
69
|
-
cairoFontOptionsSetHintStyle(getHandle(this), hintStyle);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const cairoFontOptionsGetHintStyle = bind(
|
|
73
|
-
"libcairo.so.2",
|
|
74
|
-
"cairo_font_options_get_hint_style",
|
|
75
|
-
[FONT_OPTIONS_T],
|
|
76
|
-
t.int32,
|
|
77
|
-
);
|
|
78
|
-
FontOptions.prototype.getHintStyle = function (): HintStyle {
|
|
79
|
-
return cairoFontOptionsGetHintStyle(getHandle(this)) as HintStyle;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const cairoFontOptionsSetAntialias = bind(
|
|
83
|
-
"libcairo.so.2",
|
|
84
|
-
"cairo_font_options_set_antialias",
|
|
85
|
-
[FONT_OPTIONS_T, t.int32],
|
|
86
|
-
t.void,
|
|
87
|
-
);
|
|
88
|
-
FontOptions.prototype.setAntialias = function (antialias: Antialias): void {
|
|
89
|
-
cairoFontOptionsSetAntialias(getHandle(this), antialias);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const cairoFontOptionsGetAntialias = bind(
|
|
93
|
-
"libcairo.so.2",
|
|
94
|
-
"cairo_font_options_get_antialias",
|
|
95
|
-
[FONT_OPTIONS_T],
|
|
96
|
-
t.int32,
|
|
97
|
-
);
|
|
98
|
-
FontOptions.prototype.getAntialias = function (): Antialias {
|
|
99
|
-
return cairoFontOptionsGetAntialias(getHandle(this)) as Antialias;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const cairoFontOptionsSetHintMetrics = bind(
|
|
103
|
-
"libcairo.so.2",
|
|
104
|
-
"cairo_font_options_set_hint_metrics",
|
|
105
|
-
[FONT_OPTIONS_T, t.int32],
|
|
106
|
-
t.void,
|
|
107
|
-
);
|
|
108
|
-
FontOptions.prototype.setHintMetrics = function (hintMetrics: HintMetrics): void {
|
|
109
|
-
cairoFontOptionsSetHintMetrics(getHandle(this), hintMetrics);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const cairoFontOptionsGetHintMetrics = bind(
|
|
113
|
-
"libcairo.so.2",
|
|
114
|
-
"cairo_font_options_get_hint_metrics",
|
|
115
|
-
[FONT_OPTIONS_T],
|
|
116
|
-
t.int32,
|
|
117
|
-
);
|
|
118
|
-
FontOptions.prototype.getHintMetrics = function (): HintMetrics {
|
|
119
|
-
return cairoFontOptionsGetHintMetrics(getHandle(this)) as HintMetrics;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const cairoFontOptionsSetSubpixelOrder = bind(
|
|
123
|
-
"libcairo.so.2",
|
|
124
|
-
"cairo_font_options_set_subpixel_order",
|
|
125
|
-
[FONT_OPTIONS_T, t.int32],
|
|
126
|
-
t.void,
|
|
127
|
-
);
|
|
128
|
-
FontOptions.prototype.setSubpixelOrder = function (subpixelOrder: SubpixelOrder): void {
|
|
129
|
-
cairoFontOptionsSetSubpixelOrder(getHandle(this), subpixelOrder);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const cairoFontOptionsGetSubpixelOrder = bind(
|
|
133
|
-
"libcairo.so.2",
|
|
134
|
-
"cairo_font_options_get_subpixel_order",
|
|
135
|
-
[FONT_OPTIONS_T],
|
|
136
|
-
t.int32,
|
|
137
|
-
);
|
|
138
|
-
FontOptions.prototype.getSubpixelOrder = function (): SubpixelOrder {
|
|
139
|
-
return cairoFontOptionsGetSubpixelOrder(getHandle(this)) as SubpixelOrder;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const cairoFontOptionsEqual = bind(
|
|
143
|
-
"libcairo.so.2",
|
|
144
|
-
"cairo_font_options_equal",
|
|
145
|
-
[FONT_OPTIONS_T, FONT_OPTIONS_T],
|
|
146
|
-
t.boolean,
|
|
147
|
-
);
|
|
148
|
-
FontOptions.prototype.equal = function (other: FontOptions): boolean {
|
|
149
|
-
return cairoFontOptionsEqual(getHandle(this), getHandle(other)) as boolean;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const cairoFontOptionsMerge = bind(
|
|
153
|
-
"libcairo.so.2",
|
|
154
|
-
"cairo_font_options_merge",
|
|
155
|
-
[FONT_OPTIONS_T, FONT_OPTIONS_T],
|
|
156
|
-
t.void,
|
|
157
|
-
);
|
|
158
|
-
FontOptions.prototype.merge = function (other: FontOptions): void {
|
|
159
|
-
cairoFontOptionsMerge(getHandle(this), getHandle(other));
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
declare module "../cairo.js" {
|
|
163
|
-
interface FontOptions {
|
|
164
|
-
status(): Status;
|
|
165
|
-
hash(): number;
|
|
166
|
-
setVariations(variations: string): void;
|
|
167
|
-
getVariations(): string;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const cairoFontOptionsStatus = bind("libcairo.so.2", "cairo_font_options_status", [FONT_OPTIONS_T], t.int32);
|
|
172
|
-
FontOptions.prototype.status = function (): Status {
|
|
173
|
-
return cairoFontOptionsStatus(getHandle(this)) as Status;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
const cairoFontOptionsHash = bind("libcairo.so.2", "cairo_font_options_hash", [FONT_OPTIONS_T], t.uint64);
|
|
177
|
-
FontOptions.prototype.hash = function (): number {
|
|
178
|
-
return cairoFontOptionsHash(getHandle(this)) as number;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const cairoFontOptionsSetVariations = bind(
|
|
182
|
-
"libcairo.so.2",
|
|
183
|
-
"cairo_font_options_set_variations",
|
|
184
|
-
[FONT_OPTIONS_T, t.string("full")],
|
|
185
|
-
t.void,
|
|
186
|
-
);
|
|
187
|
-
FontOptions.prototype.setVariations = function (variations: string): void {
|
|
188
|
-
cairoFontOptionsSetVariations(getHandle(this), variations);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const cairoFontOptionsGetVariations = bind(
|
|
192
|
-
"libcairo.so.2",
|
|
193
|
-
"cairo_font_options_get_variations",
|
|
194
|
-
[FONT_OPTIONS_T],
|
|
195
|
-
t.string("borrowed"),
|
|
196
|
-
);
|
|
197
|
-
FontOptions.prototype.getVariations = function (): string {
|
|
198
|
-
return cairoFontOptionsGetVariations(getHandle(this)) as string;
|
|
199
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { type ExternalObject, getHandle, type Handle, read, setHandle, t, wrapHandle } from "@gtkx/runtime";
|
|
2
|
-
import type { Format } from "../cairo.js";
|
|
3
|
-
import { Surface } from "../cairo.js";
|
|
4
|
-
|
|
5
|
-
const { bind } = t;
|
|
6
|
-
|
|
7
|
-
const cairoImageSurfaceCreate = bind(
|
|
8
|
-
"libcairo.so.2",
|
|
9
|
-
"cairo_image_surface_create",
|
|
10
|
-
[t.int32, t.int32, t.int32],
|
|
11
|
-
t.boxed("CairoSurface", {
|
|
12
|
-
ownership: "full",
|
|
13
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
14
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
15
|
-
}),
|
|
16
|
-
);
|
|
17
|
-
const cairoImageSurfaceCreateFromPng = bind(
|
|
18
|
-
"libcairo.so.2",
|
|
19
|
-
"cairo_image_surface_create_from_png",
|
|
20
|
-
[t.string("full")],
|
|
21
|
-
t.boxed("CairoSurface", {
|
|
22
|
-
ownership: "full",
|
|
23
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
24
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
const cairoImageSurfaceGetWidth = bind(
|
|
28
|
-
"libcairo.so.2",
|
|
29
|
-
"cairo_image_surface_get_width",
|
|
30
|
-
[
|
|
31
|
-
t.boxed("CairoSurface", {
|
|
32
|
-
ownership: "borrowed",
|
|
33
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
34
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
|
-
t.int32,
|
|
38
|
-
);
|
|
39
|
-
const cairoImageSurfaceGetHeight = bind(
|
|
40
|
-
"libcairo.so.2",
|
|
41
|
-
"cairo_image_surface_get_height",
|
|
42
|
-
[
|
|
43
|
-
t.boxed("CairoSurface", {
|
|
44
|
-
ownership: "borrowed",
|
|
45
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
46
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
47
|
-
}),
|
|
48
|
-
],
|
|
49
|
-
t.int32,
|
|
50
|
-
);
|
|
51
|
-
const cairoImageSurfaceGetFormat = bind(
|
|
52
|
-
"libcairo.so.2",
|
|
53
|
-
"cairo_image_surface_get_format",
|
|
54
|
-
[
|
|
55
|
-
t.boxed("CairoSurface", {
|
|
56
|
-
ownership: "borrowed",
|
|
57
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
58
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
59
|
-
}),
|
|
60
|
-
],
|
|
61
|
-
t.int32,
|
|
62
|
-
);
|
|
63
|
-
const cairoImageSurfaceGetStride = bind(
|
|
64
|
-
"libcairo.so.2",
|
|
65
|
-
"cairo_image_surface_get_stride",
|
|
66
|
-
[
|
|
67
|
-
t.boxed("CairoSurface", {
|
|
68
|
-
ownership: "borrowed",
|
|
69
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
70
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
71
|
-
}),
|
|
72
|
-
],
|
|
73
|
-
t.int32,
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
export class ImageSurface extends Surface {
|
|
77
|
-
constructor(format: Format, width: number, height: number) {
|
|
78
|
-
super();
|
|
79
|
-
setHandle(this, cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
static create(format: Format, width: number, height: number): ImageSurface {
|
|
83
|
-
return wrapHandle(cairoImageSurfaceCreate(format, width, height) as ExternalObject<Handle>, ImageSurface);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static createFromPng(filename: string): ImageSurface {
|
|
87
|
-
return wrapHandle(cairoImageSurfaceCreateFromPng(filename) as ExternalObject<Handle>, ImageSurface);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
getWidth(): number {
|
|
91
|
-
return cairoImageSurfaceGetWidth(getHandle(this)) as number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
getHeight(): number {
|
|
95
|
-
return cairoImageSurfaceGetHeight(getHandle(this)) as number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getFormat(): Format {
|
|
99
|
-
return cairoImageSurfaceGetFormat(getHandle(this)) as Format;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getStride(): number {
|
|
103
|
-
return cairoImageSurfaceGetStride(getHandle(this)) as number;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getData(): Uint8Array {
|
|
107
|
-
this.flush();
|
|
108
|
-
const stride = this.getStride();
|
|
109
|
-
const height = this.getHeight();
|
|
110
|
-
const totalBytes = stride * height;
|
|
111
|
-
if (totalBytes === 0) return new Uint8Array(0);
|
|
112
|
-
const getImageData = bind(
|
|
113
|
-
"libcairo.so.2",
|
|
114
|
-
"cairo_image_surface_get_data",
|
|
115
|
-
[
|
|
116
|
-
t.boxed("CairoSurface", {
|
|
117
|
-
ownership: "borrowed",
|
|
118
|
-
sharedLibrary: "libcairo-gobject.so.2",
|
|
119
|
-
getTypeFnName: "cairo_gobject_surface_get_type",
|
|
120
|
-
}),
|
|
121
|
-
],
|
|
122
|
-
t.struct("borrowed", { size: totalBytes }),
|
|
123
|
-
);
|
|
124
|
-
const ptr = getImageData(getHandle(this)) as ExternalObject<Handle> | null;
|
|
125
|
-
if (ptr === null) return new Uint8Array(0);
|
|
126
|
-
const result = new Uint8Array(totalBytes);
|
|
127
|
-
for (let i = 0; i < totalBytes; i++) {
|
|
128
|
-
result[i] = read(ptr, t.uint8, i) as number;
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export * from "./cairo.js";
|
|
2
|
-
|
|
3
|
-
import "./overrides/font-face.js";
|
|
4
|
-
import "./overrides/scaled-font.js";
|
|
5
|
-
import "./overrides/surface.js";
|
|
6
|
-
|
|
7
|
-
export type { CairoGlyph, CairoTextCluster, PathData } from "./overrides/context.js";
|
|
8
|
-
export {
|
|
9
|
-
Context,
|
|
10
|
-
type FontExtents,
|
|
11
|
-
statusToString,
|
|
12
|
-
type TextExtents,
|
|
13
|
-
version,
|
|
14
|
-
versionString,
|
|
15
|
-
} from "./overrides/context.js";
|
|
16
|
-
export { FtFontFace, FtSynthesize, ToyFontFace } from "./overrides/font-face.js";
|
|
17
|
-
export { FontOptions } from "./overrides/font-options.js";
|
|
18
|
-
export { ImageSurface } from "./overrides/image-surface.js";
|
|
19
|
-
export { Matrix } from "./overrides/matrix.js";
|
|
20
|
-
export { LinearPattern, MeshPattern, RadialPattern } from "./overrides/pattern.js";
|
|
21
|
-
export { RecordingSurface } from "./overrides/recording-surface.js";
|
|
22
|
-
export { Region } from "./overrides/region.js";
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { alloc, type ExternalObject, getHandle, type Handle, setHandle, t, wrapHandle } from "@gtkx/runtime";
|
|
2
|
-
import type { Status } from "../cairo.js";
|
|
3
|
-
|
|
4
|
-
const { bind } = t;
|
|
5
|
-
|
|
6
|
-
export const allocMatrix = (): { handle: ExternalObject<Handle>; obj: Matrix } => {
|
|
7
|
-
const handle = alloc(48);
|
|
8
|
-
const obj = wrapHandle(handle, Matrix);
|
|
9
|
-
return { handle, obj };
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const cairoMatrixTranslate = bind(
|
|
13
|
-
"libcairo.so.2",
|
|
14
|
-
"cairo_matrix_translate",
|
|
15
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64, t.float64],
|
|
16
|
-
t.void,
|
|
17
|
-
);
|
|
18
|
-
const cairoMatrixScale = bind(
|
|
19
|
-
"libcairo.so.2",
|
|
20
|
-
"cairo_matrix_scale",
|
|
21
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64, t.float64],
|
|
22
|
-
t.void,
|
|
23
|
-
);
|
|
24
|
-
const cairoMatrixRotate = bind(
|
|
25
|
-
"libcairo.so.2",
|
|
26
|
-
"cairo_matrix_rotate",
|
|
27
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64],
|
|
28
|
-
t.void,
|
|
29
|
-
);
|
|
30
|
-
const cairoMatrixInvert = bind(
|
|
31
|
-
"libcairo.so.2",
|
|
32
|
-
"cairo_matrix_invert",
|
|
33
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" })],
|
|
34
|
-
t.int32,
|
|
35
|
-
);
|
|
36
|
-
const cairoMatrixMultiply = bind(
|
|
37
|
-
"libcairo.so.2",
|
|
38
|
-
"cairo_matrix_multiply",
|
|
39
|
-
[
|
|
40
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
41
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
42
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
43
|
-
],
|
|
44
|
-
t.void,
|
|
45
|
-
);
|
|
46
|
-
const cairoMatrixTransformPoint = bind(
|
|
47
|
-
"libcairo.so.2",
|
|
48
|
-
"cairo_matrix_transform_point",
|
|
49
|
-
[
|
|
50
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
51
|
-
t.ref(t.float64),
|
|
52
|
-
t.ref(t.float64),
|
|
53
|
-
],
|
|
54
|
-
t.void,
|
|
55
|
-
);
|
|
56
|
-
const cairoMatrixTransformDistance = bind(
|
|
57
|
-
"libcairo.so.2",
|
|
58
|
-
"cairo_matrix_transform_distance",
|
|
59
|
-
[
|
|
60
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
61
|
-
t.ref(t.float64),
|
|
62
|
-
t.ref(t.float64),
|
|
63
|
-
],
|
|
64
|
-
t.void,
|
|
65
|
-
);
|
|
66
|
-
const cairoMatrixInitIdentity = bind(
|
|
67
|
-
"libcairo.so.2",
|
|
68
|
-
"cairo_matrix_init_identity",
|
|
69
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" })],
|
|
70
|
-
t.void,
|
|
71
|
-
);
|
|
72
|
-
const cairoMatrixInitTranslate = bind(
|
|
73
|
-
"libcairo.so.2",
|
|
74
|
-
"cairo_matrix_init_translate",
|
|
75
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64, t.float64],
|
|
76
|
-
t.void,
|
|
77
|
-
);
|
|
78
|
-
const cairoMatrixInitScale = bind(
|
|
79
|
-
"libcairo.so.2",
|
|
80
|
-
"cairo_matrix_init_scale",
|
|
81
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64, t.float64],
|
|
82
|
-
t.void,
|
|
83
|
-
);
|
|
84
|
-
const cairoMatrixInitRotate = bind(
|
|
85
|
-
"libcairo.so.2",
|
|
86
|
-
"cairo_matrix_init_rotate",
|
|
87
|
-
[t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }), t.float64],
|
|
88
|
-
t.void,
|
|
89
|
-
);
|
|
90
|
-
const cairoMatrixInit = bind(
|
|
91
|
-
"libcairo.so.2",
|
|
92
|
-
"cairo_matrix_init",
|
|
93
|
-
[
|
|
94
|
-
t.boxed("cairo_matrix_t", { ownership: "borrowed", sharedLibrary: "libcairo.so.2" }),
|
|
95
|
-
t.float64,
|
|
96
|
-
t.float64,
|
|
97
|
-
t.float64,
|
|
98
|
-
t.float64,
|
|
99
|
-
t.float64,
|
|
100
|
-
t.float64,
|
|
101
|
-
],
|
|
102
|
-
t.void,
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export class Matrix {
|
|
106
|
-
constructor(xx: number, yx: number, xy: number, yy: number, x0: number, y0: number) {
|
|
107
|
-
const handle = alloc(48);
|
|
108
|
-
setHandle(this, handle);
|
|
109
|
-
cairoMatrixInit(handle, xx, yx, xy, yy, x0, y0);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
translate(tx: number, ty: number): void {
|
|
113
|
-
cairoMatrixTranslate(getHandle(this), tx, ty);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
scale(sx: number, sy: number): void {
|
|
117
|
-
cairoMatrixScale(getHandle(this), sx, sy);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
rotate(radians: number): void {
|
|
121
|
-
cairoMatrixRotate(getHandle(this), radians);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
invert(): Status {
|
|
125
|
-
return cairoMatrixInvert(getHandle(this)) as Status;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
transformPoint(x: number, y: number): { x: number; y: number } {
|
|
129
|
-
const xRef = { value: x };
|
|
130
|
-
const yRef = { value: y };
|
|
131
|
-
cairoMatrixTransformPoint(getHandle(this), xRef, yRef);
|
|
132
|
-
return { x: xRef.value, y: yRef.value };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
transformDistance(dx: number, dy: number): { dx: number; dy: number } {
|
|
136
|
-
const dxRef = { value: dx };
|
|
137
|
-
const dyRef = { value: dy };
|
|
138
|
-
cairoMatrixTransformDistance(getHandle(this), dxRef, dyRef);
|
|
139
|
-
return { dx: dxRef.value, dy: dyRef.value };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
static initIdentity(): Matrix {
|
|
143
|
-
const { handle, obj } = allocMatrix();
|
|
144
|
-
cairoMatrixInitIdentity(handle);
|
|
145
|
-
return obj;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
static initTranslate(tx: number, ty: number): Matrix {
|
|
149
|
-
const { handle, obj } = allocMatrix();
|
|
150
|
-
cairoMatrixInitTranslate(handle, tx, ty);
|
|
151
|
-
return obj;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
static initScale(sx: number, sy: number): Matrix {
|
|
155
|
-
const { handle, obj } = allocMatrix();
|
|
156
|
-
cairoMatrixInitScale(handle, sx, sy);
|
|
157
|
-
return obj;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
static initRotate(radians: number): Matrix {
|
|
161
|
-
const { handle, obj } = allocMatrix();
|
|
162
|
-
cairoMatrixInitRotate(handle, radians);
|
|
163
|
-
return obj;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
static multiply(a: Matrix, b: Matrix): Matrix {
|
|
167
|
-
const { handle, obj } = allocMatrix();
|
|
168
|
-
cairoMatrixMultiply(handle, getHandle(a), getHandle(b));
|
|
169
|
-
return obj;
|
|
170
|
-
}
|
|
171
|
-
}
|