Loading...
Searching...
No Matches
com.navigine.idl.java.BitmapRegionDecoder Class Referenceabstract

Class is used for getting bitmaps (png, jpg, svg) from byte array. More...

Public Member Functions

abstract android.graphics.Bitmap decodeRegion (Rectangle rect, float sampleSize)
 Method is used to decode rectangle region in the image specified by rect.
 
abstract int getWidth ()
 Width of the source image in pixels (after header parse / decode metadata).
 
abstract int getHeight ()
 Height of the source image in pixels (after header parse / decode metadata).
 

Static Public Member Functions

static BitmapRegionDecoder newInstance (byte[] data)
 Method is used to create instance of BitmapRegionDecoder.
 
static BitmapRegionDecoder newInstanceFromImage (Image data)
 Creates decoder from Image without copying raw bytes again.
 

Detailed Description

Class is used for getting bitmaps (png, jpg, svg) from byte array.

Definition at line 14 of file BitmapRegionDecoder.java.

Member Function Documentation

◆ decodeRegion()

abstract android.graphics.Bitmap com.navigine.idl.java.BitmapRegionDecoder.decodeRegion ( Rectangle rect,
float sampleSize )
abstract

Method is used to decode rectangle region in the image specified by rect.

Parameters
rectarea to render Rectangle
sampleSizeif set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory.
Returns
constructed bitmap

Java code snippet:

// Decode region with sample size 1 (full resolution)
ImageWrapper decodedImage = decoder.decodeRegion(sampleRect, 1);
System.out.println("Decoded region: " + sampleRect.getWidth() + "x" + sampleRect.getHeight() + " at sample size 1");

Kotlin code snippet:

// Decode region with sample size 1 (full resolution)
val decodedImage = decoder.decodeRegion(sampleRect, 1)
println("Decoded region: ${sampleRect.width}x${sampleRect.height} at sample size 1")

◆ getHeight()

abstract int com.navigine.idl.java.BitmapRegionDecoder.getHeight ( )
abstract

Height of the source image in pixels (after header parse / decode metadata).

Returns

Java code snippet:

int sourceHeight = decoder.getHeight();
System.out.println("Source image height: " + sourceHeight);

Kotlin code snippet:

val sourceHeight = decoder!!.height
println("Source image height: $sourceHeight")

◆ getWidth()

abstract int com.navigine.idl.java.BitmapRegionDecoder.getWidth ( )
abstract

Width of the source image in pixels (after header parse / decode metadata).

Returns

Java code snippet:

int sourceWidth = decoder.getWidth();
System.out.println("Source image width: " + sourceWidth);

Kotlin code snippet:

val sourceWidth = decoder!!.width
println("Source image width: $sourceWidth")

◆ newInstance()

static BitmapRegionDecoder com.navigine.idl.java.BitmapRegionDecoder.newInstance ( byte[] data)
inlinestatic

Method is used to create instance of BitmapRegionDecoder.

Parameters
dataraw image data (could be raw svg string)
Returns
nstance of decoder, which could be used for decoding byte array to bitmap.

Java code snippet:

// Create new instance of BitmapRegionDecoder
decoder = BitmapRegionDecoder.newInstance(imageData);
System.out.println("Created BitmapRegionDecoder instance");

Kotlin code snippet:

// Create new instance of BitmapRegionDecoder
decoder = BitmapRegionDecoder.newInstance(imageData!!)
println("Created BitmapRegionDecoder instance")

Definition at line 78 of file BitmapRegionDecoder.java.

◆ newInstanceFromImage()

static BitmapRegionDecoder com.navigine.idl.java.BitmapRegionDecoder.newInstanceFromImage ( Image data)
inlinestatic

Creates decoder from Image without copying raw bytes again.

Parameters
dataimage instance (e.g. from SDK pipeline); must remain valid while decoder is used
Returns
decoder instance or null on error

Java code snippet:

// When you already have an Image (e.g. from SDK), create decoder without passing raw bytes again
Image imageForDecoder = null; // set from your pipeline when available
BitmapRegionDecoder decoderFromImage = BitmapRegionDecoder.newInstanceFromImage(imageForDecoder);
System.out.println("Decoder from Image: " + (decoderFromImage != null));

Kotlin code snippet:

// When you already have an Image (e.g. from SDK), create decoder without passing raw bytes again
val imageForDecoder: Image? = null // set from your pipeline when available
val decoderFromImage = BitmapRegionDecoder.newInstanceFromImage(imageForDecoder)
println("Decoder from Image: ${decoderFromImage != null}")

Definition at line 98 of file BitmapRegionDecoder.java.


The documentation for this class was generated from the following file: