@ts-for-gir/templates 4.0.1 → 4.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/templates",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Templates for ts-for-gir",
5
5
  "type": "module",
6
6
  "main": "package.json",
@@ -247,6 +247,16 @@ import Cairo from '<%- Cairo.importPath %>';
247
247
  */
248
248
  getTarget(): Surface;
249
249
 
250
+ /**
251
+ * Returns the current destination surface for the group being
252
+ * built — set by the most recent {@link pushGroup} /
253
+ * {@link pushGroupWithContent} that has not been
254
+ * {@link popGroup}-ed.
255
+ *
256
+ * Source: gjs/modules/cairo-context.cpp `getGroupTarget_func`.
257
+ */
258
+ getGroupTarget(): Surface;
259
+
250
260
  /**
251
261
  * Gets the current tolerance value
252
262
  * @returns The current tolerance value
@@ -626,6 +636,15 @@ import Cairo from '<%- Cairo.importPath %>';
626
636
  */
627
637
  copyPath(): Path;
628
638
 
639
+ /**
640
+ * Returns a flattened copy of the current path — curves are
641
+ * approximated by straight-line segments according to the
642
+ * current tolerance.
643
+ *
644
+ * Source: gjs/modules/cairo-context.cpp `copyPathFlat_func`.
645
+ */
646
+ copyPathFlat(): Path;
647
+
629
648
  /**
630
649
  * Appends a path to the current path
631
650
  * @param path A path to append
@@ -673,6 +692,24 @@ import Cairo from '<%- Cairo.importPath %>';
673
692
  */
674
693
  finish(): void;
675
694
 
695
+ /**
696
+ * Surface type (image, PDF, PostScript, SVG, …) — the runtime kind
697
+ * regardless of static class.
698
+ *
699
+ * Source: gjs/modules/cairo-surface.cpp `getType_func`.
700
+ */
701
+ getType(): SurfaceType;
702
+
703
+ /**
704
+ * Write the surface's contents out to a PNG file. Only meaningful
705
+ * for image-backed surfaces (returns CAIRO_STATUS_WRITE_ERROR on
706
+ * non-image surfaces).
707
+ *
708
+ * Source: gjs/modules/cairo-surface.cpp `writeToPNG_func`.
709
+ * @param filename Output PNG path
710
+ */
711
+ writeToPNG(filename: string): void;
712
+
676
713
  /**
677
714
  * Attaches user data to the surface (C API: cairo_surface_set_user_data)
678
715
  * @param key Key for the user data
@@ -726,6 +763,16 @@ import Cairo from '<%- Cairo.importPath %>';
726
763
  */
727
764
  getHeight(): number;
728
765
 
766
+ /**
767
+ * Number of bytes between the start of one row and the start of
768
+ * the next, rounded up to a Cairo-imposed alignment boundary.
769
+ * Useful when reading the surface's raw pixel buffer.
770
+ *
771
+ * Source: gjs/modules/cairo-image-surface.cpp `getStride_func`.
772
+ * @returns Row stride in bytes
773
+ */
774
+ getStride(): number;
775
+
729
776
  /**
730
777
  * Writes the contents of the surface to a PNG file
731
778
  * @param filename Path to the PNG file to write
@@ -776,6 +823,12 @@ import Cairo from '<%- Cairo.importPath %>';
776
823
  * Base class for all Cairo patterns
777
824
  */
778
825
  export class Pattern extends Cairo.Pattern {
826
+ /**
827
+ * Get the pattern's type (Solid, Surface, Linear, Radial, Mesh, …).
828
+ *
829
+ * Source: gjs/modules/cairo-pattern.cpp `getType_func`.
830
+ */
831
+ getType(): PatternType;
779
832
  }
780
833
 
781
834
  /**
@@ -841,6 +894,39 @@ import Cairo from '<%- Cairo.importPath %>';
841
894
  * @param surface The surface to use
842
895
  */
843
896
  constructor(surface: Surface);
897
+
898
+ /**
899
+ * Sets the mode to be used for drawing outside the area of this
900
+ * pattern. By default the {@link Extend.NONE} mode is used (a
901
+ * transparent pixel) for surface patterns and
902
+ * {@link Extend.PAD} for gradients.
903
+ *
904
+ * Source: gjs/modules/cairo-surface-pattern.cpp `setExtend_func`.
905
+ * @param extend The extend mode
906
+ */
907
+ setExtend(extend: Extend): void;
908
+
909
+ /**
910
+ * Get the current extend mode for this pattern.
911
+ *
912
+ * Source: gjs/modules/cairo-surface-pattern.cpp `getExtend_func`.
913
+ */
914
+ getExtend(): Extend;
915
+
916
+ /**
917
+ * Set the filter to be used for resizing when using this pattern.
918
+ *
919
+ * Source: gjs/modules/cairo-surface-pattern.cpp `setFilter_func`.
920
+ * @param filter The filter
921
+ */
922
+ setFilter(filter: Filter): void;
923
+
924
+ /**
925
+ * Get the current filter for this pattern.
926
+ *
927
+ * Source: gjs/modules/cairo-surface-pattern.cpp `getFilter_func`.
928
+ */
929
+ getFilter(): Filter;
844
930
  }
845
931
 
846
932
  /**
@@ -880,9 +966,89 @@ import Cairo from '<%- Cairo.importPath %>';
880
966
  export class RectangleInt extends Cairo.RectangleInt {}
881
967
 
882
968
  /**
883
- * A region object used for representing a set of pixels
969
+ * A region object used for representing a set of pixels.
970
+ *
971
+ * Constructor takes no arguments — Cairo regions start empty and grow
972
+ * via {@link unionRectangle} / {@link union}. Source:
973
+ * gjs/modules/cairo-region.cpp `constructor_impl`.
884
974
  */
885
- export class Region extends Cairo.Region {}
975
+ export class Region extends Cairo.Region {
976
+ constructor();
977
+
978
+ /**
979
+ * Number of disjoint rectangles in the region's decomposition.
980
+ * Source: cairo-region.cpp `num_rectangles_func`.
981
+ */
982
+ numRectangles(): number;
983
+
984
+ /**
985
+ * Return the `i`-th rectangle in the region's decomposition.
986
+ * Throws if `i` is out of range.
987
+ * Source: cairo-region.cpp `get_rectangle_func`.
988
+ */
989
+ getRectangle(i: number): RectangleInt;
990
+
991
+ /**
992
+ * Union this region with `other` in place (`this ← this ∪ other`).
993
+ * Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(union)`.
994
+ */
995
+ union(other: Region): void;
996
+
997
+ /**
998
+ * Subtract `other` from this region in place (`this ← this ∖ other`).
999
+ * Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(subtract)`.
1000
+ */
1001
+ subtract(other: Region): void;
1002
+
1003
+ /**
1004
+ * Intersect this region with `other` in place (`this ← this ∩ other`).
1005
+ * Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(intersect)`.
1006
+ */
1007
+ intersect(other: Region): void;
1008
+
1009
+ /**
1010
+ * Replace this region with the symmetric difference (`this ⊕ other`).
1011
+ * Source: cairo-region.cpp `REGION_DEFINE_REGION_FUNC(xor)`.
1012
+ */
1013
+ xor(other: Region): void;
1014
+
1015
+ /**
1016
+ * Union a single rectangle into this region.
1017
+ * Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(union)`.
1018
+ */
1019
+ unionRectangle(rect: RectangleInt): void;
1020
+
1021
+ /**
1022
+ * Subtract a single rectangle from this region.
1023
+ * Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(subtract)`.
1024
+ */
1025
+ subtractRectangle(rect: RectangleInt): void;
1026
+
1027
+ /**
1028
+ * Intersect this region with a rectangle.
1029
+ * Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(intersect)`.
1030
+ */
1031
+ intersectRectangle(rect: RectangleInt): void;
1032
+
1033
+ /**
1034
+ * Symmetric-difference this region with a rectangle.
1035
+ * Source: cairo-region.cpp `REGION_DEFINE_RECT_FUNC(xor)`.
1036
+ */
1037
+ xorRectangle(rect: RectangleInt): void;
1038
+ }
1039
+
1040
+ /**
1041
+ * Integer-coordinate rectangle — Cairo's `cairo_rectangle_int_t` JS
1042
+ * shape. Used by `Region` methods that read/write rectangle data.
1043
+ * Source: gjs/modules/cairo-region.cpp `fill_rectangle` reads these
1044
+ * four properties off the JS object.
1045
+ */
1046
+ export interface RectangleInt {
1047
+ x: number;
1048
+ y: number;
1049
+ width: number;
1050
+ height: number;
1051
+ }
886
1052
 
887
1053
  /**
888
1054
  * A matrix object used for transforming coordinates