org.jfree.pixie.wmf.records

Class MfCmdAnimatePalette


public class MfCmdAnimatePalette
extends MfCmd

The AnimatePalette function replaces entries in the specified logical palette.

 BOOL AnimatePalette(
  HPALETTE hpal,           // handle to logical palette
  UINT iStartIndex,        // first entry in logical palette
  UINT cEntries,           // number of entries
  CONST PALETTEENTRY *ppe  // first replacement
 );
 

This function is not implemented. However, you can use this implementation to create a valid record.

offsetlength in bytesmeaning
0x04RecordSize (variable)
0x42record type (0x0436)
0x62first palette entry to be animated
0x82number of animated entries
0xan*4palette entry array with (1 byte red, 1 byte green, 1 byte blue, 1 byte flags)

Constructor Summary

MfCmdAnimatePalette()
DefaultConstructor.

Method Summary

Color[]
getEntries()
Returns the colors defined for this command.
int
getEntriesCount()
Returns the number of colors defined for the AnimatePalette command.
int
getFunction()
Reads the function identifiert .Every record type is identified by a function number corresponding to one of the Windows GDI functions used.
MfCmd
getInstance()
Creates a empty unintialized copy of this command implementation.
int
getPosStartAnimate()
Returns the position of the first color that should be animated in the current palette.
MfRecord
getRecord()
Creates a new record based on the data stored in the MfCommand.
void
replay(WmfFile file)
Replays the command on the given WmfFile.
protected void
scaleXChanged()
Not implemented as no scaling needed for this operation.
protected void
scaleYChanged()
Not implemented as no scaling needed for this operation.
void
setEntries(Color[] colors)
Defines the colors that should be animated.
void
setPosStartAnimate(int hPalette)
Defines the position of the first color that should be animated in the current palette.
void
setRecord(MfRecord record)
Reads the command data from the given record and adjusts the internal parameters according to the data parsed.
String
toString()
Returns a string representation of this command.

Methods inherited from class org.jfree.pixie.wmf.records.MfCmd

applyScaleX, applyScaleY, getFunction, getInstance, getRecord, getScaledHeight, getScaledWidth, getScaledX, getScaledY, replay, scaleRect, scaleXChanged, scaleYChanged, setRecord, setScale

Constructor Details

MfCmdAnimatePalette

public MfCmdAnimatePalette()
DefaultConstructor.

Method Details

getEntries

public Color[] getEntries()
Returns the colors defined for this command.
Returns:
the colors

getEntriesCount

public int getEntriesCount()
Returns the number of colors defined for the AnimatePalette command.
Returns:
the number of colors or 0 if no colors are defined.

getFunction

public int getFunction()
Reads the function identifiert .Every record type is identified by a function number corresponding to one of the Windows GDI functions used.
Overrides:
getFunction in interface MfCmd
Returns:
MfType.ANIMATE_PALETTE.

getInstance

public MfCmd getInstance()
Creates a empty unintialized copy of this command implementation.
Overrides:
getInstance in interface MfCmd
Returns:
a new instance of the command.

getPosStartAnimate

public int getPosStartAnimate()
Returns the position of the first color that should be animated in the current palette.
Returns:
the position of the color.

getRecord

public MfRecord getRecord()
            throws RecordCreationException
Creates a new record based on the data stored in the MfCommand.
Overrides:
getRecord in interface MfCmd
Returns:
the created record.

replay

public void replay(WmfFile file)
Replays the command on the given WmfFile.
Overrides:
replay in interface MfCmd
Parameters:
file - the meta file.

scaleXChanged

protected void scaleXChanged()
Not implemented as no scaling needed for this operation.
Overrides:
scaleXChanged in interface MfCmd

scaleYChanged

protected void scaleYChanged()
Not implemented as no scaling needed for this operation.
Overrides:
scaleYChanged in interface MfCmd

setEntries

public void setEntries(Color[] colors)
Defines the colors that should be animated.
Parameters:
colors - the colors.

setPosStartAnimate

public void setPosStartAnimate(int hPalette)
Defines the position of the first color that should be animated in the current palette.
Parameters:
hPalette - the index of the color, not negative.

setRecord

public void setRecord(MfRecord record)
Reads the command data from the given record and adjusts the internal parameters according to the data parsed.

This method is not implemented, as a Palette implementation is still missing.

Overrides:
setRecord in interface MfCmd
Parameters:
record - the record.

toString

public String toString()
Returns a string representation of this command.
Returns:
the command as string.