public class MacPictDeviceContext extends java.lang.Object implements MacPictOpcodes
Generic remarks on quickdraw:
Currently limited to the opcodes we actually use.
It might be interesting to use the Region system of QuickDraw, instead of our homebrew system, but the codes are not well documented. We'll have a look, though.
General note for the reader: Quickdraw has the rather habit of specifying ordinate before absisse. Hence, all actual inner commands are (y,x) instead of (x,y). We have decided that externally, they would follow the usual practices, that is, the user of this class will specify x and then y.
Reference : Imaging with quickdraw, appendix A.
| Modifier and Type | Class and Description |
|---|---|
static class |
MacPictDeviceContext.MPColor
48-bit color.
|
static class |
MacPictDeviceContext.MPPoint
Points for quickdraw.
|
static class |
MacPictDeviceContext.MPRectangle |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_RESOLUTION |
BITS_RECT, BITS_RGN, BK_COLOR, BK_PAT, BK_PIX_PAT, CH_EXTRA, CLIP, COMPRESSED_QUICKTIME, DEF_HILITE, DH_TEXT, DHDV_TEXT, DIRECT_BITS_RECT, DIRECT_BITS_RGN, DV_TEXT, ERASE_ARC, ERASE_OVAL, ERASE_POLY, ERASE_RECT, ERASE_RGN, ERASE_RRECT, ERASE_SAME_ARC, ERASE_SAME_OVAL, ERASE_SAME_POLY, ERASE_SAME_RECT, ERASE_SAME_RGN, ERASE_SAME_RRECT, FG_COLOR, FILL_ARC, FILL_OVAL, FILL_PATH, FILL_PIX_PAT, FILL_POLY, FILL_RECT, FILL_RGN, FILL_RRECT, FILL_SAME_ARC, FILL_SAME_OVAL, FILL_SAME_POLY, FILL_SAME_RECT, FILL_SAME_RGN, FILL_SAME_RRECT, FONT_NAME, FRAME_ARC, FRAME_OVAL, FRAME_POLY, FRAME_RECT, FRAME_RGN, FRAME_RRECT, FRAME_SAME_ARC, FRAME_SAME_OVAL, FRAME_SAME_POLY, FRAME_SAME_RECT, FRAME_SAME_RGN, FRAME_SAME_RRECT, GLYPH_STATE, HEADER_OP, HILITE_COLOR, HILITE_MODE, INVERT_ARC, INVERT_OVAL, INVERT_POLY, INVERT_RECT, INVERT_RGN, INVERT_RRECT, INVERT_SAME_ARC, INVERT_SAME_OVAL, INVERT_SAME_POLY, INVERT_SAME_RECT, INVERT_SAME_RGN, INVERT_SAME_RRECT, LINE, LINE_FROM, LINE_JUSTIFY, LONG_COMMENT, LONG_TEXT, NOP, OP_COLOR, OP_END_PIC, ORIGIN, OV_SIZE, PACK_BITS_RECT, PACK_BITS_RGN, PAINT_ARC, PAINT_OVAL, PAINT_POLY, PAINT_RECT, PAINT_RGN, PAINT_RRECT, PAINT_SAME_ARC, PAINT_SAME_OVAL, PAINT_SAME_POLY, PAINT_SAME_RECT, PAINT_SAME_RGN, PAINT_SAME_RRECT, PN_LOC_H_FRAC, PN_MODE, PN_PATTERN, PN_PIX_PAT, PN_SIZE, RGB_BK_COL, RGB_FG_COL, SHORT_COMMENT, SHORT_LINE, SHORT_LINE_FROM, SP_EXTRA, TX_FACE, TX_FONT, TX_MODE, TX_RATIO, TX_SIZE, UNCOMPRESSED_QUICKTIME, VERSION, VERSION_OP| Constructor and Description |
|---|
MacPictDeviceContext() |
MacPictDeviceContext(short minx,
short miny,
short maxx,
short maxy)
Create a device with a fixed bounding box.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closePicture()
This method must be called at the end of the drawing session.
|
void |
fillPoly(MacPictDeviceContext.MPPoint[] points) |
void |
framePoly(MacPictDeviceContext.MPPoint[] points) |
byte[] |
getAsArray()
Return the content of the device context as a byte array.
|
byte[] |
getAsArrayForRTF()
In RTF files, the first 512 null bytes are not included.
|
int |
getDpi()
gets the picture resolution.
|
void |
line(MacPictDeviceContext.MPPoint p1,
MacPictDeviceContext.MPPoint p2)
Draws a line between p1 and p2.
|
void |
lineFrom(MacPictDeviceContext.MPPoint p)
Draws a line toward a point.
|
void |
paintPoly(MacPictDeviceContext.MPPoint[] points)
Paint a polygon with the current fill color.
|
void |
paintRectangle(MacPictDeviceContext.MPPoint minp,
MacPictDeviceContext.MPPoint maxp) |
void |
paintRectangle(short minx,
short miny,
short maxx,
short maxy) |
void |
setBackgroundColor(int red,
int green,
int blue) |
void |
setBackgroundColor(MacPictDeviceContext.MPColor color) |
void |
setBoundingBox(short minx,
short miny,
short maxx,
short maxy) |
void |
setClipBox(short minX,
short minY,
short maxX,
short maxY) |
void |
setDpi(int dpi)
Sets the picture resolution.
|
void |
setForegroundColor(int red,
int green,
int blue)
Sets the foreground color.
|
void |
setForegroundColor(MacPictDeviceContext.MPColor color)
Utility method to use
|
void |
setHilightColor(int red,
int green,
int blue) |
void |
setInnerBoundingBox(short minX,
short minY,
short maxX,
short maxY) |
void |
setPenMode(short mode)
Sets pen mode.
|
void |
setPenPattern(byte[] pattern) |
void |
setPenSize(short xsize,
short ysize) |
void |
writeToStream(java.io.OutputStream outputStream) |
public static final int DEFAULT_RESOLUTION
public MacPictDeviceContext()
public MacPictDeviceContext(short minx,
short miny,
short maxx,
short maxy)
minx - miny - maxx - maxy - public void closePicture()
public void fillPoly(MacPictDeviceContext.MPPoint[] points)
public void framePoly(MacPictDeviceContext.MPPoint[] points)
public byte[] getAsArray()
SimpleByteBuffer.getAsArray()public byte[] getAsArrayForRTF()
public int getDpi()
public void line(MacPictDeviceContext.MPPoint p1, MacPictDeviceContext.MPPoint p2)
p1 - p2 - public void lineFrom(MacPictDeviceContext.MPPoint p)
p - public void paintPoly(MacPictDeviceContext.MPPoint[] points)
points - public void paintRectangle(MacPictDeviceContext.MPPoint minp, MacPictDeviceContext.MPPoint maxp)
public void paintRectangle(short minx,
short miny,
short maxx,
short maxy)
public void setBackgroundColor(int red,
int green,
int blue)
public void setBackgroundColor(MacPictDeviceContext.MPColor color)
public void setBoundingBox(short minx,
short miny,
short maxx,
short maxy)
public void setClipBox(short minX,
short minY,
short maxX,
short maxY)
public void setDpi(int dpi)
dpi - the dpi to setpublic void setForegroundColor(int red,
int green,
int blue)
red - :
an integer between 0 and 64735green - :
an integer between 0 and 64735blue - :
an integer between 0 and 64735public void setForegroundColor(MacPictDeviceContext.MPColor color)
color - public void setHilightColor(int red,
int green,
int blue)
public void setInnerBoundingBox(short minX,
short minY,
short maxX,
short maxY)
public void setPenMode(short mode)
mode - PenModepublic void setPenPattern(byte[] pattern)
public void setPenSize(short xsize,
short ysize)
public void writeToStream(java.io.OutputStream outputStream)
throws java.io.IOException
java.io.IOException