|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdeadbeef.SupTools.Bitmap
public class Bitmap
Class to handle byte based bitmaps with a separate palette up to 256 colors.
| Constructor Summary | |
|---|---|
Bitmap(Bitmap bm)
Constructor (to create deep copy from existing Bitmap). |
|
Bitmap(int w,
int h)
Constructor (without clearing of bitmap). |
|
Bitmap(int w,
int h,
byte[] buf)
Constructor (without clearing of bitmap). |
|
Bitmap(int w,
int h,
int col)
Constructor (with clearing of bitmap). |
|
| Method Summary | |
|---|---|
void |
clear(int color)
Clear bitmap with color index. |
Bitmap |
convertLm(Palette pal,
int alphaThr,
int[] lumThr)
Convert a palletized Bitmap (where each palette entry has individual alpha) to a Bitmap with N color palette, where: index0 = transparent, index1 = light color, ... , indexN-2 = dark color, indexN-1 = black. |
Bitmap |
crop(int x,
int y,
int w,
int h)
Create cropped Bitmap. |
void |
fillRect(int x,
int y,
int w,
int h,
int color)
Fill rectangular range inside bitmap with color index. |
BitmapBounds |
getBounds(Palette pal,
int alphaThr)
Get cropping bounds of Bitmap (first/last x/y coordinates that contain visible pixels). |
int |
getHeight()
Get height of bitmap. |
int |
getHighestColorIndex(Palette p)
Return the highest used palette entry. |
java.awt.image.BufferedImage |
getImage(Palette pal)
Convert Bitmap to buffered image that can be used for display. |
byte[] |
getImg()
Get image buffer of bitmap. |
byte |
getPixel(int x,
int y)
Get color index of pixel at position x,y. |
int |
getPrimaryColorIndex(Palette pal,
int alphaThr)
Find the most common color that is as light and opaque as possible (the darker and more transparent a color is, the smaller is its influence). |
int |
getWidth()
Get width of bitmap. |
Bitmap |
scaleBilinear(int sizeX,
int sizeY,
Palette pal)
Scales a palletized Bitmap to a Bitmap with the same palette using bilinear filtering. |
PaletteBitmap |
scaleBilinear(int sizeX,
int sizeY,
Palette pal,
boolean dither)
Scales a palletized Bitmap to a Bitmap with a new quantized Palette using bilinear filtering. |
Bitmap |
scaleBilinearLm(int sizeX,
int sizeY,
Palette pal,
int alphaThr,
int[] lumThr)
Scales a palletized Bitmap (where each palette entry has individual alpha) using bilinear filtering to a Bitmap with N color palette, where: index0 = transparent, index1 = light color, ... , indexN-2 = dark color, indexN-1 = black. |
Bitmap |
scaleFilter(int sizeX,
int sizeY,
Palette pal,
Filter f)
Scales a palletized Bitmap to a Bitmap with the same Palette using a given scaling filter. |
PaletteBitmap |
scaleFilter(int sizeX,
int sizeY,
Palette pal,
Filter f,
boolean dither)
Scales a palletized Bitmap to a Bitmap with a new quantized Palette using a given scaling filter. |
Bitmap |
scaleFilterLm(int sizeX,
int sizeY,
Palette pal,
int alphaThr,
int[] lumThr,
Filter f)
Scales a palletized Bitmap (where each palette entry has individual alpha) using a given scaling filter to a Bitmap with N color palette, where: index0 = transparent, index1 = light color, ... , indexN-2 = dark color, indexN-1 = black |
void |
setPixel(int x,
int y,
byte color)
Set color index of pixel at position x,y. |
int[] |
toARGB(Palette pal)
Convert Bitmap to Integer array filled with ARGB values. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Bitmap(int w,
int h,
int col)
w - Widthh - Heightcol - Color index to use for initial clearing
public Bitmap(int w,
int h)
w - Widthh - Height
public Bitmap(int w,
int h,
byte[] buf)
w - Widthh - Heightbuf - Image bufferpublic Bitmap(Bitmap bm)
bm - Bitmap to create deep copy from| Method Detail |
|---|
public void clear(int color)
color - Color index to use for clearing
public void fillRect(int x,
int y,
int w,
int h,
int color)
x - X coordinate of rectangley - Y coordinate of rectanglew - Width of rectangleh - Height of rectanglecolor - Color index to use for filling.
public void setPixel(int x,
int y,
byte color)
x - X positiony - Y positioncolor - Color index
public byte getPixel(int x,
int y)
x - X positiony - Y position
public java.awt.image.BufferedImage getImage(Palette pal)
pal - Palette
public int getPrimaryColorIndex(Palette pal,
int alphaThr)
pal - PalettealphaThr - Alpha threshold (all colors with alpha < alphaThr will be ignored)
public int getHighestColorIndex(Palette p)
p - Palette
public Bitmap convertLm(Palette pal,
int alphaThr,
int[] lumThr)
pal - Palette of the source BitmapalphaThr - Threshold for alpha (transparency), lower = more transparentlumThr - Threshold for luminances. For N-1 luminances, N-2 thresholds are needed
lumThr[0] is the threshold for the lightest color (-> idx 1)
lumThr[N-2] is the threshold for the darkest color (-> idx N-1)
public Bitmap scaleBilinearLm(int sizeX,
int sizeY,
Palette pal,
int alphaThr,
int[] lumThr)
sizeX - Target widthsizeY - Target heightpal - Palette of the source BitmapalphaThr - Threshold for alpha (transparency), lower = more transparentlumThr - Threshold for luminances. For N-1 luminances, N-2 thresholds are needed
lumThr[0] is the threshold for the lightest color (-> idx 1)
lumThr[N-2] is the threshold for the darkest color (-> idx N-1)
public Bitmap scaleFilterLm(int sizeX,
int sizeY,
Palette pal,
int alphaThr,
int[] lumThr,
Filter f)
sizeX - Target widthsizeY - Target heightpal - Palette of the source BitmapalphaThr - Threshold for alpha (transparency), lower = more transparentlumThr - Threshold for luminances. For N-1 luminances, N-2 thresholds are needed
lumThr[0] is the threshold for the lightest color (-> idx 1)
lumThr[N-2] is the threshold for the darkest color (-> idx N-1)f - Filter for scaling
public Bitmap scaleBilinear(int sizeX,
int sizeY,
Palette pal)
sizeX - Target widthsizeY - Target heightpal - Palette of the source Bitmap
public PaletteBitmap scaleBilinear(int sizeX,
int sizeY,
Palette pal,
boolean dither)
sizeX - Target widthsizeY - Target heightpal - Palette of the source Bitmapdither - True: apply dithering
public Bitmap scaleFilter(int sizeX,
int sizeY,
Palette pal,
Filter f)
sizeX - Target widthsizeY - Target heightpal - Palette of the source Bitmapf - Filter for scaling
public PaletteBitmap scaleFilter(int sizeX,
int sizeY,
Palette pal,
Filter f,
boolean dither)
sizeX - Target widthsizeY - Target heightpal - Palette of the source Bitmapf - Filter for scalingdither - True: apply dithering
public int[] toARGB(Palette pal)
pal - Palette
public Bitmap crop(int x,
int y,
int w,
int h)
x - X offset in source bitmapy - Y offset in source bitmapw - Width of cropping windowh - Height of cropping window
public BitmapBounds getBounds(Palette pal,
int alphaThr)
pal - PalettealphaThr - Alpha threshold (only pixels with alpha >= alphaThr will be treated as visible)
public int getWidth()
public int getHeight()
public byte[] getImg()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||