11import { Align , Canvas , Cap , DashPathEffect , LinearGradient , Paint , Path , RadialGradient , Rect , RectF , Style , TileMode , createRect , createRectF } from '@nativescript-community/ui-canvas' ;
2+ import { Label , Utils } from '@nativescript/core' ;
23import { Color } from '@nativescript/core/color' ;
34import { Folder , knownFolders , path } from '@nativescript/core/file-system' ;
45import { ImageSource } from '@nativescript/core/image-source' ;
5- import { Button } from '@nativescript/core/ui/button' ;
6- import { FormattedString } from '@nativescript/core/text/formatted-string' ;
7- import { Span } from '@nativescript/core/text/span' ;
8- import { Label , Utils } from '@nativescript/core' ;
96
107function isOnUiThread ( ) {
118 if ( global . isIOS ) {
@@ -14,11 +11,11 @@ function isOnUiThread() {
1411 return android . os . Looper . myLooper ( ) === android . os . Looper . getMainLooper ( ) ;
1512 }
1613}
14+ const folder : Folder = knownFolders . currentApp ( ) ;
15+ const iconLocalFile : ImageSource = ImageSource . fromFileSync ( path . join ( folder . path , 'images/test.jpg' ) ) ;
1716
1817export function drawOnImage ( scale = 3 , canvas ?: Canvas ) {
19- const folder : Folder = knownFolders . currentApp ( ) ;
2018
21- const iconLocalFile : ImageSource = ImageSource . fromFileSync ( path . join ( folder . path , 'images/test.jpg' ) ) ;
2219 if ( ! canvas ) {
2320 const folderPath : string = path . join ( folder . path , 'images/test.jpg' ) ;
2421 const imageFromLocalFile : ImageSource = ImageSource . fromFileSync ( folderPath ) ;
@@ -122,9 +119,9 @@ export function drawOnImage(scale = 3, canvas?: Canvas) {
122119
123120 // image
124121 canvas . save ( ) ;
125- canvas . translate ( 10 , 600 ) ;
122+ // canvas.translate(10, 600);
126123 // canvas.drawBitmap(iconLocalFile, 0, 0, null);
127- canvas . drawBitmap ( iconLocalFile , null , createRect ( 150 , 0 , 200 , 300 ) , null ) ;
124+ canvas . drawBitmap ( iconLocalFile , null , createRect ( 0 , 0 , 200 , 300 ) , null ) ;
128125 canvas . restore ( ) ;
129126
130127 // arc path
0 commit comments