NativeScript Bitmap Factory
A NativeScript module for creating and manipulating bitmap images.
NativeScript Toolbox
This module is part of nativescript-toolbox.
License
Platforms
- Android
- iOS
Installation
Run
tns plugin add nativescript-bitmap-factory
inside your app project to install the module.
Usage
;; // create a bitmap with 640x480; // work with bitmap and// keep sure to free memory// after we do not need it anymorebmp.dispose;
Functions
Name | Description |
---|---|
asBitmap | Returns a value as wrapped bitmap. |
create | Creates a new bitmap instance. |
getDefaultOptions | Returns the default options for creating a new bitmap. |
makeMutable | A helper function that keeps sure to return a native image object that is able to be used as wrapped bitmap object. |
setDefaultOptions | Sets the default options for creating a new bitmap. |
Platform specific stuff
You can access the nativeObject
property to access the platform specific object.
For Android this is a Bitmap object and for iOS this is an UIImage object.
To check the platform you can use the android
and ios
properties which have the same values as the corresponding properties from application
core module.
Android
You also can access the underlying Canvas object by __canvas
property.
iOS
You also can access the underlying CGImage object by__CGImage
property.
Data types
IArgb
Stores data of an RGB value with alpha value.
These values can also be submitted as strings (like #ff0
or ffffff
) or numbers.
IBitmapData
Used by toObject()
method.
IFont
Font settings.
IPoint2D
Coordinates, can also be a string like 0,0
or 150|300
.
IPoint2D
Size, can also be a string like 0,0
or 150x300
.
OutputFormat
Supported output formats.
Bitmap