com.jniwrapper.win32.gdi
Class Bitmap

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.gdi.GdiObject
                  extended bycom.jniwrapper.win32.gdi.Bitmap
All Implemented Interfaces:
IntegerParameter
Direct Known Subclasses:
DDBitmap, DIBitmap

public abstract class Bitmap
extends GdiObject

This class represents common functionality for working with bitmaps.


Nested Class Summary
static class Bitmap.Compression
           
static class Bitmap.PredefinedBitmap
          Class PredefinedBitmap enumeration represents predefined windows bitmaps.
 
Nested classes inherited from class com.jniwrapper.win32.gdi.GdiObject
GdiObject.ImageLoadParameters, GdiObject.ImageType, GdiObject.Type
 
Field Summary
protected static BitmapBuilderFactory _builderFactory
           
protected static int CBM_INIT
          Initialize bitmap.
protected static int DIB_PAL_COLORS
          Color table in palette indixes.
protected static int DIB_RGB_COLORS
          Color table in RGB.
protected static java.lang.String FUNCTION_CREATEDIBITMAP
           
protected static java.lang.String FUNCTION_GET_DIBITS
           
protected static java.lang.String FUNCTION_SET_DIBITS
           
 
Fields inherited from class com.jniwrapper.win32.gdi.GdiObject
GDI_ERROR, HGDI_ERROR
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Bitmap()
           
Bitmap(long value)
           
 
Method Summary
 void createDIBSection(DIBitmap result, DC hdc, BitmapInfo bitmapInfo, int colorModel, Pointer ppvBits, Handle hSection, int dwOffset)
          Creates a handle to device independent bitmap (DIB).
 void createDIBSection(DIBitmap result, Pointer ppvBits, BitmapInfo bitmapInfo)
           
 void deleteObject()
          Deletes the object.
 int getBitCount()
          Returns the number of bits per pixel.
abstract  BitmapInfo getBitmapInfo()
           
abstract  BitmapInfoHeader getBitmapInfoHeader()
           
 long getDIBits(DC dc, int startScan, int scanLines, Pointer bits, BitmapInfo bitmapInfo, int colorModelType)
          Returns bits of a bitmap.
abstract  PrimitiveArray getDIBytes()
          Returns array of device independent bitmap bytes as PrimitiveArray of UInt8.
 int getHeight()
           
 Size getSize()
           
 Bitmap getTransparentMask()
           
 int getWidth()
           
 boolean isTransparent()
          Returns true if a transparent bitmap.
abstract  void loadFromFile(java.lang.String fileName)
           
 void saveToFile(java.lang.String fileName)
          Saves bitmap to the specified file.
 long setDIBits(DC dc, int startScan, int scanLines, Pointer bits, BitmapInfo bitmapInfo, int colorModelType)
          Sets bits for a bitmap.
abstract  void setDIBytes(PrimitiveArray bytes)
          Sets bytes of the bitmap.
protected  void setSize(int width, int height)
           
protected  void setTransparentMask(java.awt.Image transparentMask)
           
 java.awt.image.BufferedImage toImage()
          Converts windows Bitmap to BufferedImage.
 
Methods inherited from class com.jniwrapper.win32.gdi.GdiObject
getObject, getObjectType
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, equals, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
acceptIOPerformer, asReturnValue, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_builderFactory

protected static final BitmapBuilderFactory _builderFactory

FUNCTION_GET_DIBITS

protected static final java.lang.String FUNCTION_GET_DIBITS
See Also:
Constant Field Values

FUNCTION_SET_DIBITS

protected static final java.lang.String FUNCTION_SET_DIBITS
See Also:
Constant Field Values

FUNCTION_CREATEDIBITMAP

protected static final java.lang.String FUNCTION_CREATEDIBITMAP
See Also:
Constant Field Values

DIB_RGB_COLORS

protected static final int DIB_RGB_COLORS
Color table in RGB.

See Also:
Constant Field Values

DIB_PAL_COLORS

protected static final int DIB_PAL_COLORS
Color table in palette indixes.

See Also:
Constant Field Values

CBM_INIT

protected static final int CBM_INIT
Initialize bitmap.

See Also:
Constant Field Values
Constructor Detail

Bitmap

public Bitmap()

Bitmap

public Bitmap(long value)
Method Detail

setDIBits

public long setDIBits(DC dc,
                      int startScan,
                      int scanLines,
                      Pointer bits,
                      BitmapInfo bitmapInfo,
                      int colorModelType)
Sets bits for a bitmap.

Parameters:
dc - dc compatible with a bitmap.
startScan - start scanline in a bitmap.
scanLines - the number of scanlines in a bitmap.
bits - a pointer to PrimitiveArray of UInt8 (result bits).
bitmapInfo - BitmapInfo structure describing a bitmap.
colorModelType - a type of color model.
Returns:
the number of scanlines with bits.

getDIBits

public long getDIBits(DC dc,
                      int startScan,
                      int scanLines,
                      Pointer bits,
                      BitmapInfo bitmapInfo,
                      int colorModelType)
Returns bits of a bitmap.

Parameters:
dc - dc compatible with a bitmap.
startScan - start scanline in bitmap.
scanLines - the number of scanlines in a bitmap.
bits - a pointer to PrimitiveArray of UInt8 (result bits).
bitmapInfo - BitmapInfo structure describing a bitmap.
colorModelType - a type of color model.
Returns:
the number of scanlines with bits.

setSize

protected void setSize(int width,
                       int height)

getSize

public Size getSize()

getWidth

public int getWidth()

getHeight

public int getHeight()

createDIBSection

public void createDIBSection(DIBitmap result,
                             Pointer ppvBits,
                             BitmapInfo bitmapInfo)

createDIBSection

public void createDIBSection(DIBitmap result,
                             DC hdc,
                             BitmapInfo bitmapInfo,
                             int colorModel,
                             Pointer ppvBits,
                             Handle hSection,
                             int dwOffset)
Creates a handle to device independent bitmap (DIB).

Parameters:
result - [out] is a handle to DIB.
hdc - [in] is a handle to the DC of source DDBitmap.
bitmapInfo - [in] describes source DDBitmap.
colorModel - [in] is the type of color model.
ppvBits - [out] is a pointer to the location of bits in DIB section.
hSection - [in] is a hable to DIB section.
dwOffset - [in] is an offset of bits location in DIB section.

getBitCount

public int getBitCount()
Returns the number of bits per pixel.

Returns:
the number of bits per pixel.

setTransparentMask

protected void setTransparentMask(java.awt.Image transparentMask)

getTransparentMask

public Bitmap getTransparentMask()

isTransparent

public boolean isTransparent()
Returns true if a transparent bitmap.

Returns:
true if a transparent bitmap.

deleteObject

public void deleteObject()
Deletes the object.

Overrides:
deleteObject in class GdiObject

toImage

public java.awt.image.BufferedImage toImage()
Converts windows Bitmap to BufferedImage.

Returns:
image Image instance.

saveToFile

public void saveToFile(java.lang.String fileName)
                throws java.io.IOException
Saves bitmap to the specified file.

Parameters:
fileName - path to the file where the bitmap will be saved.
Throws:
java.io.IOException

getBitmapInfoHeader

public abstract BitmapInfoHeader getBitmapInfoHeader()

getBitmapInfo

public abstract BitmapInfo getBitmapInfo()

loadFromFile

public abstract void loadFromFile(java.lang.String fileName)

getDIBytes

public abstract PrimitiveArray getDIBytes()
Returns array of device independent bitmap bytes as PrimitiveArray of UInt8.

Returns:
array of bitmap bytes.

setDIBytes

public abstract void setDIBytes(PrimitiveArray bytes)
Sets bytes of the bitmap.

Parameters:
bytes -