Class GraphicsFileFilter

  • All Implemented Interfaces:
    FileFilter

    public class GraphicsFileFilter
    extends java.lang.Object
    implements FileFilter
    Filter the given file as if it were a graphics image.

    Address for Apple2 HGR/DHR address is calculated from an observation of a pattern:
    line number bits: 87654321
    87 are multiplied by 0x0028
    65 are multiplied by 0x0100
    4 is multiplied by 0x0080
    321 are multiplied by 0x0400

    HGR bit values ignore the high bit, as that switches the "palette", and for B&W mode, the bit does nothing. The other 7 bits simply toggle the pixel on or off. Double hires does not follow this - it uses a real 4 bit value, but the high bit is still ignored for graphics (hence, the 560 instead of 640 resolution).

    SHR has been implemented in "16 color" mode as well as 3200 color mode. Note that 16 color mode is really 16 palettes of 16 colors while 3200 color mode is 200 palettes of 16 colors (one palette per line).

    NOTE: The design is feeling kludgy. There are 6 distinct variations - possibly a subclass is needed to interpret the various graphic image or some such redesign.

    Date created: Nov 3, 2002 12:06:36 PM

    • Constructor Detail

      • GraphicsFileFilter

        public GraphicsFileFilter()
        Constructor for GraphicsFileFilter.
    • Method Detail

      • isCodecAvailable

        public static boolean isCodecAvailable()
        Indicate if a codec is available (assist with interface requirements).
      • processHiresBlackAndWhiteLine

        protected void processHiresBlackAndWhiteLine​(byte[] lineData,
                                                     AppleImage image,
                                                     int y)
        Given a specific line in the image, process it in hires black and white mode.
      • processHiresColorLine

        protected void processHiresColorLine​(byte[] lineData,
                                             AppleImage image,
                                             int y)
        Given a specific line in the image, process it in hires color mode. HGR color is two bits to determine color - essentially resolution is 140 horizontally, but it indicates the color for two pixels.

        The names of pixels is a bit confusion - pixel0 is really the left-most pixel (not the low-value bit). To alleviate my bad naming, here is a color table to assist:

         Color   Bits      RGB
         ======= ==== ========
         Black1   000 0x000000
         Green    001 0x00ff00
         Violet   010 0xff00ff
         White1   011 0xffffff
         Black2   100 0x000000
         Orange   101 0xff8000
         Blue     110 0x0000ff
         White2   111 0xffffff
         
        Remember: bits are listed as "highbit", "pixel0", "pixel1"!
      • processDoubleHiresBlackAndWhiteLine

        protected void processDoubleHiresBlackAndWhiteLine​(byte[] lineData1,
                                                           byte[] lineData2,
                                                           AppleImage image,
                                                           int y)
        Given a specific line in the image, process it in double hires black and white mode.
      • processSuperHiresLine

        protected void processSuperHiresLine​(byte[] lineData,
                                             AppleImage image,
                                             int y,
                                             byte scb,
                                             byte[] pallettes)
        Given a specific line in the image, process it in super hires color mode.

        The color map varies depending upon the SCB value(s) and the pallettes stored with the image. The SCB does not apple to 3200 SHR mode!

      • buildQuickDraw2Icons

        public AppleImage[] buildQuickDraw2Icons​(FileEntry fileEntry)
        Construct a series of icons based on the QuickDraw II Icon file format. In ProDOS, this is the ICN ($Ca) file format.

        See Also:
        File Types
      • buildQuickDraw2IconAndMask

        protected AppleImage[] buildQuickDraw2IconAndMask​(byte[] filedata,
                                                          int offset)
        Each icon is composed of two images - one an icon and the other is the mask.
      • buildQuickDraw2IconOrMask

        protected AppleImage buildQuickDraw2IconOrMask​(byte[] filedata,
                                                       boolean isColor,
                                                       int height,
                                                       int width,
                                                       int offset)
        Build an image of an individual icon or its mask.
      • copyImage

        public void copyImage​(AppleImage destImage,
                              AppleImage srcImage,
                              int xStart,
                              int yStart)
        Copy an image from the source image to the destination image. This isn't optimal, nor can it be - we're hiding the actual image implementation, after all. Initially written to handle Apple IIGS Toolbox Icon files.
      • getFileExtensions

        public static java.lang.String[] getFileExtensions()
        Give file extensions.
      • setExtension

        public void setExtension​(java.lang.String extension)
        Set the format name.
      • getExtension

        public java.lang.String getExtension()
        Get the format name.
      • setMode

        public void setMode​(int mode)
        Set the color mode.
      • isHiresBlackAndWhiteMode

        public boolean isHiresBlackAndWhiteMode()
        Indicates if this is configured for hires black & white mode.
      • isHiresColorMode

        public boolean isHiresColorMode()
        Indicates if this is configured for hires color mode.
      • isDoubleHiresBlackAndWhiteMode

        public boolean isDoubleHiresBlackAndWhiteMode()
        Indicates if this is configured for double hires black & white mode.
      • isDoubleHiresColorMode

        public boolean isDoubleHiresColorMode()
        Indicates if this is configured for double hires color mode.
      • isSuperHires16Mode

        public boolean isSuperHires16Mode()
        Indicates if this is configured for super hires 16 color mode.
      • isSuperHires3200Mode

        public boolean isSuperHires3200Mode()
        Indicates if this is configured for super hires 3200 color mode.
      • isHiresMode

        public boolean isHiresMode()
        Indicates if this is a hires mode.
      • isDoubleHiresMode

        public boolean isDoubleHiresMode()
        Indicates if this is a double hires mode.
      • isSuperHiresMode

        public boolean isSuperHiresMode()
        Indicates if this is a super-hires mode.
      • isQuickDraw2Icon

        public boolean isQuickDraw2Icon()
        Indicates if this is a QuickDraw II Icon.