Class: Bitmap

DKTools.Utils.Bitmap

The static class that defines utility methods for Bitmap class

new DKTools.Utils.Bitmap ()

Methods

DKTools.Utils.Bitmap.drawLine (bitmap, x1, y1, x2, y2, color, lineWidth) static

Draws the line to the bitmap
Name Type Default Description
bitmap Bitmap Bitmap
x1 Number The X coordinate of start of the line
y1 Number The Y coordinate of start of the line
x2 Number The X coordinate of end of the line
y2 Number The Y coordinate of end of the line
color String 'white' optional Line color
lineWidth Number 1 optional Line width

DKTools.Utils.Bitmap.getBase64 (bitmap)String | null static

Returns base64 of the bitmap
Name Type Description
bitmap Bitmap Bitmap
Since:
  • 5.0.0
Returns:
Type Description
String | null Base64 of the bitmap

DKTools.Utils.Bitmap.load (object, filename, listener, hue, smooth)Bitmap | null static

Loads and returns a bitmap
Name Type Description
object String | Bitmap | Array | Object Path to file or Bitmap or array with parameters or object with parameters
filename String | Object Name of file (if object is String)
listener function optional Function of processing after loading a bitmap (if object is String)
hue Number optional Hue of bitmap (if object is String)
smooth Boolean optional Smooth of bitmap (if object is String)
object.folder String Path to file
object.filename String Name of file
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
Version:
  • 6.1.0
Returns:
Type Description
Bitmap | null Loaded bitmap or null

DKTools.Utils.Bitmap.loadAsync (object, filename, listener, hue, smooth)Promise.<(Bitmap|null)> asyncstatic

Loads and returns a bitmap Asynchronous version of DKTools.Utils.Bitmap.load Promise resolves a loaded bitmap
Name Type Description
object String | Bitmap | Array | Object Path to file or Bitmap or array with parameters or object with parameters
filename String | Object optional Name of file (if object is String)
listener function optional Function of processing after loading a bitmap (if object is String)
hue Number optional Hue of bitmap (if object is String)
smooth Boolean optional Smooth of bitmap (if object is String)
object.folder String Path to file
object.filename String Name of file
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
Since:
  • 4.0.0
Returns:
Type Description
Promise.<(Bitmap|null)> Loaded bitmap or null

DKTools.Utils.Bitmap.loadBitmaps (bitmaps, onLoadAllBitmaps, onLoadSomeBitmap) static

Loads a bitmaps and call the callback function when all bitmaps are ready
Name Type Description
bitmaps Array.<Bitmap> | Array.<Object> Bitmaps to load
onLoadAllBitmaps function Function that is called when all bitmaps are loaded and ready
onLoadSomeBitmap function optional Function that is called when some bitmap are loaded and ready
bitmaps[].folder String Path to file
bitmaps[].filename String Name of file
bitmaps[].listener function optional Function of processing after loading a bitmap
bitmaps[].hue Number optional Hue of bitmap
bitmaps[].smooth Boolean optional Smooth of bitmap
Version:
  • 3.0.0
Example
var bitmaps = [];
bitmaps[0] = ImageManager.loadSystem('Window');
bitmaps[1] = {
 folder: 'img/system/',
 filename: 'IconSet'
};

DKTools.Utils.Bitmap.loadBitmaps(bitmaps, (allBitmaps) => {
    // all loaded bitmaps
});

DKTools.Utils.Bitmap.loadBitmapsAsync (bitmaps)Promise.<Array.<Bitmap>> asyncstatic

Asynchronously loads a bitmaps Promise resolves a loaded bitmaps
Name Type Description
bitmaps Array.<Bitmap> | Array.<Object> Bitmaps to load
bitmaps[].folder String Path to file
bitmaps[].filename String Name of file
bitmaps[].listener function optional Function of processing after loading a bitmap
bitmaps[].hue Number optional Hue of bitmap
bitmaps[].smooth Boolean optional Smooth of bitmap
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Array.<Bitmap>> Loaded bitmaps

DKTools.Utils.Bitmap.reserve (object, filename, listener, hue, smooth, reservationId)Bitmap | null static

Loads, reserves and reserves a bitmap
Name Type Description
object String | Bitmap | Array | Object Path to file or Bitmap or array with parameters or object with parameters
filename String | Object Name of file (if object is String)
listener function optional Function of processing after loading a bitmap (if object is String)
hue Number optional Hue of bitmap (if object is String)
smooth Boolean optional Smooth of bitmap (if object is String)
reservationId Number optional Reservation ID (if object is String)
object.folder String Path to file
object.filename String Name of file
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
object.reservationId Number optional Reservation ID
Version:
  • 6.1.0
Since:
  • 3.0.0
Returns:
Type Description
Bitmap | null Loaded bitmap or null

DKTools.Utils.Bitmap.reserveAsync (object, filename, listener, hue, smooth, reservationId)Promise.<(Bitmap|null)> asyncstatic

Loads, reserves and returns a bitmap Asynchronous version of DKTools.Utils.Bitmap.reserve Promise resolves a loaded bitmap
Name Type Description
object String | Bitmap | Array | Object Path to file or Bitmap or array with parameters or object with parameters
filename String | Object Name of file (if object is String)
listener function optional Function of processing after loading a bitmap (if object is String)
hue Number optional Hue of bitmap (if object is String)
smooth Boolean optional Smooth of bitmap (if object is String)
reservationId Number optional Reservation ID (if object is String)
object.folder String Path to file
object.filename String Name of file
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
object.reservationId Number optional Reservation ID
Since:
  • 4.0.0
Returns:
Type Description
Promise.<(Bitmap|null)> Loaded bitmap or null

DKTools.Utils.Bitmap.reserveBitmaps (bitmaps, onLoadAllBitmaps, onLoadSomeBitmap) static

Loads and reserves a bitmaps and call the callback function when all bitmaps are ready
Name Type Description
bitmaps Array.<Bitmap> | Array.<Object> Bitmaps to load
onLoadAllBitmaps function Function that is called when all bitmaps are loaded and ready
onLoadSomeBitmap function optional Function that is called when some bitmap are loaded and ready
object[].folder String Path to file
object[].filename String Name of file
object[].listener function optional Function of processing after loading a bitmap
object[].hue Number optional Hue of bitmap
object[].smooth Boolean optional Smooth of bitmap
object[].reservationId Number optional Reservation ID
Since:
  • 3.0.0
Example
var bitmaps = [];
bitmaps[0] = ImageManager.reserveSystem('Window');
bitmaps[1] = {
 folder: 'img/system/',
 filename: 'IconSet'
};

DKTools.Utils.Bitmap.reserveBitmaps(bitmaps, function(allBitmaps) {
    // all loaded bitmaps
});

DKTools.Utils.Bitmap.reserveBitmapsAsync (bitmaps)Promise.<Array.<Bitmap>> asyncstatic

Asynchronously loads and reserves a bitmaps Promise resolves a loaded bitmaps
Name Type Description
bitmaps Array.<Bitmap> | Array.<Object> Bitmaps to load
object[].folder String Path to file
object[].filename String Name of file
object[].listener function optional Function of processing after loading a bitmap
object[].hue Number optional Hue of bitmap
object[].smooth Boolean optional Smooth of bitmap
object[].reservationId Number optional Reservation ID
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Array.<Bitmap>> Loaded bitmaps