@girs/gjs 4.0.1 → 4.0.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/README.md +1 -1
- package/cairo.d.ts +168 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.
|
|
7
|
+
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.2.
|
|
8
8
|
|
|
9
9
|
[GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
|
|
10
10
|
|
package/cairo.d.ts
CHANGED
|
@@ -242,6 +242,16 @@ declare namespace giCairo {
|
|
|
242
242
|
*/
|
|
243
243
|
getTarget(): Surface;
|
|
244
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Returns the current destination surface for the group being
|
|
247
|
+
* built — set by the most recent {@link pushGroup} /
|
|
248
|
+
* {@link pushGroupWithContent} that has not been
|
|
249
|
+
* {@link popGroup}-ed.
|
|
250
|
+
*
|
|
251
|
+
* Source: gjs/modules/cairo-context.cpp `getGroupTarget_func`.
|
|
252
|
+
*/
|
|
253
|
+
getGroupTarget(): Surface;
|
|
254
|
+
|
|
245
255
|
/**
|
|
246
256
|
* Gets the current tolerance value
|
|
247
257
|
* @returns The current tolerance value
|
|
@@ -621,6 +631,15 @@ declare namespace giCairo {
|
|
|
621
631
|
*/
|
|
622
632
|
copyPath(): Path;
|
|
623
633
|
|
|
634
|
+
/**
|
|
635
|
+
* Returns a flattened copy of the current path — curves are
|
|
636
|
+
* approximated by straight-line segments according to the
|
|
637
|
+
* current tolerance.
|
|
638
|
+
*
|
|
639
|
+
* Source: gjs/modules/cairo-context.cpp `copyPathFlat_func`.
|
|
640
|
+
*/
|
|
641
|
+
copyPathFlat(): Path;
|
|
642
|
+
|
|
624
643
|
/**
|
|
625
644
|
* Appends a path to the current path
|
|
626
645
|
* @param path A path to append
|
|
@@ -668,6 +687,24 @@ declare namespace giCairo {
|
|
|
668
687
|
*/
|
|
669
688
|
finish(): void;
|
|
670
689
|
|
|
690
|
+
/**
|
|
691
|
+
* Surface type (image, PDF, PostScript, SVG, …) — the runtime kind
|
|
692
|
+
* regardless of static class.
|
|
693
|
+
*
|
|
694
|
+
* Source: gjs/modules/cairo-surface.cpp `getType_func`.
|
|
695
|
+
*/
|
|
696
|
+
getType(): SurfaceType;
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Write the surface's contents out to a PNG file. Only meaningful
|
|
700
|
+
* for image-backed surfaces (returns CAIRO_STATUS_WRITE_ERROR on
|
|
701
|
+
* non-image surfaces).
|
|
702
|
+
*
|
|
703
|
+
* Source: gjs/modules/cairo-surface.cpp `writeToPNG_func`.
|
|
704
|
+
* @param filename Output PNG path
|
|
705
|
+
*/
|
|
706
|
+
writeToPNG(filename: string): void;
|
|
707
|
+
|
|
671
708
|
/**
|
|
672
709
|
* Attaches user data to the surface (C API: cairo_surface_set_user_data)
|
|
673
710
|
* @param key Key for the user data
|
|
@@ -721,6 +758,16 @@ declare namespace giCairo {
|
|
|
721
758
|
*/
|
|
722
759
|
getHeight(): number;
|
|
723
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Number of bytes between the start of one row and the start of
|
|
763
|
+
* the next, rounded up to a Cairo-imposed alignment boundary.
|
|
764
|
+
* Useful when reading the surface's raw pixel buffer.
|
|
765
|
+
*
|
|
766
|
+
* Source: gjs/modules/cairo-image-surface.cpp `getStride_func`.
|
|
767
|
+
* @returns Row stride in bytes
|
|
768
|
+
*/
|
|
769
|
+
getStride(): number;
|
|
770
|
+
|
|
724
771
|
/**
|
|
725
772
|
* Writes the contents of the surface to a PNG file
|
|
726
773
|
* @param filename Path to the PNG file to write
|
|
@@ -771,6 +818,12 @@ declare namespace giCairo {
|
|
|
771
818
|
* Base class for all Cairo patterns
|
|
772
819
|
*/
|
|
773
820
|
export class Pattern extends Cairo.Pattern {
|
|
821
|
+
/**
|
|
822
|
+
* Get the pattern's type (Solid, Surface, Linear, Radial, Mesh, …).
|
|
823
|
+
*
|
|
824
|
+
* Source: gjs/modules/cairo-pattern.cpp `getType_func`.
|
|
825
|
+
*/
|
|
826
|
+
getType(): PatternType;
|
|
774
827
|
}
|
|
775
828
|
|
|
776
829
|
/**
|
|
@@ -836,6 +889,39 @@ declare namespace giCairo {
|
|
|
836
889
|
* @param surface The surface to use
|
|
837
890
|
*/
|
|
838
891
|
constructor(surface: Surface);
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Sets the mode to be used for drawing outside the area of this
|
|
895
|
+
* pattern. By default the {@link Extend.NONE} mode is used (a
|
|
896
|
+
* transparent pixel) for surface patterns and
|
|
897
|
+
* {@link Extend.PAD} for gradients.
|
|
898
|
+
*
|
|
899
|
+
* Source: gjs/modules/cairo-surface-pattern.cpp `setExtend_func`.
|
|
900
|
+
* @param extend The extend mode
|
|
901
|
+
*/
|
|
902
|
+
setExtend(extend: Extend): void;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Get the current extend mode for this pattern.
|
|
906
|
+
*
|
|
907
|
+
* Source: gjs/modules/cairo-surface-pattern.cpp `getExtend_func`.
|
|
908
|
+
*/
|
|
909
|
+
getExtend(): Extend;
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Set the filter to be used for resizing when using this pattern.
|
|
913
|
+
*
|
|
914
|
+
* Source: gjs/modules/cairo-surface-pattern.cpp `setFilter_func`.
|
|
915
|
+
* @param filter The filter
|
|
916
|
+
*/
|
|
917
|
+
setFilter(filter: Filter): void;
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Get the current filter for this pattern.
|
|
921
|
+
*
|
|
922
|
+
* Source: gjs/modules/cairo-surface-pattern.cpp `getFilter_func`.
|
|
923
|
+
*/
|
|
924
|
+
getFilter(): Filter;
|
|
839
925
|
}
|
|
840
926
|
|
|
841
927
|
/**
|
|
@@ -875,9 +961,89 @@ declare namespace giCairo {
|
|
|
875
961
|
export class RectangleInt extends Cairo.RectangleInt {}
|
|
876
962
|
|
|
877
963
|
/**
|
|
878
|
-
* A region object used for representing a set of pixels
|
|
964
|
+
* A region object used for representing a set of pixels.
|
|
965
|
+
*
|
|
966
|
+
* Constructor takes no arguments — Cairo regions start empty and grow
|
|
967
|
+
* via {@link unionRectangle} / {@link union}. Source:
|
|
968
|
+
* gjs/modules/cairo-region.cpp `constructor_impl`.
|
|
879
969
|
*/
|
|
880
|
-
export class Region extends Cairo.Region {
|
|
970
|
+
export class Region extends Cairo.Region {
|
|
971
|
+
constructor();
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Number of disjoint rectangles in the region's decomposition.
|
|
975
|
+
* Source: cairo-region.cpp `num_rectangles_func`.
|
|
976
|
+
*/
|
|
977
|
+
numRectangles(): number;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Return the `i`-th rectangle in the region's decomposition.
|
|
981
|
+
* Throws if `i` is out of range.
|
|
982
|
+
* Source: cairo-region.cpp `get_rectangle_func`.
|
|
983
|
+
*/
|
|
984
|
+
getRectangle(i: number): RectangleInt;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Union this region with `other` in place (`this ← this ∪ other`).
|
|
988
|
+
* Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(union)`.
|
|
989
|
+
*/
|
|
990
|
+
union(other: Region): void;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Subtract `other` from this region in place (`this ← this ∖ other`).
|
|
994
|
+
* Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(subtract)`.
|
|
995
|
+
*/
|
|
996
|
+
subtract(other: Region): void;
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Intersect this region with `other` in place (`this ← this ∩ other`).
|
|
1000
|
+
* Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(intersect)`.
|
|
1001
|
+
*/
|
|
1002
|
+
intersect(other: Region): void;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Replace this region with the symmetric difference (`this ⊕ other`).
|
|
1006
|
+
* Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(xor)`.
|
|
1007
|
+
*/
|
|
1008
|
+
xor(other: Region): void;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Union a single rectangle into this region.
|
|
1012
|
+
* Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(union)`.
|
|
1013
|
+
*/
|
|
1014
|
+
unionRectangle(rect: RectangleInt): void;
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Subtract a single rectangle from this region.
|
|
1018
|
+
* Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(subtract)`.
|
|
1019
|
+
*/
|
|
1020
|
+
subtractRectangle(rect: RectangleInt): void;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Intersect this region with a rectangle.
|
|
1024
|
+
* Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(intersect)`.
|
|
1025
|
+
*/
|
|
1026
|
+
intersectRectangle(rect: RectangleInt): void;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Symmetric-difference this region with a rectangle.
|
|
1030
|
+
* Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(xor)`.
|
|
1031
|
+
*/
|
|
1032
|
+
xorRectangle(rect: RectangleInt): void;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Integer-coordinate rectangle — Cairo's `cairo_rectangle_int_t` JS
|
|
1037
|
+
* shape. Used by `Region` methods that read/write rectangle data.
|
|
1038
|
+
* Source: gjs/modules/cairo-region.cpp `fill_rectangle` reads these
|
|
1039
|
+
* four properties off the JS object.
|
|
1040
|
+
*/
|
|
1041
|
+
export interface RectangleInt {
|
|
1042
|
+
x: number;
|
|
1043
|
+
y: number;
|
|
1044
|
+
width: number;
|
|
1045
|
+
height: number;
|
|
1046
|
+
}
|
|
881
1047
|
|
|
882
1048
|
/**
|
|
883
1049
|
* A matrix object used for transforming coordinates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/gjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "GJS TypeScript type definitions for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gjs.js",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"test": "tsc --project tsconfig.json"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@girs/gobject-2.0": "2.88.0-4.0.
|
|
60
|
-
"@girs/glib-2.0": "2.88.0-4.0.
|
|
61
|
-
"@girs/gio-2.0": "2.88.0-4.0.
|
|
62
|
-
"@girs/cairo-1.0": "1.0.0-4.0.
|
|
59
|
+
"@girs/gobject-2.0": "2.88.0-4.0.2",
|
|
60
|
+
"@girs/glib-2.0": "2.88.0-4.0.2",
|
|
61
|
+
"@girs/gio-2.0": "2.88.0-4.0.2",
|
|
62
|
+
"@girs/cairo-1.0": "1.0.0-4.0.2" },
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"typescript": "*"
|
|
65
65
|
},
|