public void write(OutStream out, boolean hasAlpha) throws IOException { out.writeUI8(fillType); if (fillType == SWFConstants.FILL_SOLID) { if (hasAlpha) color.writeWithAlpha(out); else color.writeRGB(out); } else if (fillType == SWFConstants.FILL_LINEAR_GRADIENT || fillType == SWFConstants.FILL_RADIAL_GRADIENT) { matrix.write(out); int numRatios = ratios.length; out.writeUI8(numRatios); for (int i = 0; i < numRatios; i++) { if (colors[i] == null) continue; out.writeUI8(ratios[i]); if (hasAlpha) colors[i].writeWithAlpha(out); else colors[i].writeRGB(out); } } else if (fillType == SWFConstants.FILL_TILED_BITMAP || fillType == SWFConstants.FILL_CLIPPED_BITMAP) { out.writeUI16(bitmapId); matrix.write(out); } }