public class WMFDeviceContext extends java.lang.Object implements WMFFunctionCodes, WMFConstants
To avoid the burden of encapsulating each integer value in an object, we have decided to use the following conventions: (U means unsigned, S means signed, and the size is in bits).
META_ABORTDOC, META_ANIMATEPALETTE, META_ARC, META_BITBLT, META_CHORD, META_CREATEBITMAP, META_CREATEBITMAPINDIRECT, META_CREATEBRUSH, META_CREATEBRUSHINDIRECT, META_CREATEFONTINDIRECT, META_CREATEPALETTE, META_CREATEPATTERNBRUSH, META_CREATEPENINDIRECT, META_CREATEREGION, META_DELETEOBJECT, META_DIBBITBLT, META_DIBCREATEPATTERNBRUSH, META_DIBSTRETCHBLT, META_DRAWTEXT, META_ELLIPSE, META_ENDDOC, META_ENDPAGE, META_ESCAPE, META_EXCLUDECLIPRECT, META_EXTFLOODFILL, META_EXTTEXTOUT, META_FILLREGION, META_FLOODFILL, META_FRAMEREGION, META_INTERSECTCLIPRECT, META_INVERTREGION, META_LINETO, META_MOVETO, META_OFFSETCLIPRGN, META_OFFSETVIEWPORTORG, META_OFFSETWINDOWORG, META_PAINTREGION, META_PATBLT, META_PIE, META_POLYGON, META_POLYLINE, META_POLYPOLYGON, META_REALIZEPALETTE, META_RECTANGLE, META_RESETDC, META_RESIZEPALETTE, META_RESTOREDC, META_ROUNDRECT, META_SAVEDC, META_SCALEVIEWPORTEXT, META_SCALEWINDOWEXT, META_SELECTCLIPREGION, META_SELECTOBJECT, META_SELECTPALETTE, META_SETBKCOLOR, META_SETBKMODE, META_SETDIBTODEV, META_SETMAPMODE, META_SETMAPPERFLAGS, META_SETPALENTRIES, META_SETPIXEL, META_SETPOLYFILLMODE, META_SETRELABS, META_SETROP2, META_SETSTRETCHBLTMODE, META_SETTEXTALIGN, META_SETTEXTCHAREXTRA, META_SETTEXTCOLOR, META_SETTEXTJUSTIFICATION, META_SETVIEWPORTEXT, META_SETVIEWPORTORG, META_SETWINDOWEXT, META_SETWINDOWORG, META_STARTDOC, META_STARTPAGE, META_STRETCHBLT, META_STRETCHDIB, META_TEXTOUT, META_UNKNOWNALTERNATE, ANSI_CHARSET, ARABIC_CHARSET, BALTIC_CHARSET, BKMODE_LAST, BS_DIBPATTERN, BS_DIBPATTERN8X8, BS_DIBPATTERNPT, BS_HATCHED, BS_HOLLOW, BS_INDEXED, BS_MONOPATTERN, BS_NULL, BS_PATTERN, BS_PATTERN8X8, BS_SOLID, CHINESEBIG5_CHARSET, DEFAULT_CHARSET, DEFAULT_PITCH, EASTEUROPE_CHARSET, EE_CHARSET, FF_DECORATIVE, FF_DONTCARE, FF_MODERN, FF_ROMAN, FF_SCRIPT, FF_SWISS, FIXED_PITCH, GB2312_CHARSET, GREEK_CHARSET, HANGEUL_CHARSET, HANGUL_CHARSET, HEBREW_CHARSET, HS_BDIAGONAL, HS_CROSS, HS_DIAGCROSS, HS_FDIAGONAL, HS_HORIZONTAL, HS_VERTICAL, JOHAB_CHARSET, MAC_CHARSET, MM_ANISOTROPIC, MM_HIENGLISH, MM_HIMETRIC, MM_ISOTROPIC, MM_LOENGLISH, MM_LOMETRIC, MM_TEXT, MM_TWIPS, MONO_FONT, OEM_CHARSET, OPAQUE, POLYFILL_LAST, PS_ALTERNATE, PS_COSMETIC, PS_DASH, PS_DASHDOT, PS_DASHDOTDOT, PS_DOT, PS_ENDCAP_FLAT, PS_ENDCAP_MASK, PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, PS_GEOMETRIC, PS_INSIDEFRAME, PS_JOIN_BEVEL, PS_JOIN_MASK, PS_JOIN_MITER, PS_JOIN_ROUND, PS_NULL, PS_SOLID, PS_STYLE_MASK, PS_TYPE_MASK, PS_USERSTYLE, R2_BLACK, R2_COPYPEN, R2_MASKNOTPEN, R2_MASKPEN, R2_MASKPENNOT, R2_MERGENOTPEN, R2_MERGEPEN, R2_MERGEPENNOT, R2_NOP, R2_NOT, R2_NOTCOPYPEN, R2_NOTMASKPEN, R2_NOTMERGEPEN, R2_NOTXORPEN, R2_WHITE, R2_XORPEN, RUSSIAN_CHARSET, SHIFTJIS_CHARSET, SYMBOL_CHARSET, THAI_CHARSET, TRANSPARENT, TURKISH_CHARSET, VARIABLE_PITCH, WINDING| Constructor and Description |
|---|
WMFDeviceContext(RandomAccessStream stream,
java.awt.geom.Dimension2D dims) |
WMFDeviceContext(RandomAccessStream stream,
double width,
double height)
Create a metafile in a RandomAccessStream, for instance a
RandomAccessByteArray or a RandomAccessFile.
|
| Modifier and Type | Method and Description |
|---|---|
void |
arc(short left,
short top,
short right,
short bottom,
short xstart,
short ystart,
short xend,
short yend)
Arc from an ellipse described by top,left,...
|
static long |
buildColor(java.awt.Color col) |
static long |
buildColor(int r,
int g,
int b)
Build a correct colour for use in metafiles.
|
void |
close()
The last record in every metafile always has a function number of 0000h,
a Size of 0003h, and no Parameters array.
|
short |
createBrushIndirect(short hatch,
long colour,
int style)
create a brush.
|
WMFPen |
createDrawPen(int penStyle,
short width,
long colour) |
WMFPen |
createDrawPen(short width,
long colour) |
WMFPen |
createFillPen(long colour) |
WMFPen |
createFillPen(short fillHatch,
long colour,
int fillStyle) |
int |
createFontIndirect(short height,
int width,
int escapement,
int orientation,
int weight,
char italic,
char underlined,
char striked,
char charset,
char outPrecision,
char clipPrecision,
char quality,
char pitch,
char[] name) |
WMFPen |
createPenBrush(int penStyle,
short width,
long penColour,
short fillhatch,
long fillColour,
int fillStyle)
Generic function for building a Pen.
|
short |
createPenIndirect(int style,
short width,
long colour)
Create a new pen.
|
int |
createRegion(short left,
short top,
short right,
short bottom) |
void |
deleteObject(short nobj) |
void |
ellipse(short left,
short top,
short right,
short bottom) |
void |
ExcludeClipRect(short left,
short top,
short right,
short bottom) |
void |
FillRgn(short nbrush,
short nregion) |
void |
FloodFill(short x,
short y,
long colour) |
void |
freePen(WMFPen pen) |
void |
IntersectClipRetc(short left,
short top,
short right,
short bottom) |
void |
InvertRgn(short nregion) |
void |
LineTo(short x,
short y) |
void |
LineTo(WMFPoint p) |
static void |
main(java.lang.String[] args) |
void |
MoveTo(short x,
short y) |
void |
MoveTo(WMFPoint p) |
void |
OffsetViewportOrg(short x,
short y) |
void |
OffsetWindowOrg(short x,
short y) |
void |
PaintRgn(short nregion) |
void |
PatBlt(short left,
short top,
short right,
short bottom,
long rop) |
void |
Polygon(WMFPoint[] p,
short nbr) |
void |
PolyLine(WMFPoint[] p,
short nbr) |
void |
rectangle(short left,
short top,
short right,
short bottom) |
void |
RestoreDC(short lev) |
void |
RoundRectangle(short left,
short top,
short right,
short bottom,
short wi,
short h) |
void |
SaveDC() |
void |
ScaleViewportExt(short xnum,
short xdenom,
short ynum,
short ydenom) |
void |
ScaleWindowExt(short xnum,
short xdenom,
short ynum,
short ydenom) |
void |
SelectClipRgn(short nregion) |
void |
SelectObject(short nobj) |
void |
selectPen(WMFPen pen) |
void |
SetBKColor(long color) |
void |
SetBKMode(short mode) |
void |
SetMapMode(short map) |
void |
SetPixel(short x,
short y,
long colour) |
void |
SetPixel(WMFPoint p,
long colour) |
void |
SetPolyFillMode(short fillmode)
Sets the way polygons are filled.
|
void |
SetROP2(long rop) |
void |
SetTextCharacterExtra(short extra) |
void |
SetTextColor(long color) |
void |
setViewportExt(short x,
short y) |
void |
setViewportExt(WMFPoint p) |
void |
setViewportOrg(short x,
short y) |
void |
setWindowExt(short x,
short y) |
void |
setWindowExt(WMFPoint p) |
void |
setWindowOrg(short x,
short y) |
void |
textOut(short x,
short y,
char[] s) |
void |
textOut(short x,
short y,
java.lang.String txt)
Draws a text.
|
void |
textOut(WMFPoint p,
char[] s) |
void |
textOut(WMFPoint p,
java.lang.String txt) |
public WMFDeviceContext(RandomAccessStream stream, java.awt.geom.Dimension2D dims) throws java.io.IOException
java.io.IOExceptionpublic WMFDeviceContext(RandomAccessStream stream, double width, double height) throws java.io.IOException
stream - width - height - java.io.IOExceptionpublic void arc(short left,
short top,
short right,
short bottom,
short xstart,
short ystart,
short xend,
short yend)
throws java.io.IOException
left - top - right - bottom - xstart - ystart - xend - yend - java.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOExceptionpublic WMFPen createPenBrush(int penStyle, short width, long penColour, short fillhatch, long fillColour, int fillStyle) throws java.io.IOException
penStyle - :
one of : one of PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT,
PS_DASHDOTDOT, PS_NULL, PS_INSIDEFRAME, PS_USERSTYLE,
PS_ALTERNATEwidth - :
the pen's width, in 1/1440 of an inch.penColour - :
the line colourfillhatch - :
ignored if style is not hatched ; else : one of HS_HORIZONTAL,
HS_VERTICAL, HS_FDIAGONAL, HS_BDIAGONAL, HS_CROSS,
HS_DIAGCROSSfillColour - :
the fill colour.fillStyle - one of BS_SOLID, BS_NULL or BS_HATCHED.java.io.IOExceptionpublic WMFPen createDrawPen(int penStyle, short width, long colour) throws java.io.IOException
java.io.IOExceptionpublic WMFPen createDrawPen(short width, long colour) throws java.io.IOException
java.io.IOExceptionpublic WMFPen createFillPen(short fillHatch, long colour, int fillStyle) throws java.io.IOException
java.io.IOExceptionpublic WMFPen createFillPen(long colour) throws java.io.IOException
java.io.IOExceptionpublic void selectPen(WMFPen pen) throws java.io.IOException
java.io.IOExceptionpublic void freePen(WMFPen pen) throws java.io.IOException
java.io.IOExceptionpublic short createPenIndirect(int style,
short width,
long colour)
throws java.io.IOException
style - one of : one of PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT,
PS_DASHDOTDOT, PS_NULL, PS_INSIDEFRAME, PS_USERSTYLE,
PS_ALTERNATEwidth - :
width of the pen, if > 1, will force style to solid.colour - :
colour of the penjava.io.IOExceptionpublic short createBrushIndirect(short hatch,
long colour,
int style)
throws java.io.IOException
hatch - :
ignored if style is not hatched ; else : one of HS_HORIZONTAL,
HS_VERTICAL, HS_FDIAGONAL, HS_BDIAGONAL, HS_CROSS,
HS_DIAGCROSScolour - :
colour of the brush.style - :
one of BS_SOLID, BS_NULL or BS_HATCHED.java.io.IOExceptionpublic int createFontIndirect(short height,
int width,
int escapement,
int orientation,
int weight,
char italic,
char underlined,
char striked,
char charset,
char outPrecision,
char clipPrecision,
char quality,
char pitch,
char[] name)
throws java.io.IOException
java.io.IOExceptionpublic int createRegion(short left,
short top,
short right,
short bottom)
throws java.io.IOException
java.io.IOExceptionpublic void deleteObject(short nobj)
throws java.io.IOException
java.io.IOExceptionpublic void ellipse(short left,
short top,
short right,
short bottom)
throws java.io.IOException
java.io.IOExceptionpublic void ExcludeClipRect(short left,
short top,
short right,
short bottom)
throws java.io.IOException
java.io.IOExceptionpublic void FillRgn(short nbrush,
short nregion)
throws java.io.IOException
java.io.IOExceptionpublic void FloodFill(short x,
short y,
long colour)
throws java.io.IOException
java.io.IOExceptionpublic void IntersectClipRetc(short left,
short top,
short right,
short bottom)
throws java.io.IOException
java.io.IOExceptionpublic void InvertRgn(short nregion)
throws java.io.IOException
java.io.IOExceptionpublic void LineTo(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void LineTo(WMFPoint p) throws java.io.IOException
java.io.IOExceptionpublic void MoveTo(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void MoveTo(WMFPoint p) throws java.io.IOException
java.io.IOExceptionpublic void OffsetViewportOrg(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void OffsetWindowOrg(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void PaintRgn(short nregion)
throws java.io.IOException
java.io.IOExceptionpublic void PatBlt(short left,
short top,
short right,
short bottom,
long rop)
throws java.io.IOException
java.io.IOExceptionpublic void Polygon(WMFPoint[] p, short nbr) throws java.io.IOException
java.io.IOExceptionpublic void PolyLine(WMFPoint[] p, short nbr) throws java.io.IOException
java.io.IOExceptionpublic void rectangle(short left,
short top,
short right,
short bottom)
throws java.io.IOException
java.io.IOExceptionpublic void RestoreDC(short lev)
throws java.io.IOException
java.io.IOExceptionpublic void RoundRectangle(short left,
short top,
short right,
short bottom,
short wi,
short h)
throws java.io.IOException
java.io.IOExceptionpublic void SaveDC()
throws java.io.IOException
java.io.IOExceptionpublic void ScaleViewportExt(short xnum,
short xdenom,
short ynum,
short ydenom)
throws java.io.IOException
java.io.IOExceptionpublic void ScaleWindowExt(short xnum,
short xdenom,
short ynum,
short ydenom)
throws java.io.IOException
java.io.IOExceptionpublic void SelectClipRgn(short nregion)
throws java.io.IOException
java.io.IOExceptionpublic void SelectObject(short nobj)
throws java.io.IOException
java.io.IOExceptionpublic void SetBKColor(long color)
throws java.io.IOException
java.io.IOExceptionpublic void SetBKMode(short mode)
throws java.io.IOException
java.io.IOExceptionpublic void SetMapMode(short map)
throws java.io.IOException
java.io.IOExceptionpublic void SetPixel(short x,
short y,
long colour)
throws java.io.IOException
java.io.IOExceptionpublic void SetPixel(WMFPoint p, long colour) throws java.io.IOException
java.io.IOExceptionpublic void SetPolyFillMode(short fillmode)
throws java.io.IOException
fillmode - :
one of ALTERNATE, WINDING, POLYFILL_LAST (?).java.io.IOExceptionpublic void SetROP2(long rop)
throws java.io.IOException
java.io.IOExceptionpublic void SetTextCharacterExtra(short extra)
throws java.io.IOException
java.io.IOExceptionpublic void SetTextColor(long color)
throws java.io.IOException
java.io.IOExceptionpublic void setViewportExt(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void setViewportExt(WMFPoint p) throws java.io.IOException
java.io.IOExceptionpublic void setViewportOrg(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void setWindowExt(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void setWindowExt(WMFPoint p) throws java.io.IOException
java.io.IOExceptionpublic void setWindowOrg(short x,
short y)
throws java.io.IOException
java.io.IOExceptionpublic void textOut(short x,
short y,
char[] s)
throws java.io.IOException
java.io.IOExceptionpublic void textOut(short x,
short y,
java.lang.String txt)
throws java.io.IOException
x - y - txt - java.io.IOExceptionpublic void textOut(WMFPoint p, char[] s) throws java.io.IOException
java.io.IOExceptionpublic void textOut(WMFPoint p, java.lang.String txt) throws java.io.IOException
java.io.IOExceptionpublic static long buildColor(int r,
int g,
int b)
r - g - b - public static long buildColor(java.awt.Color col)
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException