if (Double.isNaN(height))
height = image.getHeight();
// Create Fill Style
Matrix matrix = new Matrix();
double twx = (ISWFConstants.TWIPS_PER_PIXEL);
matrix.setScale(twx, twx);
FillStyle fs = null;
if (fileVersion.equalTo(FXGVersion.v1_0))
{
if (repeat)
fs = new FillStyle(FillStyle.REPEATING_BITMAP_FILL, matrix, image.getTag());
else
fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
}
else
{
if (fillMode.equals(FillMode.REPEAT))
{
fs = new FillStyle(FillStyle.REPEATING_BITMAP_FILL, matrix, image.getTag());
}
else if (fillMode.equals(FillMode.CLIP))
{
fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
}
else if (fillMode.equals(FillMode.SCALE))
{
//override the scale for matrix
double fwidth = (width*ISWFConstants.TWIPS_PER_PIXEL)/(double)image.getWidth();
double fheight = (height*ISWFConstants.TWIPS_PER_PIXEL)/(double)image.getHeight();
//For consistency with the 4.5.1 snapshot of the flex compiler.
fwidth = ((double)StrictMath.rint(0x10000 * fwidth))/((double)0x10000);
fheight = ((double)StrictMath.rint(0x10000 * fheight))/((double)0x10000);
matrix.setScale(fwidth, fheight);
//fill style does not matter much since the entire area is filled with bitmap
fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
}
}