You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| style |`object`| Styles to be applied on canvas component |
87
88
| strokeColor |`string`| Set the color of stroke, which can be #RRGGBB or #RRGGBBAA. If strokeColor is set to #00000000, it will automatically become an eraser. <br/>NOTE: Once an eraser path is sent to Android, Android View will disable hardware acceleration automatically. It might reduce the canvas performance afterward. |
88
89
| strokeWidth |`number`| The thickness of stroke |
| folder? | string | Android: the folder name in `Pictures` directory<br/>iOS: if `filename` is not null, image will save to temporary directory with folder and filename, otherwise, it will save to camera roll |
333
334
| filename? | string | the file name of image<br/>iOS: Set to `null` to save image to camera roll. |
334
335
| transparent | boolean | save canvas with transparent background, ignored if imageType is `jpg`|
@@ -339,7 +340,7 @@ Note: Because native module cannot read the file in JS bundle, file path cannot
339
340
340
341
### Path object
341
342
342
-
```typescript
343
+
```json5
343
344
{
344
345
drawer:'user1',
345
346
size: { // the size of drawer's canvas
@@ -361,7 +362,7 @@ Note: Because native module cannot read the file in JS bundle, file path cannot
361
362
362
363
### LocalSourceImage object
363
364
364
-
```typescript
365
+
```json5
365
366
{
366
367
filename:'image.png', // e.g. 'image.png' or '/storage/sdcard0/Pictures/image.png'
367
368
directory:'', // e.g. SketchCanvas.MAIN_BUNDLE or '/storage/sdcard0/Pictures/'
@@ -370,14 +371,14 @@ Note: Because native module cannot read the file in JS bundle, file path cannot
| filename | string | the fold name of the background image file (can be a full path) ||
375
376
| directory? | string | the directory of the background image file (usually used with [constants](#constants)) | '' |
376
377
| mode? | boolean | Specify how the background image resizes itself to fit or fill the canvas.<br/>Options: `AspectFill`, `AspectFit`, `ScaleToFill`|`AspectFit`|
377
378
378
379
### CanvasText object
379
380
380
-
```typescript
381
+
```json5
381
382
{
382
383
text:'TEXT',
383
384
font:'',
@@ -393,7 +394,7 @@ Note: Because native module cannot read the file in JS bundle, file path cannot
| text | string | the text to display (can be multiline by `\n`) ||
398
399
| font? | string | Android: You can set `font` to `fonts/[filename].ttf` to load font in `android/app/src/main/assets/fonts/` in your Android project<br/>iOS: Set `font` that included with iOS ||
399
400
| fontSize? | number | font size | 12 |
@@ -405,32 +406,14 @@ Note: Because native module cannot read the file in JS bundle, file path cannot
405
406
| alignment? | string | Specify how the text aligns inside container. Only work when `text` is multiline text. | Left |
406
407
| lineHeightMultiple? | number | Multiply line height by this factor. Only work when `text` is multiline text. | 1.0 |
407
408
408
-
## Performance
409
-
410
-
---
411
-
412
-
1. For non-transparent path, both Android and iOS performances are good. Because when drawing non-transparent path, only last segment is drawn on canvas, no matter how long the path is, CPU usage is stable at about 20% and 15% in Android and iOS respectively.
413
-
2. For transparent path, CPU usage stays at around 25% in Android, however, in iOS, CPU usage grows to 100%.
0 commit comments