public class YDisplayLayer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
YDisplayLayer.ALIGN |
Constructor and Description |
---|
YDisplayLayer(YDisplay parent,
int id) |
Modifier and Type | Method and Description |
---|---|
int |
clear()
Erases the whole content of the layer (makes it fully transparent).
|
int |
clearConsole()
Blanks the console area within console margins, and resets the console pointer
to the upper left corner of the console.
|
int |
consoleOut(String text)
Outputs a message in the console area, and advances the console pointer accordingly.
|
int |
drawBar(int x1,
int y1,
int x2,
int y2)
Draws a filled rectangular bar at a specified position.
|
int |
drawBitmap(int x,
int y,
int w,
byte[] bitmap,
int bgcol)
Draws a bitmap at the specified position.
|
int |
drawCircle(int x,
int y,
int r)
Draws an empty circle at a specified position.
|
int |
drawDisc(int x,
int y,
int r)
Draws a filled disc at a given position.
|
int |
drawImage(int x,
int y,
String imagename)
Draws a GIF image at the specified position.
|
int |
drawPixel(int x,
int y)
Draws a single pixel at the specified position.
|
int |
drawRect(int x1,
int y1,
int x2,
int y2)
Draws an empty rectangle at a specified position.
|
int |
drawText(int x,
int y,
YDisplayLayer.ALIGN anchor,
String text)
Draws a text string at the specified position.
|
int |
flush_now() |
YDisplay |
get_display()
Gets parent YDisplay.
|
int |
get_displayHeight()
Returns the display height, in pixels.
|
int |
get_displayWidth()
Returns the display width, in pixels.
|
int |
get_layerHeight()
Returns the height of the layers to draw on, in pixels.
|
int |
get_layerWidth()
Returns the width of the layers to draw on, in pixels.
|
int |
hide()
Hides the layer.
|
int |
lineTo(int x,
int y)
Draws a line from current drawing pointer position to the specified position.
|
int |
moveTo(int x,
int y)
Moves the drawing pointer of this layer to the specified position.
|
int |
reset()
Reverts the layer to its initial state (fully transparent, default settings).
|
int |
resetHiddenFlag() |
int |
selectColorPen(int color)
Selects the pen color for all subsequent drawing functions,
including text drawing.
|
int |
selectEraser()
Selects an eraser instead of a pen for all subsequent drawing functions,
except for bitmap copy functions.
|
int |
selectFont(String fontname)
Selects a font to use for the next text drawing functions, by providing the name of the
font file.
|
int |
selectGrayPen(int graylevel)
Selects the pen gray level for all subsequent drawing functions,
including text drawing.
|
int |
setAntialiasingMode(boolean mode)
Enables or disables anti-aliasing for drawing oblique lines and circles.
|
int |
setConsoleBackground(int bgcol)
Sets up the background color used by the clearConsole function and by
the console scrolling feature.
|
int |
setConsoleMargins(int x1,
int y1,
int x2,
int y2)
Sets up display margins for the consoleOut function.
|
int |
setConsoleWordWrap(boolean wordwrap)
Sets up the wrapping behaviour used by the consoleOut function.
|
int |
setLayerPosition(int x,
int y,
int scrollTime)
Sets the position of the layer relative to the display upper left corner.
|
int |
unhide()
Shows the layer.
|
public YDisplayLayer(YDisplay parent, int id)
public int flush_now() throws YAPI_Exception
YAPI_Exception
public int reset() throws YAPI_Exception
YAPI_Exception
- on errorpublic int clear() throws YAPI_Exception
YAPI_Exception
- on errorpublic int selectColorPen(int color) throws YAPI_Exception
color
- : the desired pen color, as a 24-bit RGB valueYAPI_Exception
- on errorpublic int selectGrayPen(int graylevel) throws YAPI_Exception
graylevel
- : the desired gray level, from 0 to 255YAPI_Exception
- on errorpublic int selectEraser() throws YAPI_Exception
YAPI_Exception
- on errorpublic int setAntialiasingMode(boolean mode) throws YAPI_Exception
mode
- : true to enable antialiasing, false to
disable it.YAPI_Exception
- on errorpublic int drawPixel(int x, int y) throws YAPI_Exception
x
- : the distance from left of layer, in pixelsy
- : the distance from top of layer, in pixelsYAPI_Exception
- on errorpublic int drawRect(int x1, int y1, int x2, int y2) throws YAPI_Exception
x1
- : the distance from left of layer to the left border of the rectangle, in pixelsy1
- : the distance from top of layer to the top border of the rectangle, in pixelsx2
- : the distance from left of layer to the right border of the rectangle, in pixelsy2
- : the distance from top of layer to the bottom border of the rectangle, in pixelsYAPI_Exception
- on errorpublic int drawBar(int x1, int y1, int x2, int y2) throws YAPI_Exception
x1
- : the distance from left of layer to the left border of the rectangle, in pixelsy1
- : the distance from top of layer to the top border of the rectangle, in pixelsx2
- : the distance from left of layer to the right border of the rectangle, in pixelsy2
- : the distance from top of layer to the bottom border of the rectangle, in pixelsYAPI_Exception
- on errorpublic int drawCircle(int x, int y, int r) throws YAPI_Exception
x
- : the distance from left of layer to the center of the circle, in pixelsy
- : the distance from top of layer to the center of the circle, in pixelsr
- : the radius of the circle, in pixelsYAPI_Exception
- on errorpublic int drawDisc(int x, int y, int r) throws YAPI_Exception
x
- : the distance from left of layer to the center of the disc, in pixelsy
- : the distance from top of layer to the center of the disc, in pixelsr
- : the radius of the disc, in pixelsYAPI_Exception
- on errorpublic int selectFont(String fontname) throws YAPI_Exception
fontname
- : the font file nameYAPI_Exception
- on errorpublic int drawText(int x, int y, YDisplayLayer.ALIGN anchor, String text) throws YAPI_Exception
x
- : the distance from left of layer to the text anchor point, in pixelsy
- : the distance from top of layer to the text anchor point, in pixelsanchor
- : the text anchor point, chosen among the YDisplayLayer.ALIGN enumeration:
YDisplayLayer.ALIGN.TOP_LEFT, YDisplayLayer.ALIGN.CENTER_LEFT,
YDisplayLayer.ALIGN.BASELINE_LEFT, YDisplayLayer.ALIGN.BOTTOM_LEFT,
YDisplayLayer.ALIGN.TOP_CENTER, YDisplayLayer.ALIGN.CENTER,
YDisplayLayer.ALIGN.BASELINE_CENTER, YDisplayLayer.ALIGN.BOTTOM_CENTER,
YDisplayLayer.ALIGN.TOP_DECIMAL, YDisplayLayer.ALIGN.CENTER_DECIMAL,
YDisplayLayer.ALIGN.BASELINE_DECIMAL, YDisplayLayer.ALIGN.BOTTOM_DECIMAL,
YDisplayLayer.ALIGN.TOP_RIGHT, YDisplayLayer.ALIGN.CENTER_RIGHT,
YDisplayLayer.ALIGN.BASELINE_RIGHT, YDisplayLayer.ALIGN.BOTTOM_RIGHT.text
- : the text string to drawYAPI_Exception
- on errorpublic int drawImage(int x, int y, String imagename) throws YAPI_Exception
x
- : the distance from left of layer to the left of the image, in pixelsy
- : the distance from top of layer to the top of the image, in pixelsimagename
- : the GIF file nameYAPI_Exception
- on errorpublic int drawBitmap(int x, int y, int w, byte[] bitmap, int bgcol) throws YAPI_Exception
x
- : the distance from left of layer to the left of the bitmap, in pixelsy
- : the distance from top of layer to the top of the bitmap, in pixelsw
- : the width of the bitmap, in pixelsbitmap
- : a binary objectbgcol
- : the background gray level to use for zero bits (0 = black,
255 = white), or -1 to leave the pixels unchangedYAPI_Exception
- on errorpublic int moveTo(int x, int y) throws YAPI_Exception
x
- : the distance from left of layer, in pixelsy
- : the distance from top of layer, in pixelsYAPI_Exception
- on errorpublic int lineTo(int x, int y) throws YAPI_Exception
x
- : the distance from left of layer to the end point of the line, in pixelsy
- : the distance from top of layer to the end point of the line, in pixelsYAPI_Exception
- on errorpublic int consoleOut(String text) throws YAPI_Exception
text
- : the message to displayYAPI_Exception
- on errorpublic int setConsoleMargins(int x1, int y1, int x2, int y2) throws YAPI_Exception
x1
- : the distance from left of layer to the left margin, in pixelsy1
- : the distance from top of layer to the top margin, in pixelsx2
- : the distance from left of layer to the right margin, in pixelsy2
- : the distance from top of layer to the bottom margin, in pixelsYAPI_Exception
- on errorpublic int setConsoleBackground(int bgcol) throws YAPI_Exception
bgcol
- : the background gray level to use when scrolling (0 = black,
255 = white), or -1 for transparentYAPI_Exception
- on errorpublic int setConsoleWordWrap(boolean wordwrap) throws YAPI_Exception
wordwrap
- : true to wrap only between words,
false to wrap on the last column anyway.YAPI_Exception
- on errorpublic int clearConsole() throws YAPI_Exception
YAPI_Exception
- on errorpublic int setLayerPosition(int x, int y, int scrollTime) throws YAPI_Exception
x
- : the distance from left of display to the upper left corner of the layery
- : the distance from top of display to the upper left corner of the layerscrollTime
- : number of milliseconds to use for smooth scrolling, or
0 if the scrolling should be immediate.YAPI_Exception
- on errorpublic int hide() throws YAPI_Exception
YAPI_Exception
- on errorpublic int unhide() throws YAPI_Exception
YAPI_Exception
- on errorpublic YDisplay get_display()
public int get_displayWidth() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_displayHeight() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_layerWidth() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_layerHeight() throws YAPI_Exception
YAPI_Exception
- on errorpublic int resetHiddenFlag()
Copyright © 2017. All rights reserved.