|
1 | 1 | /* eslint-disable no-redeclare */
|
2 | 2 | import { CSSType, Color, Font, ImageSource, Utils, View } from '@nativescript/core';
|
3 | 3 | import { FontStyleType, FontWeightType } from '@nativescript/core/ui/styling/font';
|
4 |
| -import { Canvas as ICanvas, FontMetrics as IFontMetrics, Matrix as IMatrix, Paint as IPaint, Path as IPath, PorterDuffXfermode as IPorterDuffXfermode, Rect as IRect, RectF as IRectF } from './canvas'; |
| 4 | +import { |
| 5 | + Canvas as ICanvas, |
| 6 | + FontMetrics as IFontMetrics, |
| 7 | + Matrix as IMatrix, |
| 8 | + Paint as IPaint, |
| 9 | + Path as IPath, |
| 10 | + PorterDuffXfermode as IPorterDuffXfermode, |
| 11 | + Rect as IRect, |
| 12 | + RectF as IRectF, |
| 13 | + Shader as IShader |
| 14 | +} from './canvas'; |
5 | 15 | import type { CanvasView } from './index.ios';
|
6 | 16 | export * from './canvas.common';
|
7 | 17 |
|
@@ -870,7 +880,7 @@ export class Paint implements IPaint {
|
870 | 880 | dy: number;
|
871 | 881 | color: Color;
|
872 | 882 | };
|
873 |
| - shader; |
| 883 | + shader: Shader; |
874 | 884 | colorFilter;
|
875 | 885 | pathEffect: PathEffect;
|
876 | 886 | xfermode: IPorterDuffXfermode;
|
@@ -971,9 +981,6 @@ export class Paint implements IPaint {
|
971 | 981 | public getStrokeJoin(): Join {
|
972 | 982 | return this.strokeJoin;
|
973 | 983 | }
|
974 |
| - public getShader() { |
975 |
| - return this.shader; |
976 |
| - } |
977 | 984 | public getColorFilter() {
|
978 | 985 | return this.colorFilter;
|
979 | 986 | }
|
@@ -1007,11 +1014,15 @@ export class Paint implements IPaint {
|
1007 | 1014 | public getStrokeCap(): Cap {
|
1008 | 1015 | return this.strokeCap;
|
1009 | 1016 | }
|
1010 |
| - public setShader(value: any) { |
| 1017 | + public setShader(value: IShader) { |
1011 | 1018 | if (this.shader) {
|
1012 |
| - this.shader.release(); |
| 1019 | + (this.shader as any as Shader).release(); |
1013 | 1020 | }
|
1014 |
| - this.shader = value; |
| 1021 | + this.shader = value as any as Shader; |
| 1022 | + return value; |
| 1023 | + } |
| 1024 | + public getShader() { |
| 1025 | + return this.shader as any as IShader; |
1015 | 1026 | }
|
1016 | 1027 | public setColorFilter(value: any) {
|
1017 | 1028 | if (this.colorFilter) {
|
@@ -1158,7 +1169,7 @@ export class Paint implements IPaint {
|
1158 | 1169 |
|
1159 | 1170 | clear() {
|
1160 | 1171 | if (this.shader) {
|
1161 |
| - this.shader.clear(); |
| 1172 | + this.shader.release(); |
1162 | 1173 | this.shader = null;
|
1163 | 1174 | }
|
1164 | 1175 | if (this.colorFilter) {
|
@@ -2178,6 +2189,7 @@ class Shader {
|
2178 | 2189 | this.localMatrix = null;
|
2179 | 2190 | }
|
2180 | 2191 | }
|
| 2192 | + release() {} |
2181 | 2193 | }
|
2182 | 2194 | export class RadialGradient extends Shader {
|
2183 | 2195 | mGradient;
|
|
0 commit comments