public static Pattern readColorPattern(final DataInput pStream) throws IOException {
        short type = pStream.readShort();

        Pattern pattern;
        Pattern fallback = readPattern(pStream);

        if (type == 1) {
            // TODO: This is foobar...
            // PixMap
            // ColorTable
            // PixData
            throw new IIOException(String.format("QuickDraw pattern type '0x%04x' not implemented (yet)", type));
        }
        else if (type == 2) {
            Color color = readRGBColor(pStream);
            pattern = new PixMapPattern(color, fallback);
        }
        else {
            throw new IIOException(String.format("Unknown QuickDraw pattern type '0x%04x'", type));
        }

        return pattern;
    }
public static Pattern readColorPattern ( final DataInput pStream ) throws IOException { short type = pStream . readShort ( ) ; Pattern pattern ; Pattern fallback = readPattern ( pStream ) ; if ( type == 1 ) { throw new IIOException ( String . format ( "QuickDraw pattern type '0x%04x' not implemented (yet)" , type ) ) ; } else if ( type == 2 ) { Color color = readRGBColor ( pStream ) ; pattern = new PixMapPattern ( color , fallback ) ; } else { throw new IIOException ( String . format ( "Unknown QuickDraw pattern type '0x%04x'" , type ) ) ; } return pattern ; }
/*
http://developer.apple.com/DOCUMENTATION/mac/QuickDraw/QuickDraw-461.html#MARKER-9-243
IF patType = ditherPat
THEN
PatType:    word;       {pattern type = 2}
Pat1Data:   Pattern;    {old pattern data}
RGB:        RGBColor;   {desired RGB for pattern}
ELSE
PatType:    word;       {pattern type = 1}
Pat1Data:   Pattern;    {old pattern data}
PixMap:     PixMap;
ColorTable: ColorTable;
PixData:    PixData;
END;