org.jfree.pixie.wmf.records
Class MfCmdCreateRegion
public class MfCmdCreateRegion
Currently i have no clue, how this is implemented.
From The WINE-Sources:
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 <32mr->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 <32*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;
}
applyScaleX , applyScaleY , getFunction , getInstance , getRecord , getScaledHeight , getScaledWidth , getScaledX , getScaledY , replay , scaleRect , scaleXChanged , scaleYChanged , setRecord , setScale |
MfCmdCreateRegion
public MfCmdCreateRegion()
The default constructor, adjusts the scale to 1.
getFunction
public int getFunction()
Reads the function identifier. Every record type is identified by a function number
corresponding to one of the Windows GDI functions used.
- getFunction in interface MfCmd
getInstance
public MfCmd getInstance()
Creates a empty unintialized copy of this command implementation.
- getInstance in interface MfCmd
- a new instance of the command.
getRects
public Rectangle[] getRects()
getRegionHeight
public int getRegionHeight()
getRegionWidth
public int getRegionWidth()
getRegionX
public int getRegionX()
getRegionY
public int getRegionY()
replay
public void replay(WmfFile file)
Replays the command on the given WmfFile.
- replay in interface MfCmd
scaleXChanged
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.
- scaleXChanged in interface MfCmd
scaleYChanged
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.
- scaleYChanged in interface MfCmd
setRecord
public void setRecord(MfRecord record)
Reads the command data from the given record and adjusts the internal parameters
according to the data parsed.
After the raw record was read from the datasource, the record is parsed by the
concrete implementation.
- setRecord in interface MfCmd
record
- the raw data that makes up the record.
setRects
public void setRects(Rectangle[] rects)
setRegionHeight
public void setRegionHeight(int regionHeight)
setRegionWidth
public void setRegionWidth(int regionWidth)
setRegionX
public void setRegionX(int regionX)
setRegionY
public void setRegionY(int regionY)
toString
public String toString()