@shopify/react-native-skia 0.1.121 → 0.1.122
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkApi.h +2 -0
- package/cpp/api/JsiSkColor.h +49 -0
- package/cpp/api/JsiSkPath.h +31 -2
- package/cpp/api/JsiSkPathFactory.h +96 -1
- package/cpp/api/third_party/CSSColorParser.h +324 -0
- package/cpp/rnskia/RNSkAnimation.h +4 -7
- package/cpp/rnskia/values/RNSkClockValue.h +4 -4
- package/cpp/rnskia/values/RNSkDerivedValue.h +1 -1
- package/cpp/rnskia/values/RNSkReadonlyValue.h +9 -15
- package/lib/commonjs/renderer/components/shapes/Path.js +1 -1
- package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Node.js +3 -3
- package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
- package/lib/commonjs/skia/Color.js +3 -25
- package/lib/commonjs/skia/Color.js.map +1 -1
- package/lib/commonjs/skia/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/Path/Path.js +13 -1
- package/lib/commonjs/skia/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/Skia.js +41 -3
- package/lib/commonjs/skia/Skia.js.map +1 -1
- package/lib/module/renderer/components/shapes/Path.js +1 -1
- package/lib/module/renderer/components/shapes/Path.js.map +1 -1
- package/lib/module/renderer/nodes/Node.js +3 -3
- package/lib/module/renderer/nodes/Node.js.map +1 -1
- package/lib/module/skia/Color.js +2 -21
- package/lib/module/skia/Color.js.map +1 -1
- package/lib/module/skia/Image/Image.js.map +1 -1
- package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/module/skia/Paint/Paint.js.map +1 -1
- package/lib/module/skia/Path/Path.js +11 -0
- package/lib/module/skia/Path/Path.js.map +1 -1
- package/lib/module/skia/Shader/Shader.js.map +1 -1
- package/lib/module/skia/Skia.js +43 -2
- package/lib/module/skia/Skia.js.map +1 -1
- package/lib/typescript/src/skia/Color.d.ts +0 -1
- package/lib/typescript/src/skia/Image/Image.d.ts +3 -3
- package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +2 -2
- package/lib/typescript/src/skia/Paint/Paint.d.ts +2 -2
- package/lib/typescript/src/skia/Path/Path.d.ts +13 -0
- package/lib/typescript/src/skia/Path/PathFactory.d.ts +7 -1
- package/lib/typescript/src/skia/Picture/Picture.d.ts +2 -2
- package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +3 -3
- package/lib/typescript/src/skia/Shader/Shader.d.ts +2 -2
- package/lib/typescript/src/skia/Shader/ShaderFactory.d.ts +9 -9
- package/lib/typescript/src/skia/Skia.d.ts +5 -3
- package/package.json +1 -1
- package/scripts/install-npm.js +1 -1
- package/src/renderer/components/shapes/Path.tsx +1 -1
- package/src/renderer/nodes/Node.ts +3 -3
- package/src/skia/Color.ts +3 -20
- package/src/skia/Image/Image.ts +3 -3
- package/src/skia/ImageFilter/ImageFilterFactory.ts +2 -2
- package/src/skia/Paint/Paint.ts +2 -2
- package/src/skia/Path/Path.ts +16 -0
- package/src/skia/Path/PathFactory.ts +8 -1
- package/src/skia/Picture/Picture.ts +2 -2
- package/src/skia/RuntimeEffect/RuntimeEffect.ts +4 -4
- package/src/skia/Shader/Shader.ts +2 -2
- package/src/skia/Shader/ShaderFactory.ts +9 -9
- package/src/skia/Skia.ts +44 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Color.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Color.ts"],"names":["Skia","alphaf","c","red","green","blue","rgbaColor","r","g","b","af","a","Math","round","processColorAsArray","cl","icl","Color","processColor","currentOpacity","processColorAsUnitArray"],"mappings":"AAAA,SAASA,IAAT,QAAqB,QAArB,C,CAEA;;AAKA,OAAO,MAAMC,MAAM,GAAIC,CAAD,IAAe,CAAEA,CAAC,IAAI,EAAN,GAAY,GAAb,IAAoB,GAAlD;AACP,OAAO,MAAMC,GAAG,GAAID,CAAD,IAAgBA,CAAC,IAAI,EAAN,GAAY,GAAvC;AACP,OAAO,MAAME,KAAK,GAAIF,CAAD,IAAgBA,CAAC,IAAI,CAAN,GAAW,GAAxC;AACP,OAAO,MAAMG,IAAI,GAAIH,CAAD,IAAeA,CAAC,GAAG,GAAhC;AACP,OAAO,MAAMI,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ,EAAuBC,CAAvB,EAAkCC,EAAlC,KAAiD;AACxE,QAAMC,CAAC,GAAGC,IAAI,CAACC,KAAL,CAAWH,EAAE,GAAG,GAAhB,CAAV;AACA,SAAO,CAAEC,CAAC,IAAI,EAAN,GAAaJ,CAAC,IAAI,EAAlB,GAAyBC,CAAC,IAAI,CAA9B,GAAmCC,CAApC,MAA2C,CAAlD;AACD,CAHM;;AAKP,MAAMK,mBAAmB,GAAIC,EAAD,IAAe;AACzC,QAAMC,GAAG,GAAG,OAAOD,EAAP,KAAc,QAAd,GAAyBf,IAAI,CAACiB,KAAL,CAAWF,EAAX,CAAzB,GAA0CA,EAAtD;AACA,QAAMR,CAAC,GAAGJ,GAAG,CAACa,GAAD,CAAb;AACA,QAAMR,CAAC,GAAGJ,KAAK,CAACY,GAAD,CAAf;AACA,QAAMP,CAAC,GAAGJ,IAAI,CAACW,GAAD,CAAd;AACA,QAAML,CAAC,GAAGV,MAAM,CAACe,GAAD,CAAhB;AACA,SAAO,CAACT,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUE,CAAV,CAAP;AACD,CAPD;;AASA,OAAO,MAAMO,YAAY,GAAG,CAACH,EAAD,EAAYI,cAAZ,KAAuC;AACjE,QAAM,CAACZ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUE,CAAV,IAAeG,mBAAmB,CAACC,EAAD,CAAxC;AACA,SAAOT,SAAS,CAACC,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUE,CAAC,GAAGQ,cAAd,CAAhB;AACD,CAHM;AAKP,OAAO,MAAMC,uBAAuB,GAAG,CAACL,EAAD,EAAYI,cAAZ,KAAuC;AAC5E,QAAM,CAACZ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUE,CAAV,IAAeG,mBAAmB,CAACC,EAAD,CAAxC;AACA,SAAO,CAACR,CAAC,GAAG,GAAL,EAAUC,CAAC,GAAG,GAAd,EAAmBC,CAAC,GAAG,GAAvB,EAA4BE,CAAC,GAAGQ,cAAhC,CAAP;AACD,CAHM","sourcesContent":["import { Skia } from \"./Skia\";\n\n// This is the JSI color. Currently a number. This may change.\nexport type SkColor = number;\n// Input colors can be string or number\nexport type Color = string | number;\n\nexport const alphaf = (c: number) => ((c >> 24) & 255) / 255;\nexport const red = (c: number) => (c >> 16) & 255;\nexport const green = (c: number) => (c >> 8) & 255;\nexport const blue = (c: number) => c & 255;\nexport const rgbaColor = (r: number, g: number, b: number, af: number) => {\n const a = Math.round(af * 255);\n return ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;\n};\n\nconst processColorAsArray = (cl: Color) => {\n const icl = typeof cl === \"string\" ? Skia.Color(cl) : cl;\n const r = red(icl);\n const g = green(icl);\n const b = blue(icl);\n const a = alphaf(icl);\n return [r, g, b, a] as const;\n};\n\nexport const processColor = (cl: Color, currentOpacity: number) => {\n const [r, g, b, a] = processColorAsArray(cl);\n return rgbaColor(r, g, b, a * currentOpacity);\n};\n\nexport const processColorAsUnitArray = (cl: Color, currentOpacity: number) => {\n const [r, g, b, a] = processColorAsArray(cl);\n return [r / 255, g / 255, b / 255, a * currentOpacity] as const;\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Image.ts"],"names":["FilterMode","MipmapMode","ImageFormat"],"mappings":"AAKA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type { TileMode } from \"../ImageFilter\";\nimport type {
|
1
|
+
{"version":3,"sources":["Image.ts"],"names":["FilterMode","MipmapMode","ImageFormat"],"mappings":"AAKA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type { TileMode } from \"../ImageFilter\";\nimport type { SkShader } from \"../Shader\";\nimport type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\nexport enum FilterMode {\n Linear,\n Nearest,\n}\n\nexport enum MipmapMode {\n None,\n Nearest,\n Linear,\n}\n\nexport enum ImageFormat {\n PNG,\n JPEG,\n WEBP,\n}\n\nexport interface SkImage extends SkJSIInstance<\"Image\"> {\n /**\n * Returns the possibly scaled height of the image.\n */\n height(): number;\n\n /**\n * Returns the possibly scaled width of the image.\n */\n width(): number;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param fm - The filter mode. (default nearest)\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps (default none)\n * calculated with makeCopyWithDefaultMipmaps;\n * @param localMatrix\n */\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param localMatrix\n */\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /** Encodes Image pixels, returning result as UInt8Array. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return Uint8Array with data\n */\n encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;\n\n /** Encodes Image pixels, returning result as a base64 encoded string. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return base64 encoded string of data\n */\n encodeToBase64(fmt?: ImageFormat, quality?: number): string;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AAQA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type {
|
1
|
+
{"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AAQA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { IMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type {
|
1
|
+
{"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { IMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkShader } from \"../Shader\";\nimport type { SkColor } from \"../Color\";\nimport type { IPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Bevel,\n Miter,\n Round,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: IMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: IPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
|
@@ -20,5 +20,16 @@ export let PathOp;
|
|
20
20
|
PathOp[PathOp["ReverseDifference"] = 4] = "ReverseDifference";
|
21
21
|
})(PathOp || (PathOp = {}));
|
22
22
|
|
23
|
+
export let PathVerb;
|
24
|
+
|
25
|
+
(function (PathVerb) {
|
26
|
+
PathVerb[PathVerb["Move"] = 0] = "Move";
|
27
|
+
PathVerb[PathVerb["Line"] = 1] = "Line";
|
28
|
+
PathVerb[PathVerb["Quad"] = 2] = "Quad";
|
29
|
+
PathVerb[PathVerb["Conic"] = 3] = "Conic";
|
30
|
+
PathVerb[PathVerb["Cubic"] = 4] = "Cubic";
|
31
|
+
PathVerb[PathVerb["Close"] = 5] = "Close";
|
32
|
+
})(PathVerb || (PathVerb = {}));
|
33
|
+
|
23
34
|
export const isPath = obj => obj !== null && obj.__typename__ === "Path";
|
24
35
|
//# sourceMappingURL=Path.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Path.ts"],"names":["FillType","PathOp","isPath","obj","__typename__"],"mappings":"AAQA;AACA;AACA;AAeA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,WAAYC,MAAZ;;WAAYA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;GAAAA,M,KAAAA,M;;AAQZ,OAAO,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC","sourcesContent":["import type { SkFont } from \"../Font\";\nimport type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n // eslint-disable-next-line camelcase\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath =>\n obj !== null && obj.__typename__ === \"Path\";\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): void;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): void;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): void;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): void;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): void;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\n */\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ): void;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number): void;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): void;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): void;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): void;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n */\n stroke(opts?: StrokeOpts): boolean;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): void;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n * @param outputArray - if provided, the bounding box will be copied into this array instead of\n * allocating a new one.\n */\n computeTightBounds(outputArray?: SkRect): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\n */\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): void;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): void;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): void;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: SkRRect, isCCW?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n addCircle(x: number, y: number, r: number): void;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): boolean;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: SkMatrix): void;\n\n /**\n * Converts the text to a path with the given font at location x / y.\n */\n fromText(text: string, x: number, y: number, font: SkFont): void;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @return Path replaced by interpolated averages or undefined if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number): SkPath;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n}\n"]}
|
1
|
+
{"version":3,"sources":["Path.ts"],"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"mappings":"AAQA;AACA;AACA;AAeA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,WAAYC,MAAZ;;WAAYA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;GAAAA,M,KAAAA,M;;AAQZ,WAAYC,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAWZ,OAAO,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC","sourcesContent":["import type { SkFont } from \"../Font\";\nimport type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n // eslint-disable-next-line camelcase\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath =>\n obj !== null && obj.__typename__ === \"Path\";\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): void;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): void;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): void;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): void;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): void;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\n */\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ): void;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number): void;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): void;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): void;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): void;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n */\n stroke(opts?: StrokeOpts): boolean;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): void;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n * @param outputArray - if provided, the bounding box will be copied into this array instead of\n * allocating a new one.\n */\n computeTightBounds(outputArray?: SkRect): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\n */\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): void;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): void;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): void;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: SkRRect, isCCW?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n addCircle(x: number, y: number, r: number): void;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): boolean;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: SkMatrix): void;\n\n /**\n * Converts the text to a path with the given font at location x / y.\n */\n fromText(text: string, x: number, y: number, font: SkFont): void;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @return Path replaced by interpolated averages or undefined if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number): SkPath;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Shader.ts"],"names":["isShader","obj","__typename__"],"mappings":"AAEA,OAAO,MAAMA,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,QADhC","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is
|
1
|
+
{"version":3,"sources":["Shader.ts"],"names":["isShader","obj","__typename__"],"mappings":"AAEA,OAAO,MAAMA,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,QADhC","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>\n obj !== null && obj.__typename__ === \"Shader\";\n\nexport type SkShader = SkJSIInstance<\"Shader\">;\n"]}
|
package/lib/module/skia/Skia.js
CHANGED
@@ -1,7 +1,47 @@
|
|
1
|
+
import { Platform, processColor } from "react-native";
|
1
2
|
/*global SkiaApi*/
|
2
|
-
|
3
|
+
|
3
4
|
import "./NativeSetup";
|
4
5
|
|
6
|
+
/*
|
7
|
+
* Parse CSS colors
|
8
|
+
*/
|
9
|
+
const SkiaColor = cl => {
|
10
|
+
if (typeof cl === "number") {
|
11
|
+
return cl;
|
12
|
+
}
|
13
|
+
|
14
|
+
const color = Skia.parseColorString(cl);
|
15
|
+
|
16
|
+
if (color !== undefined) {
|
17
|
+
return color;
|
18
|
+
} else {
|
19
|
+
// If the color is not recognized, we fallback to React Native
|
20
|
+
let rnColor = processColor(cl); // 1. Neither Skia or RN could parse the color
|
21
|
+
|
22
|
+
if (typeof rnColor !== "number") {
|
23
|
+
throw new Error("Skia couldn't parse the following color " + cl); // 2. The color is recognized by RN but not by Skia
|
24
|
+
} else {
|
25
|
+
console.warn("Skia couldn't parse the following color " + cl + ". The color parsing was delegated to React Native. Please file on issue with that color."); // On android we need to move the alpha byte to the start of the structure
|
26
|
+
|
27
|
+
if (Platform.OS === "android") {
|
28
|
+
rnColor = rnColor >>> 0;
|
29
|
+
const a = rnColor >> 24 & 0xff;
|
30
|
+
const r = rnColor >> 16 & 0xff;
|
31
|
+
const g = rnColor >> 8 & 0xff;
|
32
|
+
const b = rnColor & 0xff;
|
33
|
+
rnColor = (a << 24 | r << 16 | g << 8 | b) >>> 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
return rnColor;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
/**
|
41
|
+
* Declares the interface for the native Skia API
|
42
|
+
*/
|
43
|
+
|
44
|
+
|
5
45
|
/**
|
6
46
|
* Declares the implemented API with overrides.
|
7
47
|
*/
|
@@ -30,7 +70,8 @@ export const Skia = {
|
|
30
70
|
ColorFilter: SkiaApi.ColorFilter,
|
31
71
|
ContourMeasureIter: SkiaApi.ContourMeasureIter,
|
32
72
|
// Here are constructors for data types which are represented as typed arrays in CanvasKit
|
33
|
-
Color:
|
73
|
+
Color: SkiaColor,
|
74
|
+
parseColorString: SkiaApi.parseColorString,
|
34
75
|
RSXform: SkiaApi.RSXform,
|
35
76
|
// For the following methods the factory symmetry is broken to be comptatible with CanvasKit
|
36
77
|
MakeSurface: SkiaApi.Surface.Make,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Skia.ts"],"names":["processColor","Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","
|
1
|
+
{"version":3,"sources":["Skia.ts"],"names":["Platform","processColor","SkiaColor","cl","color","Skia","parseColorString","undefined","rnColor","Error","console","warn","OS","a","r","g","b","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,YAAnB,QAAuC,cAAvC;AAEA;;AAsBA,OAAO,eAAP;;AAOA;AACA;AACA;AACA,MAAMC,SAAS,GAAIC,EAAD,IAAe;AAC/B,MAAI,OAAOA,EAAP,KAAc,QAAlB,EAA4B;AAC1B,WAAOA,EAAP;AACD;;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,gBAAL,CAAsBH,EAAtB,CAAd;;AACA,MAAIC,KAAK,KAAKG,SAAd,EAAyB;AACvB,WAAOH,KAAP;AACD,GAFD,MAEO;AACL;AACA,QAAII,OAAO,GAAGP,YAAY,CAACE,EAAD,CAA1B,CAFK,CAGL;;AACA,QAAI,OAAOK,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,YAAM,IAAIC,KAAJ,CAAU,6CAA6CN,EAAvD,CAAN,CAD+B,CAE/B;AACD,KAHD,MAGO;AACLO,MAAAA,OAAO,CAACC,IAAR,CACE,6CACER,EADF,GAEE,0FAHJ,EADK,CAML;;AACA,UAAIH,QAAQ,CAACY,EAAT,KAAgB,SAApB,EAA+B;AAC7BJ,QAAAA,OAAO,GAAGA,OAAO,KAAK,CAAtB;AACA,cAAMK,CAAC,GAAIL,OAAO,IAAI,EAAZ,GAAkB,IAA5B;AACA,cAAMM,CAAC,GAAIN,OAAO,IAAI,EAAZ,GAAkB,IAA5B;AACA,cAAMO,CAAC,GAAIP,OAAO,IAAI,CAAZ,GAAiB,IAA3B;AACA,cAAMQ,CAAC,GAAGR,OAAO,GAAG,IAApB;AACAA,QAAAA,OAAO,GAAG,CAAEK,CAAC,IAAI,EAAN,GAAaC,CAAC,IAAI,EAAlB,GAAyBC,CAAC,IAAI,CAA9B,GAAmCC,CAApC,MAA2C,CAArD;AACD;;AACD,aAAOR,OAAP;AACD;AACF;AACF,CAhCD;AAkCA;AACA;AACA;;;AA2DA;AACA;AACA;AACA,OAAO,MAAMH,IAAI,GAAG;AAClB;AACAY,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,KAAK,EAAEf,OAAO,CAACe,KAlBG;AAmBlBC,EAAAA,eAAe,EAAEhB,OAAO,CAACgB,eAnBP;AAoBlBC,EAAAA,OAAO,EAAEjB,OAAO,CAACiB,OApBC;AAqBlBC,EAAAA,IAAI,EAAElB,OAAO,CAACkB,IArBI;AAsBlBC,EAAAA,WAAW,EAAEnB,OAAO,CAACmB,WAtBH;AAuBlBC,EAAAA,kBAAkB,EAAEpB,OAAO,CAACoB,kBAvBV;AAwBlB;AACAC,EAAAA,KAAK,EAAErC,SAzBW;AA0BlBI,EAAAA,gBAAgB,EAAEY,OAAO,CAACZ,gBA1BR;AA2BlBkC,EAAAA,OAAO,EAAEtB,OAAO,CAACsB,OA3BC;AA4BlB;AACAC,EAAAA,WAAW,EAAEvB,OAAO,CAACwB,OAAR,CAAgBC,IA7BX;AA8BlBC,EAAAA,oBAAoB,EAAE1B,OAAO,CAAC2B,KAAR,CAAcD,oBA9BlB;AA+BlBE,EAAAA,SAAS,EAAE5B,OAAO,CAAC2B,KAAR,CAAcC,SA/BP;AAgClBC,EAAAA,YAAY,EAAE7B,OAAO,CAAC6B;AAhCJ,CAAb","sourcesContent":["import { Platform, processColor } from \"react-native\";\n\n/*global SkiaApi*/\nimport type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\n\n/*\n * Parse CSS colors\n */\nconst SkiaColor = (cl: Color) => {\n if (typeof cl === \"number\") {\n return cl;\n }\n const color = Skia.parseColorString(cl);\n if (color !== undefined) {\n return color;\n } else {\n // If the color is not recognized, we fallback to React Native\n let rnColor = processColor(cl);\n // 1. Neither Skia or RN could parse the color\n if (typeof rnColor !== \"number\") {\n throw new Error(\"Skia couldn't parse the following color \" + cl);\n // 2. The color is recognized by RN but not by Skia\n } else {\n console.warn(\n \"Skia couldn't parse the following color \" +\n cl +\n \". The color parsing was delegated to React Native. Please file on issue with that color.\"\n );\n // On android we need to move the alpha byte to the start of the structure\n if (Platform.OS === \"android\") {\n rnColor = rnColor >>> 0;\n const a = (rnColor >> 24) & 0xff;\n const r = (rnColor >> 16) & 0xff;\n const g = (rnColor >> 8) & 0xff;\n const b = rnColor & 0xff;\n rnColor = ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;\n }\n return rnColor;\n }\n }\n};\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: Skia;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n // Here are constructors for data types which are represented as typed arrays in CanvasKit\n Color: SkiaColor,\n parseColorString: SkiaApi.parseColorString,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
|
@@ -5,6 +5,5 @@ export declare const red: (c: number) => number;
|
|
5
5
|
export declare const green: (c: number) => number;
|
6
6
|
export declare const blue: (c: number) => number;
|
7
7
|
export declare const rgbaColor: (r: number, g: number, b: number, af: number) => number;
|
8
|
-
export declare const processColorAsInt: (color?: string | number | undefined) => SkColor;
|
9
8
|
export declare const processColor: (cl: Color, currentOpacity: number) => number;
|
10
9
|
export declare const processColorAsUnitArray: (cl: Color, currentOpacity: number) => readonly [number, number, number, number];
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { TileMode } from "../ImageFilter";
|
2
|
-
import type {
|
2
|
+
import type { SkShader } from "../Shader";
|
3
3
|
import type { SkMatrix } from "../Matrix";
|
4
4
|
import type { SkJSIInstance } from "../JsiInstance";
|
5
5
|
export declare enum FilterMode {
|
@@ -34,7 +34,7 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
34
34
|
* calculated with makeCopyWithDefaultMipmaps;
|
35
35
|
* @param localMatrix
|
36
36
|
*/
|
37
|
-
makeShaderOptions(tx: TileMode, ty: TileMode, fm: FilterMode, mm: MipmapMode, localMatrix?: SkMatrix):
|
37
|
+
makeShaderOptions(tx: TileMode, ty: TileMode, fm: FilterMode, mm: MipmapMode, localMatrix?: SkMatrix): SkShader;
|
38
38
|
/**
|
39
39
|
* Returns this image as a shader with the specified tiling. It will use cubic sampling.
|
40
40
|
* @param tx - tile mode in the x direction.
|
@@ -43,7 +43,7 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
43
43
|
* @param C - See CubicResampler in SkSamplingOptions.h for more information
|
44
44
|
* @param localMatrix
|
45
45
|
*/
|
46
|
-
makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix):
|
46
|
+
makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
|
47
47
|
/** Encodes Image pixels, returning result as UInt8Array. Returns existing
|
48
48
|
encoded data if present; otherwise, SkImage is encoded with
|
49
49
|
SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { SkColor } from "../Color";
|
2
2
|
import type { SkColorFilter } from "../ColorFilter/ColorFilter";
|
3
|
-
import type {
|
3
|
+
import type { SkShader } from "../Shader/Shader";
|
4
4
|
import type { SkRect } from "../Rect";
|
5
5
|
import type { BlendMode } from "../Paint/BlendMode";
|
6
6
|
import type { SkImageFilter, TileMode } from "./ImageFilter";
|
@@ -35,7 +35,7 @@ export interface ImageFilterFactory {
|
|
35
35
|
* @param shader - The Shader to be transformed
|
36
36
|
* @param input - if null, it will use the dynamic source image
|
37
37
|
*/
|
38
|
-
MakeShader(shader:
|
38
|
+
MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;
|
39
39
|
/**
|
40
40
|
* Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode
|
41
41
|
* is used when the blur kernel goes outside the input image.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { SkImageFilter } from "../ImageFilter";
|
2
2
|
import type { IMaskFilter } from "../MaskFilter";
|
3
3
|
import type { SkColorFilter } from "../ColorFilter";
|
4
|
-
import type {
|
4
|
+
import type { SkShader } from "../Shader";
|
5
5
|
import type { SkColor } from "../Color";
|
6
6
|
import type { IPathEffect } from "../PathEffect";
|
7
7
|
import type { SkJSIInstance } from "../JsiInstance";
|
@@ -98,7 +98,7 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
|
|
98
98
|
* Sets the current shader, replacing the existing one if there was one.
|
99
99
|
* @param shader
|
100
100
|
*/
|
101
|
-
setShader(shader:
|
101
|
+
setShader(shader: SkShader | null): void;
|
102
102
|
/**
|
103
103
|
* Sets the geometry drawn at the beginning and end of strokes.
|
104
104
|
* @param cap
|
@@ -33,6 +33,15 @@ export declare enum PathOp {
|
|
33
33
|
XOR = 3,
|
34
34
|
ReverseDifference = 4
|
35
35
|
}
|
36
|
+
export declare enum PathVerb {
|
37
|
+
Move = 0,
|
38
|
+
Line = 1,
|
39
|
+
Quad = 2,
|
40
|
+
Conic = 3,
|
41
|
+
Cubic = 4,
|
42
|
+
Close = 5
|
43
|
+
}
|
44
|
+
export declare type PathCommand = number[];
|
36
45
|
export declare const isPath: (obj: SkJSIInstance<string> | null) => obj is SkPath;
|
37
46
|
export interface SkPath extends SkJSIInstance<"Path"> {
|
38
47
|
/**
|
@@ -440,4 +449,8 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
440
449
|
*
|
441
450
|
* */
|
442
451
|
isInterpolatable(compare: SkPath): boolean;
|
452
|
+
/**
|
453
|
+
* Serializes the contents of this path as a series of commands.
|
454
|
+
*/
|
455
|
+
toCmds(): PathCommand[];
|
443
456
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { SkPath, PathOp } from "./Path";
|
1
|
+
import type { SkPath, PathOp, PathCommand } from "./Path";
|
2
2
|
export interface PathFactory {
|
3
3
|
Make(): SkPath;
|
4
4
|
/**
|
@@ -15,4 +15,10 @@ export interface PathFactory {
|
|
15
15
|
* @param op
|
16
16
|
*/
|
17
17
|
MakeFromOp(one: SkPath, two: SkPath, op: PathOp): SkPath | null;
|
18
|
+
/**
|
19
|
+
* Creates a new path from the given list of path commands. If this fails, null will be
|
20
|
+
* returned instead.
|
21
|
+
* @param cmds
|
22
|
+
*/
|
23
|
+
MakeFromCmds(cmds: PathCommand[]): SkPath | null;
|
18
24
|
}
|
@@ -2,7 +2,7 @@ import type { InputColorMatrix } from "../ColorFilter";
|
|
2
2
|
import type { FilterMode } from "../Image";
|
3
3
|
import type { TileMode } from "../ImageFilter";
|
4
4
|
import type { SkRect } from "../Rect";
|
5
|
-
import type {
|
5
|
+
import type { SkShader } from "../Shader";
|
6
6
|
export interface SkPicture {
|
7
7
|
/**
|
8
8
|
* Returns a new shader that will draw with this picture.
|
@@ -17,7 +17,7 @@ export interface SkPicture {
|
|
17
17
|
* and cropping). If null, the tile rect is considered equal to the picture
|
18
18
|
* bounds.
|
19
19
|
*/
|
20
|
-
makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: InputColorMatrix, tileRect?: SkRect):
|
20
|
+
makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: InputColorMatrix, tileRect?: SkRect): SkShader;
|
21
21
|
/**
|
22
22
|
* Returns the serialized format of this SkPicture. The format may change at anytime and
|
23
23
|
* no promises are made for backwards or forward compatibility.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { SkShader } from "../Shader";
|
2
2
|
import type { SkJSIInstance } from "../JsiInstance";
|
3
3
|
import type { SkMatrix } from "../Matrix";
|
4
4
|
export interface SkSLUniform {
|
@@ -15,7 +15,7 @@ export interface IRuntimeEffect extends SkJSIInstance<"RuntimeEffect"> {
|
|
15
15
|
* @param isOpaque
|
16
16
|
* @param localMatrix
|
17
17
|
*/
|
18
|
-
makeShader(uniforms: number[], isOpaque?: boolean, localMatrix?: SkMatrix):
|
18
|
+
makeShader(uniforms: number[], isOpaque?: boolean, localMatrix?: SkMatrix): SkShader;
|
19
19
|
/**
|
20
20
|
* Returns a shader executed using the given uniform data and the children as inputs.
|
21
21
|
* @param uniforms
|
@@ -23,7 +23,7 @@ export interface IRuntimeEffect extends SkJSIInstance<"RuntimeEffect"> {
|
|
23
23
|
* @param children
|
24
24
|
* @param localMatrix
|
25
25
|
*/
|
26
|
-
makeShaderWithChildren(uniforms: number[], isOpaque?: boolean, children?:
|
26
|
+
makeShaderWithChildren(uniforms: number[], isOpaque?: boolean, children?: SkShader[], localMatrix?: SkMatrix): SkShader;
|
27
27
|
/**
|
28
28
|
* Returns the nth uniform from the effect.
|
29
29
|
* @param index
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
-
export declare const isShader: (obj: SkJSIInstance<string> | null) => obj is
|
3
|
-
export declare type
|
2
|
+
export declare const isShader: (obj: SkJSIInstance<string> | null) => obj is SkShader;
|
3
|
+
export declare type SkShader = SkJSIInstance<"Shader">;
|
@@ -3,7 +3,7 @@ import type { SkPoint } from "../Point";
|
|
3
3
|
import type { SkMatrix } from "../Matrix";
|
4
4
|
import type { SkColor } from "../Color";
|
5
5
|
import type { BlendMode } from "../Paint/BlendMode";
|
6
|
-
import type {
|
6
|
+
import type { SkShader } from "./Shader";
|
7
7
|
export interface ShaderFactory {
|
8
8
|
/**
|
9
9
|
* Returns a shader that generates a linear gradient between the two specified points.
|
@@ -20,7 +20,7 @@ export interface ShaderFactory {
|
|
20
20
|
* gradients will premultiply their colors first, and then interpolate
|
21
21
|
* between them.
|
22
22
|
*/
|
23
|
-
MakeLinearGradient(start: SkPoint, end: SkPoint, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number):
|
23
|
+
MakeLinearGradient(start: SkPoint, end: SkPoint, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number): SkShader;
|
24
24
|
/**
|
25
25
|
* Returns a shader that generates a radial gradient given the center and radius.
|
26
26
|
* See SkGradientShader.h for more.
|
@@ -33,7 +33,7 @@ export interface ShaderFactory {
|
|
33
33
|
* @param localMatrix
|
34
34
|
* @param flags - 0 to interpolate colors in unpremul, 1 to interpolate colors in premul.
|
35
35
|
*/
|
36
|
-
MakeRadialGradient(center: SkPoint, radius: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number):
|
36
|
+
MakeRadialGradient(center: SkPoint, radius: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number): SkShader;
|
37
37
|
/**
|
38
38
|
* Returns a shader that generates a conical gradient given two circles.
|
39
39
|
* See SkGradientShader.h for more.
|
@@ -47,7 +47,7 @@ export interface ShaderFactory {
|
|
47
47
|
* @param localMatrix
|
48
48
|
* @param flags
|
49
49
|
*/
|
50
|
-
MakeTwoPointConicalGradient(start: SkPoint, startRadius: number, end: SkPoint, endRadius: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number):
|
50
|
+
MakeTwoPointConicalGradient(start: SkPoint, startRadius: number, end: SkPoint, endRadius: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix, flags?: number): SkShader;
|
51
51
|
/**
|
52
52
|
* Returns a shader that generates a sweep gradient given a center.
|
53
53
|
* See SkGradientShader.h for more.
|
@@ -62,7 +62,7 @@ export interface ShaderFactory {
|
|
62
62
|
* @param startAngle - angle corresponding to 0.0. Defaults to 0 degrees.
|
63
63
|
* @param endAngle - angle corresponding to 1.0. Defaults to 360 degrees.
|
64
64
|
*/
|
65
|
-
MakeSweepGradient(cx: number, cy: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix | null, flags?: number, startAngleInDegrees?: number, endAngleInDegrees?: number):
|
65
|
+
MakeSweepGradient(cx: number, cy: number, colors: SkColor[], pos: number[] | null, mode: TileMode, localMatrix?: SkMatrix | null, flags?: number, startAngleInDegrees?: number, endAngleInDegrees?: number): SkShader;
|
66
66
|
/**
|
67
67
|
* Returns a shader with Perlin Turbulence.
|
68
68
|
* See SkPerlinNoiseShader.h for more details
|
@@ -75,7 +75,7 @@ export interface ShaderFactory {
|
|
75
75
|
* @param tileH - if this and tileW are non-zero, the frequencies will be modified so that the
|
76
76
|
* noise will be tileable for the given size.
|
77
77
|
*/
|
78
|
-
MakeTurbulence(baseFreqX: number, baseFreqY: number, octaves: number, seed: number, tileW: number, tileH: number):
|
78
|
+
MakeTurbulence(baseFreqX: number, baseFreqY: number, octaves: number, seed: number, tileW: number, tileH: number): SkShader;
|
79
79
|
/**
|
80
80
|
* Returns a shader with Perlin Fractal Noise.
|
81
81
|
* See SkPerlinNoiseShader.h for more details
|
@@ -88,17 +88,17 @@ export interface ShaderFactory {
|
|
88
88
|
* @param tileH - if this and tileW are non-zero, the frequencies will be modified so that the
|
89
89
|
* noise will be tileable for the given size.
|
90
90
|
*/
|
91
|
-
MakeFractalNoise(baseFreqX: number, baseFreqY: number, octaves: number, seed: number, tileW: number, tileH: number):
|
91
|
+
MakeFractalNoise(baseFreqX: number, baseFreqY: number, octaves: number, seed: number, tileW: number, tileH: number): SkShader;
|
92
92
|
/**
|
93
93
|
* Returns a shader that combines the given shaders with a BlendMode.
|
94
94
|
* @param mode
|
95
95
|
* @param one
|
96
96
|
* @param two
|
97
97
|
*/
|
98
|
-
MakeBlend(mode: BlendMode, one:
|
98
|
+
MakeBlend(mode: BlendMode, one: SkShader, two: SkShader): SkShader;
|
99
99
|
/**
|
100
100
|
* Returns a shader with a given color and colorspace.
|
101
101
|
* @param color
|
102
102
|
*/
|
103
|
-
MakeColor(color: SkColor):
|
103
|
+
MakeColor(color: SkColor): SkShader;
|
104
104
|
}
|
@@ -10,8 +10,6 @@ import type { SkRect } from "./Rect";
|
|
10
10
|
import type { SkRRect } from "./RRect";
|
11
11
|
import type { RuntimeEffectFactory } from "./RuntimeEffect";
|
12
12
|
import type { ShaderFactory } from "./Shader";
|
13
|
-
import type { SkColor } from "./Color";
|
14
|
-
import { processColor } from "./Color";
|
15
13
|
import type { SkMatrix } from "./Matrix";
|
16
14
|
import type { PathEffectFactory } from "./PathEffect";
|
17
15
|
import type { SkPoint } from "./Point";
|
@@ -26,6 +24,7 @@ import type { SkRSXform } from "./RSXform";
|
|
26
24
|
import type { SkPath } from "./Path/Path";
|
27
25
|
import type { SkContourMeasureIter } from "./ContourMeasure";
|
28
26
|
import type { PictureFactory, SkPictureRecorder } from "./Picture";
|
27
|
+
import type { Color, SkColor } from "./Color";
|
29
28
|
/**
|
30
29
|
* Declares the interface for the native Skia API
|
31
30
|
*/
|
@@ -34,6 +33,8 @@ export interface Skia {
|
|
34
33
|
XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;
|
35
34
|
RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
|
36
35
|
RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
|
36
|
+
Color: (color: Color) => SkColor;
|
37
|
+
parseColorString: (color: string) => SkColor | undefined;
|
37
38
|
ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
|
38
39
|
Paint: () => SkPaint;
|
39
40
|
PictureRecorder: () => SkPictureRecorder;
|
@@ -97,7 +98,8 @@ export declare const Skia: {
|
|
97
98
|
Path: PathFactory;
|
98
99
|
ColorFilter: ColorFilterFactory;
|
99
100
|
ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
|
100
|
-
Color: (
|
101
|
+
Color: (cl: Color) => number;
|
102
|
+
parseColorString: (color: string) => SkColor | undefined;
|
101
103
|
RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
|
102
104
|
MakeSurface: (width: number, height: number) => import("./Surface").ISurface | null;
|
103
105
|
MakeImageFromEncoded: (encoded: import("./Data").Data) => import("./Image").SkImage | null;
|
package/package.json
CHANGED
package/scripts/install-npm.js
CHANGED
@@ -9,7 +9,7 @@ const createSymlink = (p) => {
|
|
9
9
|
const dstDir = path.resolve(`./android/cpp/${p}`);
|
10
10
|
|
11
11
|
if (!fs.existsSync(dstDir) || !fs.lstatSync(dstDir).isSymbolicLink()) {
|
12
|
-
fs.symlinkSync(srcDir, dstDir, "
|
12
|
+
fs.symlinkSync(srcDir, dstDir, "junction");
|
13
13
|
}
|
14
14
|
};
|
15
15
|
|