Package javaforce.ui
Class Image
java.lang.Object
javaforce.ui.Component
javaforce.ui.FontComponent
javaforce.ui.Image
- All Implemented Interfaces:
KeyCode,KeyEvents,MouseEvents
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intintJPEG Image Quality when saving.static final intstatic final intstatic final intstatic final intFields inherited from class javaforce.ui.Component
backClr, borderStyle, consumer, debug, disabledClr, editable, enabled, focusable, focused, foreClr, layer, parent, pos, selectedClr, size, visible, zeroFields inherited from interface javaforce.ui.KeyCode
VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9, VK_A, VK_ALT_L, VK_ALT_R, VK_B, VK_BACKSLASH, VK_BACKSPACE, VK_C, VK_CAPS_LOCK, VK_COMMA, VK_CONTROL_L, VK_CONTROL_R, VK_D, VK_DELETE, VK_DIVIDE, VK_DOWN, VK_E, VK_END, VK_ENTER, VK_ESCAPE, VK_F, VK_F1, VK_F10, VK_F11, VK_F12, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_G, VK_H, VK_HOME, VK_I, VK_INSERT, VK_J, VK_K, VK_KEYPAD_0, VK_KEYPAD_1, VK_KEYPAD_2, VK_KEYPAD_3, VK_KEYPAD_4, VK_KEYPAD_5, VK_KEYPAD_6, VK_KEYPAD_7, VK_KEYPAD_8, VK_KEYPAD_9, VK_KEYPAD_DIVIDE, VK_KEYPAD_ENTER, VK_KEYPAD_LOCK, VK_KEYPAD_MINUS, VK_KEYPAD_MULTIPLY, VK_KEYPAD_PERIOD, VK_KEYPAD_PLUS, VK_L, VK_LEFT, VK_M, VK_MENU, VK_N, VK_O, VK_OS, VK_P, VK_PAGE_DOWN, VK_PAGE_UP, VK_PAUSE, VK_PERIOD, VK_Q, VK_R, VK_RIGHT, VK_S, VK_SCROLL_LOCK, VK_SHIFT_L, VK_SHIFT_R, VK_SPACE, VK_T, VK_TAB, VK_TILDE, VK_U, VK_UP, VK_V, VK_W, VK_X, VK_Y, VK_Z -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawBox(int x, int y, int width, int height) voidvoiddrawImageBlend(Image img, int x, int y, boolean keepAlpha) voiddrawImageKeyClr(Image img, int x, int y, int keyclr) voiddrawLine(int x1, int y1, int x2, int y2) voiddrawPixel(int x, int y) voidvoidfill(int x, int y, int w, int h) Fills a rectangle with current fore color.voidfill(int x, int y, int w, int h, int clr) Fills a rectangle with clrvoidfill(int x, int y, int w, int h, int clr, boolean hasAlpha) Fills a rectangle with clrint[]Returns the pixels buffer.static intGet background color used to fill new images.intgetPixel(int x, int y) intgetPixelA(int x, int y) int[]Returns a copy of the pixels buffer.intbooleanloadBMP(InputStream in, int index) booleanbooleanloadJPG(InputStream is) booleanbooleanloadPNG(InputStream is) booleanbooleanloadSVG(InputStream in) booleanbooleanloadXPM(InputStream in) booleanvoidputPixel(int x, int y, int c) voidputPixelA(int x, int y, int c) voidputPixels(int[] src, int x, int y, int w, int h, int srcOffset) Puts pixels.voidputPixels(int[] src, int x, int y, int w, int h, int srcOffset, int srcWidth) Puts pixels (supports padding at end of each scan line)voidputPixelsBlend(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha) Puts pixels blending using src alpha (dest alpha is ignored).voidputPixelsBlendKeyClr(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha, int keyclr) Puts pixels blending using src alpha (dest alpha is ignored) unless src pixel == keyclr.voidputPixelsKeyClr(int[] px, int x, int y, int w, int h, int offset, int keyclr) Put Pixels unless src pixel == keyclrvoidputPixelsStencil(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha, int clr) Puts pixels using src as a stencil.booleansaveBMP(OutputStream out) booleanbooleansaveICNS(OutputStream out) save icns (Mac icon)booleansave icns (Mac icon)booleansaveICO(OutputStream out) booleanbooleansaveJPG(OutputStream os) booleanbooleansavePNG(OutputStream os) booleanbooleansaveSVG(OutputStream out) booleanstatic voidsetDefaultColor(int clr) Set background color used to fill new images (includes alpha value).voidsetLineStyle(int style) voidsetResizeOperation(int op) voidsetSize(int width, int height) Methods inherited from class javaforce.ui.FontComponent
getFont, setFontMethods inherited from class javaforce.ui.Component
getBackColor, getBorderStyle, getDisabledColor, getForeColor, getHeight, getKeyState, getLayer, getMinHeight, getMinSize, getMinWidth, getMousePosition, getMouseX, getMouseY, getPosition, getSelectedColor, getSize, getTopContainer, getWidth, getX, getY, isConsumer, isContainer, isEditable, isEnabled, isFocusable, isFocused, isInside, isVisible, keyPressed, keyReleased, keyTyped, layout, load, mouseDown, mouseMove, mouseScroll, mouseUp, onBlur, onFocus, render, renderLayer, save, setBackColor, setBorderStyle, setConsumer, setDisabledColor, setEditable, setEnabled, setFocus, setFocusable, setForeColor, setLayer, setParent, setPosition, setPosition, setSelectedColor, setSize, setVisible
-
Field Details
-
ALPHA_MASK
public static final int ALPHA_MASK- See Also:
-
OPAQUE
public static final int OPAQUE- See Also:
-
TRANSPARENT
public static final int TRANSPARENT- See Also:
-
RED_MASK
public static final int RED_MASK- See Also:
-
GREEN_MASK
public static final int GREEN_MASK- See Also:
-
BLUE_MASK
public static final int BLUE_MASK- See Also:
-
RGB_MASK
public static final int RGB_MASK- See Also:
-
jpeg_quality
public int jpeg_qualityJPEG Image Quality when saving. (0-100) Default = 90
-
-
Constructor Details
-
Image
public Image() -
Image
public Image(int width, int height)
-
-
Method Details
-
setDefaultColor
public static void setDefaultColor(int clr) Set background color used to fill new images (includes alpha value). -
getDefaultColor
public static int getDefaultColor()Get background color used to fill new images. -
loadPNG
-
loadPNG
-
savePNG
-
savePNG
-
loadJPG
-
loadJPG
-
saveJPG
-
saveJPG
-
loadBMP
-
saveBMP
-
loadBMP
-
saveBMP
-
saveICO
-
saveICO
-
saveICNS
save icns (Mac icon) -
saveICNS
save icns (Mac icon) -
loadSVG
-
saveSVG
-
loadSVG
-
saveSVG
-
loadXPM
-
loadXPM
-
setSize
public void setSize(int width, int height) -
getResizeOperation
public int getResizeOperation() -
setResizeOperation
public void setResizeOperation(int op) -
getPixel
public int getPixel(int x, int y) -
putPixel
public void putPixel(int x, int y, int c) -
getPixelA
public int getPixelA(int x, int y) -
putPixelA
public void putPixelA(int x, int y, int c) -
getPixels
public int[] getPixels()Returns a copy of the pixels buffer. -
getBuffer
public int[] getBuffer()Returns the pixels buffer. -
putPixels
public void putPixels(int[] src, int x, int y, int w, int h, int srcOffset) Puts pixels. -
putPixels
public void putPixels(int[] src, int x, int y, int w, int h, int srcOffset, int srcWidth) Puts pixels (supports padding at end of each scan line) -
putPixelsKeyClr
public void putPixelsKeyClr(int[] px, int x, int y, int w, int h, int offset, int keyclr) Put Pixels unless src pixel == keyclr -
putPixelsBlend
public void putPixelsBlend(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha) Puts pixels blending using src alpha (dest alpha is ignored). if keepAlpha is true then dest alpha is preserved. if keepAlpha is false then src alpha is copied to dest. -
putPixelsBlendKeyClr
public void putPixelsBlendKeyClr(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha, int keyclr) Puts pixels blending using src alpha (dest alpha is ignored) unless src pixel == keyclr. if keepAlpha is true then dest alpha is preserved. if keepAlpha is false then src alpha is copied to dest. -
putPixelsStencil
public void putPixelsStencil(int[] px, int x, int y, int w, int h, int srcOffset, int srcWidth, boolean keepAlpha, int clr) Puts pixels using src as a stencil. -
fill
public void fill(int x, int y, int w, int h, int clr) Fills a rectangle with clr -
fill
public void fill(int x, int y, int w, int h, int clr, boolean hasAlpha) Fills a rectangle with clr -
fill
public void fill(int x, int y, int w, int h) Fills a rectangle with current fore color. -
drawText
-
drawPixel
public void drawPixel(int x, int y) -
setLineStyle
public void setLineStyle(int style) -
drawLine
public void drawLine(int x1, int y1, int x2, int y2) -
drawBox
public void drawBox(int x, int y, int width, int height) -
drawImage
-
drawImageKeyClr
-
drawImageBlend
-