@shopify/react-native-skia 2.6.0 → 2.6.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.
Files changed (118) hide show
  1. package/android/CMakeLists.txt +0 -1
  2. package/android/cpp/jni/JniWebGPUView.cpp +3 -3
  3. package/android/cpp/rnskia-android/OpenGLContext.h +4 -5
  4. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
  5. package/apple/MetalContext.h +5 -6
  6. package/apple/MetalWindowContext.mm +3 -4
  7. package/apple/RNSkApplePlatformContext.h +1 -1
  8. package/apple/RNSkApplePlatformContext.mm +4 -3
  9. package/apple/SkiaCVPixelBufferUtils.h +1 -1
  10. package/apple/SkiaCVPixelBufferUtils.mm +31 -30
  11. package/apple/SkiaPlatformContext.mm +2 -2
  12. package/apple/SkiaUIView.mm +1 -1
  13. package/apple/SkiaWebGPUView.mm +8 -4
  14. package/apple/WebGPUMetalView.h +1 -1
  15. package/apple/WebGPUMetalView.mm +1 -1
  16. package/cpp/api/JsiSkColor.h +8 -4
  17. package/cpp/api/JsiSkContourMeasure.h +4 -3
  18. package/cpp/api/JsiSkImage.h +17 -9
  19. package/cpp/api/JsiSkParagraphBuilder.h +14 -1
  20. package/cpp/api/JsiSkPath.h +71 -81
  21. package/cpp/api/JsiSkPathEffectFactory.h +2 -1
  22. package/cpp/api/JsiSkPathFactory.h +48 -52
  23. package/cpp/api/JsiSkShader.h +1 -1
  24. package/cpp/api/JsiSkShaderFactory.h +50 -26
  25. package/cpp/api/JsiSkSurfaceFactory.h +2 -1
  26. package/cpp/api/recorder/Drawings.h +5 -7
  27. package/cpp/api/recorder/Shaders.h +77 -22
  28. package/cpp/jsi2/JSIConverter.h +1 -1
  29. package/cpp/rnskia/RNDawnContext.h +14 -15
  30. package/cpp/rnskia/RNDawnUtils.h +14 -17
  31. package/cpp/rnskia/RNDawnWindowContext.h +1 -1
  32. package/cpp/rnskia/RNSkManager.cpp +5 -4
  33. package/cpp/rnskia/RNSkPlatformContext.h +2 -2
  34. package/cpp/rnwgpu/api/GPU.cpp +21 -0
  35. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -1
  36. package/cpp/rnwgpu/api/GPUCanvasContext.h +2 -2
  37. package/cpp/rnwgpu/api/GPUFeatures.h +0 -9
  38. package/cpp/rnwgpu/api/GPUTexture.h +14 -2
  39. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +3 -4
  40. package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
  41. package/cpp/rnwgpu/api/descriptors/Unions.h +0 -15
  42. package/cpp/skia/include/android/SkImageAndroid.h +7 -2
  43. package/cpp/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
  44. package/cpp/skia/include/codec/SkCodec.h +42 -15
  45. package/cpp/skia/include/config/SkUserConfig.h +8 -0
  46. package/cpp/skia/include/core/SkBitmap.h +0 -5
  47. package/cpp/skia/include/core/SkCanvas.h +2 -39
  48. package/cpp/skia/include/core/SkColor.h +12 -0
  49. package/cpp/skia/include/core/SkColorSpace.h +9 -0
  50. package/cpp/skia/include/core/SkContourMeasure.h +1 -5
  51. package/cpp/skia/include/core/SkData.h +8 -0
  52. package/cpp/skia/include/core/SkFont.h +1 -55
  53. package/cpp/skia/include/core/SkFontArguments.h +15 -0
  54. package/cpp/skia/include/core/SkGraphics.h +0 -5
  55. package/cpp/skia/include/core/SkImage.h +0 -4
  56. package/cpp/skia/include/core/SkImageGenerator.h +1 -4
  57. package/cpp/skia/include/core/SkMatrix.h +0 -37
  58. package/cpp/skia/include/core/SkMilestone.h +1 -1
  59. package/cpp/skia/include/core/SkPath.h +11 -911
  60. package/cpp/skia/include/core/SkPathBuilder.h +42 -32
  61. package/cpp/skia/include/core/SkPathEffect.h +0 -9
  62. package/cpp/skia/include/core/SkPathMeasure.h +1 -4
  63. package/cpp/skia/include/core/SkPathUtils.h +0 -10
  64. package/cpp/skia/include/core/SkRect.h +0 -12
  65. package/cpp/skia/include/core/SkRegion.h +1 -6
  66. package/cpp/skia/include/core/SkSerialProcs.h +4 -5
  67. package/cpp/skia/include/core/SkSurfaceProps.h +6 -0
  68. package/cpp/skia/include/core/SkTextBlob.h +0 -22
  69. package/cpp/skia/include/core/SkTypeface.h +14 -32
  70. package/cpp/skia/include/core/SkTypes.h +0 -8
  71. package/cpp/skia/include/docs/SkPDFDocument.h +19 -17
  72. package/cpp/skia/include/effects/SkDashPathEffect.h +0 -6
  73. package/cpp/skia/include/effects/SkGradient.h +206 -0
  74. package/cpp/skia/include/effects/SkHighContrastFilter.h +2 -2
  75. package/cpp/skia/include/gpu/GpuTypes.h +2 -0
  76. package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +5 -35
  77. package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +7 -106
  78. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +0 -11
  79. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -9
  80. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
  81. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
  82. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
  83. package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +4 -1
  84. package/cpp/skia/include/gpu/graphite/ContextOptions.h +4 -20
  85. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +32 -46
  86. package/cpp/skia/include/gpu/graphite/Recorder.h +1 -1
  87. package/cpp/skia/include/gpu/graphite/Surface.h +31 -0
  88. package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -10
  89. package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +3 -3
  90. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -1
  91. package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +6 -6
  92. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +5 -3
  93. package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +1 -1
  94. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
  95. package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +8 -0
  96. package/cpp/skia/include/private/SkEncodedInfo.h +43 -105
  97. package/cpp/skia/include/private/SkHdrMetadata.h +165 -2
  98. package/cpp/skia/include/private/SkPathRef.h +0 -457
  99. package/cpp/skia/include/private/base/SkFeatures.h +4 -0
  100. package/cpp/skia/include/private/base/SkFloatingPoint.h +1 -2
  101. package/cpp/skia/include/private/base/SkLoadUserConfig.h +2 -1
  102. package/cpp/skia/include/private/base/SkLog.h +68 -0
  103. package/cpp/skia/include/private/base/SkLogPriority.h +35 -0
  104. package/cpp/skia/include/private/base/SkMacros.h +9 -0
  105. package/cpp/skia/include/private/base/SkTArray.h +1 -1
  106. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +10 -24
  107. package/cpp/skia/include/utils/SkEventTracer.h +5 -7
  108. package/cpp/skia/modules/skottie/include/TextShaper.h +0 -7
  109. package/cpp/skia/modules/skparagraph/include/FontCollection.h +6 -20
  110. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +0 -6
  111. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +4 -19
  112. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -3
  113. package/cpp/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
  114. package/cpp/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
  115. package/cpp/skia/src/base/SkMathPriv.h +27 -132
  116. package/package.json +5 -5
  117. package/cpp/skia/include/effects/SkGradientShader.h +0 -359
  118. package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
@@ -33,28 +33,13 @@ class SkWStream;
33
33
  enum class SkPathConvexity;
34
34
  enum class SkResolveConvexity;
35
35
  struct SkPathRaw;
36
- struct SkPathVerbAnalysis;
37
36
  struct SkPathOvalInfo;
38
37
  struct SkPathRRectInfo;
39
38
 
40
- // WIP -- define this locally, and fix call-sites to use SkPathBuilder (skbug.com/40040287)
41
- #ifndef SK_HIDE_PATH_EDIT_METHODS
42
- //#define SK_HIDE_PATH_EDIT_METHODS
43
- #endif
44
-
45
39
  // Migrate clients so this is unneeded
46
40
  #define SK_LEGACY_PATH_ACCESSORS
47
41
 
48
- #ifdef SK_HIDE_PATH_EDIT_METHODS
49
- // enable this to try using SkPathData
50
- #define SK_PATH_USES_PATHDATA
51
- #endif
52
-
53
- #ifdef SK_PATH_USES_PATHDATA
54
42
  class SkPathData;
55
- #else
56
- class SkPathRef;
57
- #endif
58
43
 
59
44
  /** \class SkPath
60
45
  SkPath contain geometry. SkPath may be empty, or contain one or more verbs that
@@ -157,7 +142,8 @@ public:
157
142
 
158
143
  example: https://fiddle.skia.org/c/@Path_copy_const_SkPath
159
144
  */
160
- SkPath(const SkPath& path);
145
+ SkPath(const SkPath&);
146
+ SkPath(SkPath&&);
161
147
 
162
148
  /** Releases ownership of any shared data and deletes data if SkPath is sole owner.
163
149
 
@@ -184,7 +170,8 @@ public:
184
170
 
185
171
  example: https://fiddle.skia.org/c/@Path_copy_operator
186
172
  */
187
- SkPath& operator=(const SkPath& path);
173
+ SkPath& operator=(const SkPath&);
174
+ SkPath& operator=(SkPath&&);
188
175
 
189
176
  /** Compares a and b; returns true if SkPath::FillType, verb array, SkPoint array, and weights
190
177
  are equivalent.
@@ -511,14 +498,15 @@ public:
511
498
  */
512
499
  size_t approximateBytesUsed() const;
513
500
 
514
- /** Returns minimum and maximum axes values of SkPoint array.
515
- Returns (0, 0, 0, 0) if SkPath contains no points. Returned bounds width and height may
516
- be larger or smaller than area affected when SkPath is drawn.
501
+ /** Returns the min/max of the path's 'trimmed' points. The trimmed points are all of the
502
+ points in the path, with the exception of the path having more than one contour, and the
503
+ final contour containing only a kMove verb. In that case the trailing kMove point
504
+ is ignored when computing the bounds.
517
505
 
518
- SkRect returned includes all SkPoint added to SkPath, including SkPoint associated with
519
- kMove_Verb that define empty contours.
506
+ If the path has no verbs, or the path contains non-finite values,
507
+ then {0, 0, 0, 0} is returned. (see isFinite())
520
508
 
521
- @return bounds of all SkPoint in SkPoint array
509
+ @return bounds of the path's points
522
510
  */
523
511
  const SkRect& getBounds() const;
524
512
 
@@ -569,15 +557,6 @@ public:
569
557
  */
570
558
  bool conservativelyContainsRect(const SkRect& rect) const;
571
559
 
572
- /** \enum SkPath::ArcSize
573
- Four oval parts with radii (rx, ry) start at last SkPath SkPoint and ends at (x, y).
574
- ArcSize and Direction select one of the four oval parts.
575
- */
576
- enum ArcSize {
577
- kSmall_ArcSize, //!< smaller of arc pair
578
- kLarge_ArcSize, //!< larger of arc pair
579
- };
580
-
581
560
  /** Approximates conic with quad array. Conic is constructed from start SkPoint p0,
582
561
  control SkPoint p1, end SkPoint p2, and weight w.
583
562
  Quad array is stored in pts; this storage is supplied by caller.
@@ -779,810 +758,6 @@ public:
779
758
  */
780
759
  SkPath& reset();
781
760
 
782
- #ifndef SK_HIDE_PATH_EDIT_METHODS
783
- /** Returns a copy of this path in the current state, and resets the path to empty. */
784
- SkPath detach() {
785
- SkPath result = *this;
786
- this->reset();
787
- return result;
788
- }
789
-
790
- /** Sets SkPath to its initial state, preserving internal storage.
791
- Removes verb array, SkPoint array, and weights, and sets FillType to kWinding.
792
- Internal storage associated with SkPath is retained.
793
-
794
- Use rewind() instead of reset() if SkPath storage will be reused and performance
795
- is critical.
796
-
797
- @return reference to SkPath
798
-
799
- example: https://fiddle.skia.org/c/@Path_rewind
800
- */
801
- SkPath& rewind();
802
-
803
- /** Grows SkPath verb array, SkPoint array, and conics to contain additional space.
804
- May improve performance and use less memory by
805
- reducing the number and size of allocations when creating SkPath.
806
-
807
- @param extraPtCount number of additional SkPoint to allocate
808
- @param extraVerbCount number of additional verbs
809
- @param extraConicCount number of additional conics
810
-
811
- example: https://fiddle.skia.org/c/@Path_incReserve
812
- */
813
- void incReserve(int extraPtCount, int extraVerbCount = 0, int extraConicCount = 0);
814
-
815
- /** Specifies the beginning of contour. If the previous verb was a "move" verb,
816
- * then this just replaces the point value of that move, otherwise it appends a new
817
- * "move" verb to the path using the point.
818
- *
819
- * Thus, each contour can only have 1 move verb in it (the last one specified).
820
- */
821
- SkPath& moveTo(SkPoint p) {
822
- return this->moveTo(p.fX, p.fY);
823
- }
824
- SkPath& moveTo(SkScalar x, SkScalar y);
825
-
826
- /** Adds beginning of contour relative to last point.
827
- If SkPath is empty, starts contour at (dx, dy).
828
- Otherwise, start contour at last point offset by (dx, dy).
829
- Function name stands for "relative move to".
830
-
831
- @param dx offset from last point to contour start on x-axis
832
- @param dy offset from last point to contour start on y-axis
833
- @return reference to SkPath
834
-
835
- example: https://fiddle.skia.org/c/@Path_rMoveTo
836
- */
837
- SkPath& rMoveTo(SkScalar dx, SkScalar dy);
838
-
839
- /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is
840
- kClose_Verb, last point is set to (0, 0) before adding line.
841
-
842
- lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
843
- lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.
844
-
845
- @param x end of added line on x-axis
846
- @param y end of added line on y-axis
847
- @return reference to SkPath
848
-
849
- example: https://fiddle.skia.org/c/@Path_lineTo
850
- */
851
- SkPath& lineTo(SkScalar x, SkScalar y);
852
-
853
- /** Adds line from last point to SkPoint p. If SkPath is empty, or last SkPath::Verb is
854
- kClose_Verb, last point is set to (0, 0) before adding line.
855
-
856
- lineTo() first appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
857
- lineTo() then appends kLine_Verb to verb array and SkPoint p to SkPoint array.
858
-
859
- @param p end SkPoint of added line
860
- @return reference to SkPath
861
- */
862
- SkPath& lineTo(const SkPoint& p) {
863
- return this->lineTo(p.fX, p.fY);
864
- }
865
-
866
- /** Adds line from last point to vector (dx, dy). If SkPath is empty, or last SkPath::Verb is
867
- kClose_Verb, last point is set to (0, 0) before adding line.
868
-
869
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed;
870
- then appends kLine_Verb to verb array and line end to SkPoint array.
871
- Line end is last point plus vector (dx, dy).
872
- Function name stands for "relative line to".
873
-
874
- @param dx offset from last point to line end on x-axis
875
- @param dy offset from last point to line end on y-axis
876
- @return reference to SkPath
877
-
878
- example: https://fiddle.skia.org/c/@Path_rLineTo
879
- example: https://fiddle.skia.org/c/@Quad_a
880
- example: https://fiddle.skia.org/c/@Quad_b
881
- */
882
- SkPath& rLineTo(SkScalar dx, SkScalar dy);
883
-
884
- /** Adds quad from last point towards (x1, y1), to (x2, y2).
885
- If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0)
886
- before adding quad.
887
-
888
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed;
889
- then appends kQuad_Verb to verb array; and (x1, y1), (x2, y2)
890
- to SkPoint array.
891
-
892
- @param x1 control SkPoint of quad on x-axis
893
- @param y1 control SkPoint of quad on y-axis
894
- @param x2 end SkPoint of quad on x-axis
895
- @param y2 end SkPoint of quad on y-axis
896
- @return reference to SkPath
897
-
898
- example: https://fiddle.skia.org/c/@Path_quadTo
899
- */
900
- SkPath& quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2);
901
-
902
- /** Adds quad from last point towards SkPoint p1, to SkPoint p2.
903
- If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0)
904
- before adding quad.
905
-
906
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed;
907
- then appends kQuad_Verb to verb array; and SkPoint p1, p2
908
- to SkPoint array.
909
-
910
- @param p1 control SkPoint of added quad
911
- @param p2 end SkPoint of added quad
912
- @return reference to SkPath
913
- */
914
- SkPath& quadTo(const SkPoint& p1, const SkPoint& p2) {
915
- return this->quadTo(p1.fX, p1.fY, p2.fX, p2.fY);
916
- }
917
-
918
- /** Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2).
919
- If SkPath is empty, or last SkPath::Verb
920
- is kClose_Verb, last point is set to (0, 0) before adding quad.
921
-
922
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array,
923
- if needed; then appends kQuad_Verb to verb array; and appends quad
924
- control and quad end to SkPoint array.
925
- Quad control is last point plus vector (dx1, dy1).
926
- Quad end is last point plus vector (dx2, dy2).
927
- Function name stands for "relative quad to".
928
-
929
- @param dx1 offset from last point to quad control on x-axis
930
- @param dy1 offset from last point to quad control on y-axis
931
- @param dx2 offset from last point to quad end on x-axis
932
- @param dy2 offset from last point to quad end on y-axis
933
- @return reference to SkPath
934
-
935
- example: https://fiddle.skia.org/c/@Conic_Weight_a
936
- example: https://fiddle.skia.org/c/@Conic_Weight_b
937
- example: https://fiddle.skia.org/c/@Conic_Weight_c
938
- example: https://fiddle.skia.org/c/@Path_rQuadTo
939
- */
940
- SkPath& rQuadTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2);
941
-
942
- /** Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.
943
- If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0)
944
- before adding conic.
945
-
946
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
947
-
948
- If w is finite and not one, appends kConic_Verb to verb array;
949
- and (x1, y1), (x2, y2) to SkPoint array; and w to conic weights.
950
-
951
- If w is one, appends kQuad_Verb to verb array, and
952
- (x1, y1), (x2, y2) to SkPoint array.
953
-
954
- If w is not finite, appends kLine_Verb twice to verb array, and
955
- (x1, y1), (x2, y2) to SkPoint array.
956
-
957
- @param x1 control SkPoint of conic on x-axis
958
- @param y1 control SkPoint of conic on y-axis
959
- @param x2 end SkPoint of conic on x-axis
960
- @param y2 end SkPoint of conic on y-axis
961
- @param w weight of added conic
962
- @return reference to SkPath
963
- */
964
- SkPath& conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
965
- SkScalar w);
966
-
967
- /** Adds conic from last point towards SkPoint p1, to SkPoint p2, weighted by w.
968
- If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0)
969
- before adding conic.
970
-
971
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
972
-
973
- If w is finite and not one, appends kConic_Verb to verb array;
974
- and SkPoint p1, p2 to SkPoint array; and w to conic weights.
975
-
976
- If w is one, appends kQuad_Verb to verb array, and SkPoint p1, p2
977
- to SkPoint array.
978
-
979
- If w is not finite, appends kLine_Verb twice to verb array, and
980
- SkPoint p1, p2 to SkPoint array.
981
-
982
- @param p1 control SkPoint of added conic
983
- @param p2 end SkPoint of added conic
984
- @param w weight of added conic
985
- @return reference to SkPath
986
- */
987
- SkPath& conicTo(const SkPoint& p1, const SkPoint& p2, SkScalar w) {
988
- return this->conicTo(p1.fX, p1.fY, p2.fX, p2.fY, w);
989
- }
990
-
991
- /** Adds conic from last point towards vector (dx1, dy1), to vector (dx2, dy2),
992
- weighted by w. If SkPath is empty, or last SkPath::Verb
993
- is kClose_Verb, last point is set to (0, 0) before adding conic.
994
-
995
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array,
996
- if needed.
997
-
998
- If w is finite and not one, next appends kConic_Verb to verb array,
999
- and w is recorded as conic weight; otherwise, if w is one, appends
1000
- kQuad_Verb to verb array; or if w is not finite, appends kLine_Verb
1001
- twice to verb array.
1002
-
1003
- In all cases appends SkPoint control and end to SkPoint array.
1004
- control is last point plus vector (dx1, dy1).
1005
- end is last point plus vector (dx2, dy2).
1006
-
1007
- Function name stands for "relative conic to".
1008
-
1009
- @param dx1 offset from last point to conic control on x-axis
1010
- @param dy1 offset from last point to conic control on y-axis
1011
- @param dx2 offset from last point to conic end on x-axis
1012
- @param dy2 offset from last point to conic end on y-axis
1013
- @param w weight of added conic
1014
- @return reference to SkPath
1015
- */
1016
- SkPath& rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2,
1017
- SkScalar w);
1018
-
1019
- /** Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at
1020
- (x3, y3). If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to
1021
- (0, 0) before adding cubic.
1022
-
1023
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed;
1024
- then appends kCubic_Verb to verb array; and (x1, y1), (x2, y2), (x3, y3)
1025
- to SkPoint array.
1026
-
1027
- @param x1 first control SkPoint of cubic on x-axis
1028
- @param y1 first control SkPoint of cubic on y-axis
1029
- @param x2 second control SkPoint of cubic on x-axis
1030
- @param y2 second control SkPoint of cubic on y-axis
1031
- @param x3 end SkPoint of cubic on x-axis
1032
- @param y3 end SkPoint of cubic on y-axis
1033
- @return reference to SkPath
1034
- */
1035
- SkPath& cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
1036
- SkScalar x3, SkScalar y3);
1037
-
1038
- /** Adds cubic from last point towards SkPoint p1, then towards SkPoint p2, ending at
1039
- SkPoint p3. If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to
1040
- (0, 0) before adding cubic.
1041
-
1042
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed;
1043
- then appends kCubic_Verb to verb array; and SkPoint p1, p2, p3
1044
- to SkPoint array.
1045
-
1046
- @param p1 first control SkPoint of cubic
1047
- @param p2 second control SkPoint of cubic
1048
- @param p3 end SkPoint of cubic
1049
- @return reference to SkPath
1050
- */
1051
- SkPath& cubicTo(const SkPoint& p1, const SkPoint& p2, const SkPoint& p3) {
1052
- return this->cubicTo(p1.fX, p1.fY, p2.fX, p2.fY, p3.fX, p3.fY);
1053
- }
1054
-
1055
- /** Adds cubic from last point towards vector (dx1, dy1), then towards
1056
- vector (dx2, dy2), to vector (dx3, dy3).
1057
- If SkPath is empty, or last SkPath::Verb
1058
- is kClose_Verb, last point is set to (0, 0) before adding cubic.
1059
-
1060
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array,
1061
- if needed; then appends kCubic_Verb to verb array; and appends cubic
1062
- control and cubic end to SkPoint array.
1063
- Cubic control is last point plus vector (dx1, dy1).
1064
- Cubic end is last point plus vector (dx2, dy2).
1065
- Function name stands for "relative cubic to".
1066
-
1067
- @param dx1 offset from last point to first cubic control on x-axis
1068
- @param dy1 offset from last point to first cubic control on y-axis
1069
- @param dx2 offset from last point to second cubic control on x-axis
1070
- @param dy2 offset from last point to second cubic control on y-axis
1071
- @param dx3 offset from last point to cubic end on x-axis
1072
- @param dy3 offset from last point to cubic end on y-axis
1073
- @return reference to SkPath
1074
- */
1075
- SkPath& rCubicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2,
1076
- SkScalar dx3, SkScalar dy3);
1077
-
1078
- /** Appends arc to SkPath. Arc added is part of ellipse
1079
- bounded by oval, from startAngle through sweepAngle. Both startAngle and
1080
- sweepAngle are measured in degrees, where zero degrees is aligned with the
1081
- positive x-axis, and positive sweeps extends arc clockwise.
1082
-
1083
- arcTo() adds line connecting SkPath last SkPoint to initial arc SkPoint if forceMoveTo
1084
- is false and SkPath is not empty. Otherwise, added contour begins with first point
1085
- of arc. Angles greater than -360 and less than 360 are treated modulo 360.
1086
-
1087
- @param oval bounds of ellipse containing arc
1088
- @param startAngle starting angle of arc in degrees
1089
- @param sweepAngle sweep, in degrees. Positive is clockwise; treated modulo 360
1090
- @param forceMoveTo true to start a new contour with arc
1091
- @return reference to SkPath
1092
-
1093
- example: https://fiddle.skia.org/c/@Path_arcTo
1094
- */
1095
- SkPath& arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo);
1096
-
1097
- /** Appends arc to SkPath, after appending line if needed. Arc is implemented by conic
1098
- weighted to describe part of circle. Arc is contained by tangent from
1099
- last SkPath point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc
1100
- is part of circle sized to radius, positioned so it touches both tangent lines.
1101
-
1102
- If last Path Point does not start Arc, arcTo appends connecting Line to Path.
1103
- The length of Vector from (x1, y1) to (x2, y2) does not affect Arc.
1104
-
1105
- Arc sweep is always less than 180 degrees. If radius is zero, or if
1106
- tangents are nearly parallel, arcTo appends Line from last Path Point to (x1, y1).
1107
-
1108
- arcTo appends at most one Line and one conic.
1109
- arcTo implements the functionality of PostScript arct and HTML Canvas arcTo.
1110
-
1111
- @param x1 x-axis value common to pair of tangents
1112
- @param y1 y-axis value common to pair of tangents
1113
- @param x2 x-axis value end of second tangent
1114
- @param y2 y-axis value end of second tangent
1115
- @param radius distance from arc to circle center
1116
- @return reference to SkPath
1117
-
1118
- example: https://fiddle.skia.org/c/@Path_arcTo_2_a
1119
- example: https://fiddle.skia.org/c/@Path_arcTo_2_b
1120
- example: https://fiddle.skia.org/c/@Path_arcTo_2_c
1121
- */
1122
- SkPath& arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius);
1123
-
1124
- /** Appends arc to SkPath, after appending line if needed. Arc is implemented by conic
1125
- weighted to describe part of circle. Arc is contained by tangent from
1126
- last SkPath point to p1, and tangent from p1 to p2. Arc
1127
- is part of circle sized to radius, positioned so it touches both tangent lines.
1128
-
1129
- If last SkPath SkPoint does not start arc, arcTo() appends connecting line to SkPath.
1130
- The length of vector from p1 to p2 does not affect arc.
1131
-
1132
- Arc sweep is always less than 180 degrees. If radius is zero, or if
1133
- tangents are nearly parallel, arcTo() appends line from last SkPath SkPoint to p1.
1134
-
1135
- arcTo() appends at most one line and one conic.
1136
- arcTo() implements the functionality of PostScript arct and HTML Canvas arcTo.
1137
-
1138
- @param p1 SkPoint common to pair of tangents
1139
- @param p2 end of second tangent
1140
- @param radius distance from arc to circle center
1141
- @return reference to SkPath
1142
- */
1143
- SkPath& arcTo(SkPoint p1, SkPoint p2, SkScalar radius) {
1144
- return this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius);
1145
- }
1146
-
1147
- /** Appends arc to SkPath. Arc is implemented by one or more conics weighted to
1148
- describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc
1149
- curves from last SkPath SkPoint to (x, y), choosing one of four possible routes:
1150
- clockwise or counterclockwise, and smaller or larger.
1151
-
1152
- Arc sweep is always less than 360 degrees. arcTo() appends line to (x, y) if
1153
- either radii are zero, or if last SkPath SkPoint equals (x, y). arcTo() scales radii
1154
- (rx, ry) to fit last SkPath SkPoint and (x, y) if both are greater than zero but
1155
- too small.
1156
-
1157
- arcTo() appends up to four conic curves.
1158
- arcTo() implements the functionality of SVG arc, although SVG sweep-flag value
1159
- is opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise,
1160
- while kCW_Direction cast to int is zero.
1161
-
1162
- @param rx radius on x-axis before x-axis rotation
1163
- @param ry radius on y-axis before x-axis rotation
1164
- @param xAxisRotate x-axis rotation in degrees; positive values are clockwise
1165
- @param largeArc chooses smaller or larger arc
1166
- @param sweep chooses clockwise or counterclockwise arc
1167
- @param x end of arc
1168
- @param y end of arc
1169
- @return reference to SkPath
1170
- */
1171
- SkPath& arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
1172
- SkPathDirection sweep, SkScalar x, SkScalar y);
1173
-
1174
- /** Appends arc to SkPath. Arc is implemented by one or more conic weighted to describe
1175
- part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves
1176
- from last SkPath SkPoint to (xy.fX, xy.fY), choosing one of four possible routes:
1177
- clockwise or counterclockwise,
1178
- and smaller or larger.
1179
-
1180
- Arc sweep is always less than 360 degrees. arcTo() appends line to xy if either
1181
- radii are zero, or if last SkPath SkPoint equals (xy.fX, xy.fY). arcTo() scales radii r to
1182
- fit last SkPath SkPoint and xy if both are greater than zero but too small to describe
1183
- an arc.
1184
-
1185
- arcTo() appends up to four conic curves.
1186
- arcTo() implements the functionality of SVG arc, although SVG sweep-flag value is
1187
- opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while
1188
- kCW_Direction cast to int is zero.
1189
-
1190
- @param r radii on axes before x-axis rotation
1191
- @param xAxisRotate x-axis rotation in degrees; positive values are clockwise
1192
- @param largeArc chooses smaller or larger arc
1193
- @param sweep chooses clockwise or counterclockwise arc
1194
- @param xy end of arc
1195
- @return reference to SkPath
1196
- */
1197
- SkPath& arcTo(SkPoint r,
1198
- SkScalar xAxisRotate,
1199
- ArcSize largeArc,
1200
- SkPathDirection sweep,
1201
- const SkPoint xy) {
1202
- return this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY);
1203
- }
1204
-
1205
- /** Appends arc to SkPath, relative to last SkPath SkPoint. Arc is implemented by one or
1206
- more conic, weighted to describe part of oval with radii (rx, ry) rotated by
1207
- xAxisRotate degrees. Arc curves from last SkPath SkPoint to relative end SkPoint:
1208
- (dx, dy), choosing one of four possible routes: clockwise or
1209
- counterclockwise, and smaller or larger. If SkPath is empty, the start arc SkPoint
1210
- is (0, 0).
1211
-
1212
- Arc sweep is always less than 360 degrees. arcTo() appends line to end SkPoint
1213
- if either radii are zero, or if last SkPath SkPoint equals end SkPoint.
1214
- arcTo() scales radii (rx, ry) to fit last SkPath SkPoint and end SkPoint if both are
1215
- greater than zero but too small to describe an arc.
1216
-
1217
- arcTo() appends up to four conic curves.
1218
- arcTo() implements the functionality of svg arc, although SVG "sweep-flag" value is
1219
- opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while
1220
- kCW_Direction cast to int is zero.
1221
-
1222
- @param rx radius before x-axis rotation
1223
- @param ry radius before x-axis rotation
1224
- @param xAxisRotate x-axis rotation in degrees; positive values are clockwise
1225
- @param largeArc chooses smaller or larger arc
1226
- @param sweep chooses clockwise or counterclockwise arc
1227
- @param dx x-axis offset end of arc from last SkPath SkPoint
1228
- @param dy y-axis offset end of arc from last SkPath SkPoint
1229
- @return reference to SkPath
1230
- */
1231
- SkPath& rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
1232
- SkPathDirection sweep, SkScalar dx, SkScalar dy);
1233
-
1234
- /** Appends kClose_Verb to SkPath. A closed contour connects the first and last SkPoint
1235
- with line, forming a continuous loop. Open and closed contour draw the same
1236
- with SkPaint::kFill_Style. With SkPaint::kStroke_Style, open contour draws
1237
- SkPaint::Cap at contour start and end; closed contour draws
1238
- SkPaint::Join at contour start and end.
1239
-
1240
- close() has no effect if SkPath is empty or last SkPath SkPath::Verb is kClose_Verb.
1241
-
1242
- @return reference to SkPath
1243
-
1244
- example: https://fiddle.skia.org/c/@Path_close
1245
- */
1246
- SkPath& close();
1247
-
1248
- /** Adds a new contour to the path, defined by the rect, and wound in the
1249
- specified direction. The verbs added to the path will be:
1250
-
1251
- kMove, kLine, kLine, kLine, kClose
1252
-
1253
- start specifies which corner to begin the contour:
1254
- 0: upper-left corner
1255
- 1: upper-right corner
1256
- 2: lower-right corner
1257
- 3: lower-left corner
1258
-
1259
- This start point also acts as the implied beginning of the subsequent,
1260
- contour, if it does not have an explicit moveTo(). e.g.
1261
-
1262
- path.addRect(...)
1263
- // if we don't say moveTo() here, we will use the rect's start point
1264
- path.lineTo(...)
1265
-
1266
- @param rect SkRect to add as a closed contour
1267
- @param dir SkPath::Direction to orient the new contour
1268
- @param start initial corner of SkRect to add
1269
- @return reference to SkPath
1270
-
1271
- example: https://fiddle.skia.org/c/@Path_addRect_2
1272
- */
1273
- SkPath& addRect(const SkRect& rect, SkPathDirection dir, unsigned start);
1274
-
1275
- SkPath& addRect(const SkRect& rect, SkPathDirection dir = SkPathDirection::kCW) {
1276
- return this->addRect(rect, dir, 0);
1277
- }
1278
-
1279
- SkPath& addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom,
1280
- SkPathDirection dir = SkPathDirection::kCW) {
1281
- return this->addRect({left, top, right, bottom}, dir, 0);
1282
- }
1283
-
1284
- /** Adds oval to path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
1285
- Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width
1286
- and half oval height. Oval begins at (oval.fRight, oval.centerY()) and continues
1287
- clockwise if dir is kCW_Direction, counterclockwise if dir is kCCW_Direction.
1288
-
1289
- @param oval bounds of ellipse added
1290
- @param dir SkPath::Direction to wind ellipse
1291
- @return reference to SkPath
1292
-
1293
- example: https://fiddle.skia.org/c/@Path_addOval
1294
- */
1295
- SkPath& addOval(const SkRect& oval, SkPathDirection dir = SkPathDirection::kCW);
1296
-
1297
- /** Adds oval to SkPath, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
1298
- Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width
1299
- and half oval height. Oval begins at start and continues
1300
- clockwise if dir is kCW_Direction, counterclockwise if dir is kCCW_Direction.
1301
-
1302
- @param oval bounds of ellipse added
1303
- @param dir SkPath::Direction to wind ellipse
1304
- @param start index of initial point of ellipse
1305
- @return reference to SkPath
1306
-
1307
- example: https://fiddle.skia.org/c/@Path_addOval_2
1308
- */
1309
- SkPath& addOval(const SkRect& oval, SkPathDirection dir, unsigned start);
1310
-
1311
- /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,
1312
- four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing
1313
- clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.
1314
-
1315
- Has no effect if radius is zero or negative.
1316
-
1317
- @param x center of circle
1318
- @param y center of circle
1319
- @param radius distance from center to edge
1320
- @param dir SkPath::Direction to wind circle
1321
- @return reference to SkPath
1322
- */
1323
- SkPath& addCircle(SkScalar x, SkScalar y, SkScalar radius,
1324
- SkPathDirection dir = SkPathDirection::kCW);
1325
-
1326
- /** Appends arc to SkPath, as the start of new contour. Arc added is part of ellipse
1327
- bounded by oval, from startAngle through sweepAngle. Both startAngle and
1328
- sweepAngle are measured in degrees, where zero degrees is aligned with the
1329
- positive x-axis, and positive sweeps extends arc clockwise.
1330
-
1331
- If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly
1332
- zero, append oval instead of arc. Otherwise, sweepAngle values are treated
1333
- modulo 360, and arc may or may not draw depending on numeric rounding.
1334
-
1335
- @param oval bounds of ellipse containing arc
1336
- @param startAngle starting angle of arc in degrees
1337
- @param sweepAngle sweep, in degrees. Positive is clockwise; treated modulo 360
1338
- @return reference to SkPath
1339
-
1340
- example: https://fiddle.skia.org/c/@Path_addArc
1341
- */
1342
- SkPath& addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle);
1343
-
1344
- /** Appends SkRRect to SkPath, creating a new closed contour. SkRRect has bounds
1345
- equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If
1346
- dir is kCW_Direction, SkRRect starts at top-left of the lower-left corner and
1347
- winds clockwise. If dir is kCCW_Direction, SkRRect starts at the bottom-left
1348
- of the upper-left corner and winds counterclockwise.
1349
-
1350
- If either rx or ry is too large, rx and ry are scaled uniformly until the
1351
- corners fit. If rx or ry is less than or equal to zero, addRoundRect() appends
1352
- SkRect rect to SkPath.
1353
-
1354
- After appending, SkPath may be empty, or may contain: SkRect, oval, or SkRRect.
1355
-
1356
- @param rect bounds of SkRRect
1357
- @param rx x-axis radius of rounded corners on the SkRRect
1358
- @param ry y-axis radius of rounded corners on the SkRRect
1359
- @param dir SkPath::Direction to wind SkRRect
1360
- @return reference to SkPath
1361
- */
1362
- SkPath& addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
1363
- SkPathDirection dir = SkPathDirection::kCW);
1364
-
1365
- /** Appends SkRRect to SkPath, creating a new closed contour. SkRRect has bounds
1366
- equal to rect; each corner is 90 degrees of an ellipse with radii from the
1367
- array.
1368
-
1369
- @param rect bounds of SkRRect
1370
- @param radii array of 8 SkScalar values, a radius pair for each corner
1371
- @param dir SkPath::Direction to wind SkRRect
1372
- @return reference to SkPath
1373
- */
1374
- SkPath& addRoundRect(const SkRect& rect, SkSpan<const SkScalar> radii,
1375
- SkPathDirection dir = SkPathDirection::kCW);
1376
-
1377
- /** Adds rrect to SkPath, creating a new closed contour. If
1378
- dir is kCW_Direction, rrect starts at top-left of the lower-left corner and
1379
- winds clockwise. If dir is kCCW_Direction, rrect starts at the bottom-left
1380
- of the upper-left corner and winds counterclockwise.
1381
-
1382
- After appending, SkPath may be empty, or may contain: SkRect, oval, or SkRRect.
1383
-
1384
- @param rrect bounds and radii of rounded rectangle
1385
- @param dir SkPath::Direction to wind SkRRect
1386
- @return reference to SkPath
1387
-
1388
- example: https://fiddle.skia.org/c/@Path_addRRect
1389
- */
1390
- SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir = SkPathDirection::kCW);
1391
-
1392
- /** Adds rrect to SkPath, creating a new closed contour. If dir is kCW_Direction, rrect
1393
- winds clockwise; if dir is kCCW_Direction, rrect winds counterclockwise.
1394
- start determines the first point of rrect to add.
1395
-
1396
- @param rrect bounds and radii of rounded rectangle
1397
- @param dir SkPath::Direction to wind SkRRect
1398
- @param start index of initial point of SkRRect
1399
- @return reference to SkPath
1400
-
1401
- example: https://fiddle.skia.org/c/@Path_addRRect_2
1402
- */
1403
- SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir, unsigned start);
1404
-
1405
- /** Adds contour created from line array, adding (count - 1) line segments.
1406
- Contour added starts at pts[0], then adds a line for every additional SkPoint
1407
- in pts array. If close is true, appends kClose_Verb to SkPath, connecting
1408
- pts[count - 1] and pts[0].
1409
-
1410
- If count is zero, append kMove_Verb to path.
1411
- Has no effect if count is less than one.
1412
-
1413
- @param pts array of line sharing end and start SkPoint
1414
- @param count length of SkPoint array
1415
- @param close true to add line connecting contour end and start
1416
- @return reference to SkPath
1417
-
1418
- example: https://fiddle.skia.org/c/@Path_addPoly
1419
- */
1420
- SkPath& addPoly(SkSpan<const SkPoint> pts, bool close);
1421
-
1422
- /** Appends src to SkPath, offset by (dx, dy).
1423
-
1424
- If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are
1425
- added unaltered. If mode is kExtend_AddPathMode, add line before appending
1426
- verbs, SkPoint, and conic weights.
1427
-
1428
- @param src SkPath verbs, SkPoint, and conic weights to add
1429
- @param dx offset added to src SkPoint array x-axis coordinates
1430
- @param dy offset added to src SkPoint array y-axis coordinates
1431
- @param mode kAppend_AddPathMode or kExtend_AddPathMode
1432
- @return reference to SkPath
1433
- */
1434
- SkPath& addPath(const SkPath& src, SkScalar dx, SkScalar dy,
1435
- AddPathMode mode = kAppend_AddPathMode);
1436
-
1437
- /** Appends src to SkPath.
1438
-
1439
- If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are
1440
- added unaltered. If mode is kExtend_AddPathMode, add line before appending
1441
- verbs, SkPoint, and conic weights.
1442
-
1443
- @param src SkPath verbs, SkPoint, and conic weights to add
1444
- @param mode kAppend_AddPathMode or kExtend_AddPathMode
1445
- @return reference to SkPath
1446
- */
1447
- SkPath& addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) {
1448
- SkMatrix m;
1449
- m.reset();
1450
- return this->addPath(src, m, mode);
1451
- }
1452
-
1453
- /** Appends src to SkPath, transformed by matrix. Transformed curves may have different
1454
- verbs, SkPoint, and conic weights.
1455
-
1456
- If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are
1457
- added unaltered. If mode is kExtend_AddPathMode, add line before appending
1458
- verbs, SkPoint, and conic weights.
1459
-
1460
- @param src SkPath verbs, SkPoint, and conic weights to add
1461
- @param matrix transform applied to src
1462
- @param mode kAppend_AddPathMode or kExtend_AddPathMode
1463
- @return reference to SkPath
1464
- */
1465
- SkPath& addPath(const SkPath& src, const SkMatrix& matrix,
1466
- AddPathMode mode = kAppend_AddPathMode);
1467
-
1468
- /** Appends src to SkPath, from back to front.
1469
- Reversed src always appends a new contour to SkPath.
1470
-
1471
- @param src SkPath verbs, SkPoint, and conic weights to add
1472
- @return reference to SkPath
1473
-
1474
- example: https://fiddle.skia.org/c/@Path_reverseAddPath
1475
- */
1476
- SkPath& reverseAddPath(const SkPath& src);
1477
-
1478
- /** Sets last point to (x, y). If SkPoint array is empty, append kMove_Verb to
1479
- verb array and append (x, y) to SkPoint array.
1480
-
1481
- @param x set x-axis value of last point
1482
- @param y set y-axis value of last point
1483
-
1484
- example: https://fiddle.skia.org/c/@Path_setLastPt
1485
- */
1486
- void setLastPt(SkScalar x, SkScalar y);
1487
-
1488
- /** Sets the last point on the path. If SkPoint array is empty, append kMove_Verb to
1489
- verb array and append p to SkPoint array.
1490
-
1491
- @param p set value of last point
1492
- */
1493
- void setLastPt(const SkPoint& p) {
1494
- this->setLastPt(p.fX, p.fY);
1495
- }
1496
- #endif
1497
-
1498
- #ifdef SK_HIDE_PATH_EDIT_METHODS
1499
- private:
1500
- #endif
1501
-
1502
- #ifndef SK_PATH_USES_PATHDATA
1503
- /** Offsets SkPoint array by (dx, dy). Offset SkPath replaces dst.
1504
- If dst is nullptr, SkPath is replaced by offset data.
1505
-
1506
- @param dx offset added to SkPoint array x-axis coordinates
1507
- @param dy offset added to SkPoint array y-axis coordinates
1508
- @param dst overwritten, translated copy of SkPath; may be nullptr
1509
-
1510
- example: https://fiddle.skia.org/c/@Path_offset
1511
- */
1512
- void offset(SkScalar dx, SkScalar dy, SkPath* dst) const;
1513
-
1514
- /** Offsets SkPoint array by (dx, dy). SkPath is replaced by offset data.
1515
-
1516
- @param dx offset added to SkPoint array x-axis coordinates
1517
- @param dy offset added to SkPoint array y-axis coordinates
1518
- */
1519
- SkPath& offset(SkScalar dx, SkScalar dy) {
1520
- this->offset(dx, dy, this);
1521
- return *this;
1522
- }
1523
-
1524
- /** Transforms verb array, SkPoint array, and weight by matrix.
1525
- transform may change verbs and increase their number.
1526
- Transformed SkPath replaces dst; if dst is nullptr, original data
1527
- is replaced.
1528
-
1529
- @param matrix SkMatrix to apply to SkPath
1530
- @param dst overwritten, transformed copy of SkPath; may be nullptr
1531
- @param pc whether to apply perspective clipping
1532
-
1533
- example: https://fiddle.skia.org/c/@Path_transform
1534
- */
1535
- void transform(const SkMatrix& matrix, SkPath* dst) const;
1536
-
1537
- /** Transforms verb array, SkPoint array, and weight by matrix.
1538
- transform may change verbs and increase their number.
1539
- SkPath is replaced by transformed data.
1540
-
1541
- @param matrix SkMatrix to apply to SkPath
1542
- @param pc whether to apply perspective clipping
1543
- */
1544
- SkPath& transform(const SkMatrix& matrix) {
1545
- this->transform(matrix, this);
1546
- return *this;
1547
- }
1548
- #endif
1549
-
1550
- #ifdef SK_HIDE_PATH_EDIT_METHODS
1551
- public:
1552
- #endif
1553
-
1554
- #ifdef SK_SUPPORT_UNSPANNED_APIS
1555
- static SkPath Make(const SkPoint points[], int pointCount,
1556
- const uint8_t verbs[], int verbCount,
1557
- const SkScalar conics[], int conicWeightCount,
1558
- SkPathFillType fillType, bool isVolatile = false) {
1559
- return Make({points, pointCount},
1560
- {verbs, verbCount},
1561
- {conics, conicWeightCount},
1562
- fillType, isVolatile);
1563
- }
1564
- static SkPath Polygon(const SkPoint pts[], int count, bool isClosed,
1565
- SkPathFillType fillType = SkPathFillType::kWinding,
1566
- bool isVolatile = false) {
1567
- return Polygon({pts, count}, isClosed, fillType, isVolatile);
1568
- }
1569
- int getPoints(SkPoint points[], int max) const {
1570
- return (int)this->getPoints({points, max});
1571
- }
1572
- int getVerbs(uint8_t verbs[], int max) const {
1573
- return (int)this->getVerbs({verbs, max});
1574
- }
1575
- #ifndef SK_HIDE_PATH_EDIT_METHODS
1576
- SkPath& addRoundRect(const SkRect& rect, const SkScalar radii[],
1577
- SkPathDirection dir = SkPathDirection::kCW) {
1578
- return this->addRoundRect(rect, {radii, radii ? 8 : 0}, dir);
1579
- }
1580
- SkPath& addPoly(const SkPoint pts[], int count, bool close) {
1581
- return this->addPoly({pts, count}, close);
1582
- }
1583
- #endif // SK_HIDE_PATH_EDIT_METHODS
1584
- #endif // SK_SUPPORT_UNSPANNED_APIS
1585
-
1586
761
  SkPathIter iter() const;
1587
762
 
1588
763
  struct IterRec {
@@ -1918,10 +1093,6 @@ public:
1918
1093
  static std::optional<SkPath> ReadFromMemory(const void* buffer, size_t length,
1919
1094
  size_t* bytesRead = nullptr);
1920
1095
 
1921
- #ifndef SK_HIDE_PATH_EDIT_METHODS
1922
- size_t readFromMemory(const void* buffer, size_t length);
1923
- #endif
1924
-
1925
1096
  /** (See skbug.com/40032862)
1926
1097
  Returns a non-zero, globally unique value. A different value is returned
1927
1098
  if verb array, SkPoint array, or conic weight changes.
@@ -1948,7 +1119,6 @@ public:
1948
1119
  using sk_is_trivially_relocatable = std::true_type;
1949
1120
 
1950
1121
  private:
1951
- #ifdef SK_PATH_USES_PATHDATA
1952
1122
  static SkPath MakeNullCheck(sk_sp<SkPathData>, SkPathFillType, bool isVolatile);
1953
1123
  static SkPathData* PeekErrorSingleton();
1954
1124
 
@@ -1957,63 +1127,13 @@ private:
1957
1127
  sk_sp<SkPathData> fPathData;
1958
1128
  SkPathFillType fFillType;
1959
1129
  bool fIsVolatile;
1960
- #else
1961
- SkPath(sk_sp<SkPathRef>, SkPathFillType, bool isVolatile, SkPathConvexity);
1962
-
1963
- sk_sp<SkPathRef> fPathRef;
1964
- int fLastMoveToIndex;
1965
- mutable std::atomic<uint8_t> fConvexity; // SkPathConvexity
1966
- SkPathFillType fFillType;
1967
- bool fIsVolatile;
1968
-
1969
- static_assert(::sk_is_trivially_relocatable<decltype(fPathRef)>::value);
1970
-
1971
- /** Resets all fields other than fPathRef to their initial 'empty' values.
1972
- * Assumes the caller has already emptied fPathRef.
1973
- */
1974
- void resetFields();
1975
-
1976
- /** Sets all fields other than fPathRef to the values in 'that'.
1977
- * Assumes the caller has already set fPathRef.
1978
- * Doesn't change fGenerationID or fSourcePath on Android.
1979
- */
1980
- void copyFields(const SkPath& that);
1981
-
1982
- // Creates a new Path after the supplied arguments have been validated by
1983
- // SkPathPriv::AnalyzeVerbs().
1984
- static SkPath MakeInternal(const SkPathVerbAnalysis&,
1985
- const SkPoint[],
1986
- SkSpan<const SkPathVerb>,
1987
- const float conics[],
1988
- SkPathFillType,
1989
- bool isVolatile);
1990
- #endif
1991
1130
 
1992
1131
  size_t writeToMemoryAsRRect(void* buffer) const;
1993
- size_t readAsRRect(const void*, size_t);
1994
1132
 
1995
1133
  friend class Iter;
1996
1134
  friend class SkPathPriv;
1997
1135
  friend class SkPathStroker;
1998
1136
 
1999
- /* Append, in reverse order, the first contour of path, ignoring path's
2000
- last point. If no moveTo() call has been made for this contour, the
2001
- first point is automatically set to (0,0).
2002
- */
2003
- SkPath& reversePathTo(const SkPath&);
2004
-
2005
- // called before we add points for lineTo, quadTo, cubicTo, checking to see
2006
- // if we need to inject a leading moveTo first
2007
- //
2008
- // SkPath path; path.lineTo(...); <--- need a leading moveTo(0, 0)
2009
- // SkPath path; ... path.close(); path.lineTo(...) <-- need a moveTo(previous moveTo)
2010
- //
2011
- void injectMoveToIfNeeded();
2012
-
2013
- bool hasOnlyMoveTos() const {
2014
- return this->getSegmentMasks() == 0;
2015
- }
2016
-
2017
1137
  SkPathConvexity computeConvexity() const;
2018
1138
 
2019
1139
  bool isValidImpl() const;
@@ -2022,26 +1142,8 @@ private:
2022
1142
  */
2023
1143
  #ifdef SK_DEBUG
2024
1144
  void validate() const;
2025
- void validateRef() const;
2026
1145
  #endif
2027
1146
 
2028
- // called by stroker to see if all points (in the last contour) are equal and worthy of a cap
2029
- bool isZeroLengthSincePoint(int startPtIndex) const;
2030
-
2031
- /** Returns if the path can return a bound at no cost (true) or will have to
2032
- perform some computation (false).
2033
- */
2034
- bool hasComputedBounds() const;
2035
-
2036
- // 'rect' needs to be sorted
2037
- void setBounds(const SkRect& rect);
2038
-
2039
- void setPt(int index, SkScalar x, SkScalar y);
2040
-
2041
- SkPath& dirtyAfterEdit();
2042
-
2043
- void addRaw(const SkPathRaw&);
2044
-
2045
1147
  /** Returns the comvexity type, computing if needed. Never returns kUnknown.
2046
1148
  @return path's convexity type (convex or concave)
2047
1149
  */
@@ -2055,9 +1157,7 @@ private:
2055
1157
  */
2056
1158
  void setConvexity(SkPathConvexity) const;
2057
1159
 
2058
- friend class SkAutoAddSimpleShape; // setConvexity
2059
1160
  friend class SkPathBuilder;
2060
- friend class PathTest_Private; // unit test reversePathTo
2061
1161
  };
2062
1162
 
2063
1163
  #endif