|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webcodepro.applecommander.storage.filters.GraphicsFileFilter
public class GraphicsFileFilter
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 multipled by 0x0028
65 are multipled by 0x0100
4 is multiplied by 0x0080
321 are multipled 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 pallettes of 16 colors while 3200 color mode is 200 pallettes of 16 colors (one pallette 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
Field Summary | |
---|---|
static int |
MODE_DHR_BLACK_AND_WHITE
|
static int |
MODE_DHR_COLOR
|
static int |
MODE_HGR_BLACK_AND_WHITE
|
static int |
MODE_HGR_COLOR
|
static int |
MODE_QUICKDRAW2_ICON
|
static int |
MODE_SHR_16
|
static int |
MODE_SHR_3200
|
Constructor Summary | |
---|---|
GraphicsFileFilter()
Constructor for GraphicsFileFilter. |
Method Summary | |
---|---|
protected AppleImage[] |
buildQuickDraw2IconAndMask(byte[] filedata,
int offset)
Each icon is composed of two images - one an icon and the other is the mask. |
protected AppleImage |
buildQuickDraw2IconOrMask(byte[] filedata,
boolean isColor,
int height,
int width,
int offset)
Build an image of an individual icon or its mask. |
AppleImage[] |
buildQuickDraw2Icons(FileEntry fileEntry)
Construct a series of icons based on the QuickDraw II Icon file format. |
void |
copyImage(AppleImage destImage,
AppleImage srcImage,
int xStart,
int yStart)
Copy an image from the source image to the destination image. |
byte[] |
filter(FileEntry fileEntry)
Filter the file data and produce an image. |
java.lang.String |
getExtension()
Get the format name. |
static java.lang.String[] |
getFileExtensions()
Give file extensions. |
java.lang.String |
getSuggestedFileName(FileEntry fileEntry)
Give suggested file name. |
static boolean |
isCodecAvailable()
Indicate if a codec is available (assist with interface requirements). |
boolean |
isDoubleHiresBlackAndWhiteMode()
Indicates if this is configured for double hires black & white mode. |
boolean |
isDoubleHiresColorMode()
Indicates if this is configured for double hires color mode. |
boolean |
isDoubleHiresMode()
Indicates if this is a double hires mode. |
boolean |
isHiresBlackAndWhiteMode()
Indicates if this is configured for hires black & white mode. |
boolean |
isHiresColorMode()
Indicates if this is configured for hires color mode. |
boolean |
isHiresMode()
Indicates if this is a hires mode. |
boolean |
isQuickDraw2Icon()
Indicates if this is a QuickDraw II Icon. |
boolean |
isSuperHires16Mode()
Indicates if this is configured for super hires 16 color mode. |
boolean |
isSuperHires3200Mode()
Indicates if this is configured for super hires 3200 color mode. |
boolean |
isSuperHiresMode()
Indicates if this is a super-hires mode. |
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. |
protected void |
processDoubleHiresColorLine(byte[] lineData1,
byte[] lineData2,
AppleImage image,
int y)
Given a specific line in the image, process it in double hires color mode. |
protected void |
processHiresBlackAndWhiteLine(byte[] lineData,
AppleImage image,
int y)
Given a specific line in the image, process it in hires black and white mode. |
protected void |
processHiresColorLine(byte[] lineData,
AppleImage image,
int y)
Given a specific line in the image, process it in hires color mode. |
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. |
void |
setExtension(java.lang.String extension)
Set the format name. |
void |
setMode(int mode)
Set the color mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MODE_HGR_BLACK_AND_WHITE
public static final int MODE_HGR_COLOR
public static final int MODE_DHR_BLACK_AND_WHITE
public static final int MODE_DHR_COLOR
public static final int MODE_SHR_16
public static final int MODE_SHR_3200
public static final int MODE_QUICKDRAW2_ICON
Constructor Detail |
---|
public GraphicsFileFilter()
Method Detail |
---|
public static boolean isCodecAvailable()
public byte[] filter(FileEntry fileEntry)
filter
in interface FileFilter
FileFilter.filter(FileEntry)
protected void processHiresBlackAndWhiteLine(byte[] lineData, AppleImage image, int y)
protected void processHiresColorLine(byte[] lineData, AppleImage image, int y)
The names of pixles 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 0xffffffRemember: bits are listed as "highbit", "pixel0", "pixel1"!
protected void processDoubleHiresBlackAndWhiteLine(byte[] lineData1, byte[] lineData2, AppleImage image, int y)
protected void processDoubleHiresColorLine(byte[] lineData1, byte[] lineData2, AppleImage image, int y)
protected void processSuperHiresLine(byte[] lineData, AppleImage image, int y, byte scb, byte[] pallettes)
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!
public AppleImage[] buildQuickDraw2Icons(FileEntry fileEntry)
protected AppleImage[] buildQuickDraw2IconAndMask(byte[] filedata, int offset)
protected AppleImage buildQuickDraw2IconOrMask(byte[] filedata, boolean isColor, int height, int width, int offset)
public void copyImage(AppleImage destImage, AppleImage srcImage, int xStart, int yStart)
public static java.lang.String[] getFileExtensions()
public java.lang.String getSuggestedFileName(FileEntry fileEntry)
getSuggestedFileName
in interface FileFilter
public void setExtension(java.lang.String extension)
public java.lang.String getExtension()
public void setMode(int mode)
public boolean isHiresBlackAndWhiteMode()
public boolean isHiresColorMode()
public boolean isDoubleHiresBlackAndWhiteMode()
public boolean isDoubleHiresColorMode()
public boolean isSuperHires16Mode()
public boolean isSuperHires3200Mode()
public boolean isHiresMode()
public boolean isDoubleHiresMode()
public boolean isSuperHiresMode()
public boolean isQuickDraw2Icon()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |