public class MfCmdCreateRegion extends MfCmd
The layout of the record looks something like this: rdParm meaning 0 Always 0? 1 Always 6? 2 Looks like a handle? - not constant 3 0 or 1 ?? 4 Total number of bytes 5 No. of separate bands = n [see below] 6 Largest number of x co-ords in a band 7-10 Bounding box x1 y1 x2 y2 11-... n bands Regions are divided into bands that are uniform in the y-direction. Each band consists of pairs of on/off x-coords and is written as m y0 y1 x1 x2 x3 ... xm m into successive rdParm[]s. This is probably just a dump of the internal RGNOBJ?
static BOOL MF_Play_MetaCreateRegion( METARECORD *mr, HRGN hrgn ) { WORD band, pair; WORD *start, *end; INT16 y0, y1; HRGN hrgn2 = CreateRectRgn( 0, 0, 0, 0 ); for(band = 0, start = &(mr->rdParm[11]); band < mr->rdParm[5]; band++, start = end + 1) { if(*start / 2 != (*start + 1) / 2) { WARN("Delimiter not even.\n"); DeleteObject( hrgn2 ); return FALSE; } end = start + *start + 3; if(end > (WORD *)mr + mr->rdSize) { WARN("End points outside record.\n"); DeleteObject( hrgn2 ); return FALSE; } if(*start != *end) { WARN("Mismatched delimiters.\n"); DeleteObject( hrgn2 ); return FALSE; } y0 = *(INT16 *)(start + 1); y1 = *(INT16 *)(start + 2); for(pair = 0; pair < *start / 2; pair++) { SetRectRgn( hrgn2, *(INT16 *)(start + 3 + 2*pair), y0, (INT16 *)(start + 4 + 2*pair), y1 ); CombineRgn(hrgn, hrgn, hrgn2, RGN_OR); } } DeleteObject( hrgn2 ); return TRUE; }
Constructor and Description |
---|
MfCmdCreateRegion() |
Modifier and Type | Method and Description |
---|---|
int |
getFunction()
Reads the function identifier.
|
MfCmd |
getInstance()
Creates a empty unintialized copy of this command implementation.
|
MfRecord |
getRecord()
Writer function
|
Rectangle[] |
getRects() |
int |
getRegionHeight() |
int |
getRegionWidth() |
int |
getRegionX() |
int |
getRegionY() |
void |
replay(WmfFile file)
Replays the command on the given WmfFile.
|
protected void |
scaleXChanged()
A callback function to inform the object, that the x scale has changed and the internal coordinate values have to
be adjusted.
|
protected void |
scaleYChanged()
A callback function to inform the object, that the y scale has changed and the internal coordinate values have to
be adjusted.
|
void |
setRecord(MfRecord record)
Reads the command data from the given record and adjusts the internal parameters according to the data parsed.
|
void |
setRects(Rectangle[] rects) |
void |
setRegionHeight(int regionHeight) |
void |
setRegionWidth(int regionWidth) |
void |
setRegionX(int regionX) |
void |
setRegionY(int regionY) |
String |
toString() |
applyScaleX, applyScaleY, getScaledHeight, getScaledWidth, getScaledX, getScaledY, scaleRect, setScale
public void setRecord(MfRecord record)
MfCmd
public MfRecord getRecord()
public int getFunction()
MfCmd
getFunction
in class MfCmd
public void replay(WmfFile file)
MfCmd
public MfCmd getInstance()
MfCmd
getInstance
in class MfCmd
protected void scaleXChanged()
MfCmd
scaleXChanged
in class MfCmd
protected void scaleYChanged()
MfCmd
scaleYChanged
in class MfCmd
public int getRegionX()
public void setRegionX(int regionX)
public int getRegionY()
public void setRegionY(int regionY)
public int getRegionWidth()
public void setRegionWidth(int regionWidth)
public int getRegionHeight()
public void setRegionHeight(int regionHeight)
public Rectangle[] getRects()
public void setRects(Rectangle[] rects)
Copyright © 2019 Hitachi Vantara. All rights reserved.