@@ -61,11 +61,13 @@ public class Canvas2DContext : RenderingContext
61
61
"repeat" , "repeat-x" , "repeat-y" , "no-repeat"
62
62
} ;
63
63
64
+ private const string GET_IMAGE_DATA_METHOD = "getImageData" ;
65
+ private const string PUT_IMAGE_DATA_METHOD = "putImageData" ;
64
66
#endregion
65
67
66
68
#region Properties
67
69
68
- public object FillStyle { get ; private set ; } = "#000" ;
70
+ public string FillStyle { get ; private set ; } = "#000" ;
69
71
70
72
public string StrokeStyle { get ; private set ; } = "#000" ;
71
73
@@ -96,7 +98,6 @@ public class Canvas2DContext : RenderingContext
96
98
public float ShadowOffsetY { get ; private set ; }
97
99
98
100
public float GlobalAlpha { get ; private set ; } = 1.0f ;
99
-
100
101
public string GlobalCompositeOperation { get ; private set ; } = "source-over" ;
101
102
102
103
#endregion Properties
@@ -107,10 +108,10 @@ public Canvas2DContext(BECanvasComponent reference) : base(reference, CONTEXT_NA
107
108
108
109
#region Property Setters
109
110
110
- public async Task SetFillStyleAsync ( object value )
111
+ public async Task SetFillStyleAsync ( string value )
111
112
{
112
113
this . FillStyle = value ;
113
- await this . BatchCallAsync ( FILL_STYLE_PROPERTY , false , value ) ;
114
+ await this . BatchCallAsync ( FILL_STYLE_PROPERTY , isMethodCall : false , value ) ;
114
115
}
115
116
116
117
public async Task SetStrokeStyleAsync ( string value )
@@ -202,7 +203,6 @@ public async Task SetGlobalAlphaAsync(float value)
202
203
this . GlobalAlpha = value ;
203
204
await this . BatchCallAsync ( GLOBAL_ALPHA_PROPERTY , isMethodCall : false , value ) ;
204
205
}
205
-
206
206
public async Task SetGlobalCompositeOperationAsync ( string value )
207
207
{
208
208
this . GlobalCompositeOperation = value ;
@@ -212,7 +212,6 @@ public async Task SetGlobalCompositeOperationAsync(string value)
212
212
#endregion Property Setters
213
213
214
214
#region Methods
215
-
216
215
[ Obsolete ( "Use the async version instead, which is already called internally." ) ]
217
216
public void FillRect ( double x , double y , double width , double height ) => this . CallMethod < object > ( FILL_RECT_METHOD , x , y , width , height ) ;
218
217
public async Task FillRectAsync ( double x , double y , double width , double height ) => await this . BatchCallAsync ( FILL_RECT_METHOD , isMethodCall : true , x , y , width , height ) ;
@@ -337,12 +336,19 @@ public async Task SetGlobalCompositeOperationAsync(string value)
337
336
public void Restore ( ) => this . CallMethod < object > ( RESTORE_METHOD ) ;
338
337
public async Task RestoreAsync ( ) => await this . BatchCallAsync ( RESTORE_METHOD , isMethodCall : true ) ;
339
338
339
+ [ Obsolete ( "Use the async version instead, which is already called internally." ) ]
340
+ public ImageData GetImageData ( double sx , double sy , double sh , double sw ) => this . CallMethod < ImageData > ( GET_IMAGE_DATA_METHOD , sx , sy , sh , sw ) ;
341
+ public async Task < ImageData > GetImageDataAsync ( double sx , double sy , double sh , double sw ) => await this . CallMethodAsync < ImageData > ( GET_IMAGE_DATA_METHOD , sx , sy , sh , sw ) ;
342
+
343
+ [ Obsolete ( "Use the async version instead, which is already called internally." ) ]
344
+ public void PutImageData ( ImageData imageData , double dx , double dy ) => this . CallMethod < object > ( PUT_IMAGE_DATA_METHOD , imageData , dx , dy ) ;
345
+ public async Task PutImageDataAsync ( ImageData imageData , double dx , double dy ) => await this . CallMethodAsync < object > ( PUT_IMAGE_DATA_METHOD , imageData , dx , dy ) ;
346
+
340
347
public async Task DrawImageAsync ( ElementReference elementReference , double dx , double dy ) => await this . BatchCallAsync ( DRAW_IMAGE_METHOD , isMethodCall : true , elementReference , dx , dy ) ;
341
348
public async Task DrawImageAsync ( ElementReference elementReference , double dx , double dy , double dWidth , double dHeight ) => await this . BatchCallAsync ( DRAW_IMAGE_METHOD , isMethodCall : true , elementReference , dx , dy , dWidth , dHeight ) ;
342
349
public async Task DrawImageAsync ( ElementReference elementReference , double sx , double sy , double sWidth , double sHeight , double dx , double dy , double dWidth , double dHeight ) => await this . BatchCallAsync ( DRAW_IMAGE_METHOD , isMethodCall : true , elementReference , sx , sy , sWidth , sHeight , dx , dy , dWidth , dHeight ) ;
343
-
344
350
public async Task < object > CreatePatternAsync ( ElementReference image , RepeatPattern repeat ) => await this . CallMethodAsync < object > ( CREATE_PATTERN_METHOD , image , this . _repeatNames [ ( int ) repeat ] ) ;
345
351
346
352
#endregion Methods
347
353
}
348
- }
354
+ }
0 commit comments