This chapter describes the available methods for the Snow.Snowbnd class. The chapter contains the following topics:
‘‘IMG_create_thumbnail(int, int)’’
‘‘IMG_decompress_bitmap(String, int)’’
‘‘IMG_decompress_bitmap(java.awt.Image, int)’’
‘‘IMG_decompress_bitmap(java.io.DataInputStream, int)’’
‘‘IMG_decompress_bitmap_fd(String, int, int)’’
‘‘IMG_decompress_bitmap_stream(String, int)’’
‘‘IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container)’’
‘‘IMG_decompress_fax(java.lang.String, int, int, int, int, int)’’
‘‘IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int)’’
‘‘IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container)’’
‘‘IMG_display_bitmap(java.awt.Graphics, int, int, int, int)’’
‘‘IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’
‘‘IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’
‘‘IMG_erase_rect(int, int, int, int, int, int, int)’’
‘‘IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[])’’
‘‘IMG_get_bitmap_block(int, int, int, int)’’
‘‘IMG_get_deskew_angle(int[], int, int)’’
‘‘IMG_merge_block(Snow.Snowbnd, int, int, int)’’
‘‘IMG_print_applet(java.awt.Container, int)’’
‘‘IMG_print_applet_pages(java.awt.Container, int)’’
‘‘IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)’’
‘‘IMG_remove_red_eye(int, int, int, int)’’
‘‘IMG_resize_bitmap(int, int)’’
‘‘IMG_resize_bitmap_bicubic(int, int)’’
‘‘IMG_resize_to_gray(int, int)’’
‘‘IMG_save_bitmap(byte, int)’’
‘‘IMG_save_bitmap(String, int)’’
‘‘IMG_scroll_bitmap(java.awt.Container, java.awt.Event)’’
‘‘IMG_set_croprect(int, int, int, int)’’
‘‘IMG_shift_bitmap(int, int)’’
‘‘IMG_window_level(int, int, int)’’
‘‘IMGLOW_extract_text(String, int, int, int)’’
‘‘IMGLOW_get_fileinfo(java.io.DataInputStream, int)’’
‘‘IMGLOW_get_filetype(String)’’
‘‘IMGLOW_get_filetype(java.io.DataInputStream)’’
‘‘IMGLOW_get_image_orientation(void)’’
‘‘IMGLOW_get_pages(java.io.DataInputStream)’’
‘‘IMGLOW_get_raster(int, byte[])’’
‘‘IMGLOW_put_raster(int, byte[])’’
‘‘IMGLOW_search_text(byte[], String, int, int, int[])’’
‘‘IMGLOW_set_brightness(int)’’
‘‘IMGLOW_set_comp_quality(int)’’
‘‘IMGLOW_set_decompsize(int, int)’’
‘‘IMGLOW_set_decomp_rect(int, int, int, int)’’
‘‘IMGLOW_set_document_input(int, int)’’
‘‘IMGLOW_set_image_orientation(int)’’
‘‘IMGLOW_set_jpg_interleave(int, int)’’
‘‘IMGLOW_set_overlay_path(String)’’
‘‘IMGLOW_set_pcl_input(int, int)’’
‘‘IMGLOW_set_pdf_input(int, int)’’
‘‘IMGLOW_set_pdf_output(int, int)’’
‘‘IMGLOW_set_tiff_tag(int, int, int, byte[])’’
‘‘IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String)’’
‘‘map_image_to_wnd(java.awt.Container, java.awt.Point)’’
‘‘map_wnd_to_image(java.awt.Container, java.awt.Point)’’
‘‘set_croprect(int, int, int, int)’’
‘‘set_croprect_scroll(java.awt.Container, int, int, int, int, int)’’
‘‘setFrame(java.awt.Container)’’
This method rotates the image at display time. The data itself is not changed, but the image is painted at the requested angle. This method is extremely fast, and is the recommended method for rotating when it is unnecessary to permanently change the image data.
See ‘‘IMG_rotate_bitmap(int)’’ for more information.
void display_angle(int angle);
Table 7-1 lists the display_angle(int) method setting descriptions.
|
Setting |
Description |
|
angle |
The display angle. Valid values are 0, 90, 180, and 270 degrees. |
_________________________________________________________________________
Example
if (myPanel.Simage !=
null)
{
myPanel.Simage.display_angle(0);
myPanel.repaint();
}
________________________________________________________________________
This method is a recommended call when a Snowbnd object is no longer needed.
|
Notes: |
void finalize();
This method turns on an internal flag that forces the IMG_display_bitmap_aspect method to display by fitting the width of the image to the height of the Container, minus the height of the scroll bars, if any.
See ‘‘IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’ for more information.
void fit_to_height(int flag);
Table 7-2 lists the fit_to_height(int) method variable descriptions.
|
Variable |
Description |
|
flag |
0 = Method is off |
_________________________________________________________________________
Example
myPanel1.zoom = 0;
myPanel1.Simage.fit_to_height(1);
myPanel1.repaint();
_________________________________________________________________________
This method turns on an internal flag that forces the IMG_display_bitmap_aspect method to display by fitting the width of the image to the width of the Container, minus the width of the scroll bars, if any.
See ‘‘IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’ for more information.
void fit_to_width(int flag);
Table 7-3 lists the fit_to_width(int) method setting descriptions.
|
Setting |
Description |
|
0 |
Method is off |
|
1 |
Method is on |
_________________________________________________________________________
Example
myPanel1.zoom = 0;
myPanel1.Simage.fit_to_width(1);
myPanel1.repaint();
_________________________________________________________________________
This method returns the bit depth of the image. See Appendix D for more information on the number of bits per pixel of your image.
|
Note: |
int getBitsPerPixel();
Integer. Any positive value (as well as 0) is a valid return.
This method returns the value set by fit_to_height(int).
int get_fit_to_height();
Integer. It returns a 0 if off or 1 if on.
This method returns the value set by fit_to_width(int).
int get_fit_to_width();
Integer. It returns a 0 if off or 1 if on.
This method returns the height of the image in pixels.
|
Note: |
int getHeight();
Integer. Any positive value (as well as 0) is a valid return.
This method calculates the first zoom increment given the image’s height and width. Sometimes images are smaller than the containers in which they display. In that case, the image fits into the container either by height or width. The zoom increment is simply the ratio of screen pixels to image pixels.
For example, if this method returns 35, two zoom operations with a normal zoom increment of 25 are required before the image is noticeably zoomed.
|
Notes: |
int getInitialZoom(int xsize, int ysize);
Table 7-4 lists the getInitialZoom(int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Panel width in pixels |
|
ysize |
Panel height in pixels |
This method returns the width of the image in pixels.
int getWidth();
Integer. Any positive value (as well as 0) is a valid return.
This method returns the X resolution, in dpi (dots per inch), of the image.
|
Note: |
int getXdpi();
Integer. Any positive value (as well as 0) is a valid return.
This method returns the Y resolution, in dpi (dots per inch), of the image.
|
Note: |
int getYdpi();
Integer. Any positive value (as well as 0) is a valid return.
This method converts color images to look as though they are antique photos. It replaces colors with sepia tones, which are reddish brown monochrome tints. When applied to a photo, they give the picture a warm, antique feeling.
|
Note: |
int IMG_antique_effect();
This method converts 24-bit color images to 8-bit gray scale images.
|
Note: |
int IMG_color_gray();
This method intelligently resizes down images. It supports any pixel depth and chooses IMG_resize_bicubic for color images or IMG_resize_to_gray for 1-bit black and white images. This method is excellent for creating thumbnails.
int IMG_create_thumbnail(int xsize, int ysize);
Table 7-5 lists the IMG_create_thumbnail(int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Destination width of image after resizing |
|
ysize |
Destination height of image after resizing |
This method decompresses an image from the local disk. This standard method can be used by applications, signed applets, or applets for which disk read permissions have been granted. As with all decompression methods, it automatically detects the file format.
|
Note: |
int IMG_decompress_bitmap(String st, int page);
Table 7-6 lists the IMG_decompress_bitmap(String, int) method variable descriptions.
|
Variable |
Description |
|
st |
Path and filename of the image to decompress |
|
page |
Page number for the multipage image file |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
FileDialog fd =
new FileDialog(this,"Open " + "Bitmap",FileDialog.LOAD);
fd.show();
FileName = fd.getDirectory() + fd.getFile();
if (FileName != null)
{
tSimage = new Snow.Snowbnd();
tSimage.IMG_decompress_bitmap(FileName,0);
}
_________________________________________________________________________
This method imports a Java™ image object.
|
Note: |
int IMG_decompress_bitmap(java.awt.Image img, int bits_pix);
Table 7-7 lists the IMG_decompress_bitmap(java.awt.Image, int) method variable descriptions.
|
Variable |
Description |
|
img |
Java Image object from which to import data. |
|
bits_pix |
Destination bits per pixel desired. Data from Java image objects is returned as 24 bits, but you can convert to 1-bit or 8-bit if desired. For color, use 24-bits. |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
java.awt.Image img;
int xsize, ysize;
if (myPanel1.Simage
== null && myPanel1.Sann == null) return;
xsize = myPanel1.Simage.getWidth();
ysize = myPanel1.Simage.getHeight();
img = this.createImage(xsize,ysize);
Graphics g = img.getGraphics();
myPanel1.Simage.IMG_decompress_bitmap(img,1);
myPanel1.Simage.IMG_display_bitmap(g,0,0,xsize,ysize);
myPanel1.Sann = null;
myPanel1.repaint(),
_________________________________________________________________________
This method decompresses data from a DataInputStream and automatically detects the file format.
|
Note: |
int IMG_decompress_bitmap(java.io.DataInputStream di, int page);
Table 7-8 lists the IMG_decompress_bitmap(java.io.DataInputStream, int) method variable descriptions.
|
Variable |
Description |
|
di |
Java.io.DataInputStream |
|
page |
Page number if reading from multipage image file |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
java.io.RandomAccessFile
ras;
int length;
byte buff[];
try
{
ras = new java.io.RandomAccessFile
(st,"r");
length = (int)ras.length();
buff = new byte[length];
ras.readFully(buff,0,length);
}
catch (IOException ioe)
{
return -2;
}
java.io.DataInputStream di;
di = new java.io.DataInputStream(new java.io.ByteArrayInputStream(buff))
stat = tSimage.IMG_decompress_bitmap(di, page);
_________________________________________________________________________
This method works the same as IMG_decompress_bitmap but can be used for image formats that are embedded in a larger file and do not start at the beginning of a file.
int IMG_decompress_bitmap_fd(String bm_name, int offset, int page);
|
Note: |
Table 7-9 lists the IMG_decompress_bitmap_fd(String, int, int) method variable descriptions.
|
Variable |
Description |
|
bm_name |
File name of image to decompress. |
|
offset |
Offset of start of image format in bytes. |
|
page |
Image or page number to decompress if multipage file format. Set to 0 for first page. |
Integer. Any positive value (as well as 0) is a valid return.
This method reads images from a standard URL. This method automatically detects the file format and is normally used by applets.
|
Note: |
int IMG_decompress_bitmap_stream(String st, int page);
Table 7-10 lists the IMG_decompress_bitmap_stream(String, int) method variable descriptions.
|
Variable |
Description |
|
st |
URL and filename of the image to decompress, for example, http://www.snowbound.com/image.tif |
|
page |
Page number for multipage file |
Integer. Any positive value (as well as 0) is a valid return.
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
|
Notes: |
int IMG_decompress_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Table 7-11 lists the IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) method variable descriptions.
|
Variable |
Description |
|
st |
URL and file name of image to decompress, for example, http://www.snowbound.com/image.tif |
|
page |
Page number for multipage files |
|
Container sf |
Container which can get the panel or frame where the application or applet resides |
Integer. Any positive value (as well as 0) is a valid return.
This method decompresses compressed fax data from proprietary image file formats which use the CCITT G3 or G4 compression algorithms. The path name is the absolute path to the file.
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this function to decompress the data and convert it into a Snow.DIB in memory.
|
Note: |
int IMG_decompress_fax(String bm_name, int xsize, int ysize, int type, int fill_order, int offset);
Table 7-12 lists the IMG_decompress_fax(java.lang.String, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
bm_name |
Absolute path and file name to the file on the local file system |
|
xsize |
Width, in pixels, of the image after decompression |
|
ysize |
Height, in pixels, of the image after decompression |
|
type |
2 = Group 3 2d image |
|
fill_order |
Bit order in each byte. Normal values: |
|
offset |
Absolute position of the first byte of compressed data |
Integer
This method decompresses fax or proprietary image formats which use the CCITT G3 or G4 compression algorithms.
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this function to decompress the data and convert it into a Snow.DIB in memory.
|
Note: |
int IMG_decompress_fax(java.io.DataInputStream di, int xsize, int ysize, int type, int fill_order, int offset);
Table 7-13 lists the IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
di |
DataInputStream containing compressed file data |
|
xsize |
Width, in pixels, of the image after decompression |
|
ysize |
Height, in pixels, of the image after decompression |
|
type |
2 = Group 3 2d image |
|
fill_order |
Bit order in each byte. Normal values: |
|
offset |
Absolute position of the first byte of compressed data |
Integer
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded. After the first page is decompressed and downloaded, the other pages of a multipage file are downloaded in the background. This allows subsequent pages to be available faster.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
|
Notes: |
int IMG_decompress_multipage_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Table 7-14 lists the IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) method variable descriptions.
|
Table 7-14: IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables |
|
Variable |
Description |
|
st |
URL and file name of image to decompress, for example, http://www.snowbound.com/image.tif |
|
page |
Page number for multipage files |
|
Container sf |
Container which can get the panel or frame where the application or applet resides |
Integer. Any positive value (as well as 0) is a valid return.
This method is a fast rotate for 1-bit skewed images. Use this method after IMG_get_deskew_angle returns a skew angle. This method rotates only from -45 to 45 degrees, but is much faster than IMG_rotate_bitmap for 1-bit images. For best results, use values of -20 to 20.
See ‘‘IMG_get_bitmap_block(int, int, int, int)’’ and ‘‘IMG_rotate_bitmap(int)’’ for more information.
|
Notes: |
int IMG_deskew_bitmap(int rot_angle);
Table 7-15 lists the IMG_deskew_bitmap(int) method variable descriptions.
|
Variable |
Description |
|
rot_angle |
Angle to rotate image |
Integer. Any positive value (as well as 0) is a valid return.
This method removes noise (random pixel data) from 1-bit images. This method works only with 1-bit images. The quality variable can accept a range of 100 values.
|
Notes: |
int IMG_despeckel_bitmap(int quality);
Table 7-16 lists the IMG_despeckel_bitmap(int) method setting descriptions.
|
Setting |
Description |
|
1 |
Minimum noise reduction |
|
30 |
Normal noise reduction |
|
100 |
Maximum noise reduction |
Integer. Any positive value (as well as 0) is a valid return.
This method converts 4, 8, or 24 bit images to 1-bit per pixel bi-level images.
|
Note: |
int IMG_diffusion_mono();
Integer. Any positive value (as well as 0) is a valid return.
This method displays the current image at the current X and Y coordinates, and is not corrected for aspect ratio. To use RasterMaster’s automatic aspect ratio correction during display, use IMG_display_bitmap_aspect.
See ‘‘IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’ for more information.
|
Note: |
int IMG_display_bitmap(Graphics g, int xpos, int ypos, int xsize, int ysize);
Table 7-17 lists the IMG_display_bitmap(java.awt.Graphics, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
g |
Graphics context |
|
xpos |
Starting X position for drawing the image |
|
ypos |
Starting Y position for drawing the image |
|
xsize |
Horizontal size of displayed image |
|
ysize |
Vertical size of displayed image |
Integer. Any positive value (as well as 0) is a valid return.
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. It also displays scroll bars if the image is zoomed (zoom != 0 and zoom > Snowbnd.getInitialZoom()).
RasterMaster automatically detects whether or not Swing is present, and uses the correct scroll bar for AWT or Swing.
|
Note: |
int IMG_display_bitmap_aspect(Graphics g, Container f, int xpos, int ypos, int xsize, int ysize, int zoom);
Table 7-18 lists the IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) method variable descriptions.
|
Table 7-18: IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables |
|
Variable |
Description |
|
g |
Graphics context |
|
f |
Current java.awt.Container for image |
|
xpos |
Starting X position for drawing the image |
|
ypos |
Starting Y position for drawing the image |
|
xsize |
Horizontal size of displayed image |
|
ysize |
Vertical size of displayed image |
|
zoom |
Zoom factor |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
public void paint (Graphics
g)
{
if (Simage != null)
{
in = getInsets();
/* NOTE THAT
Microsoft JVIEW.EXE has a bug and does not
start the
origin at 0,0 under the title bar. Comment this
next line
to fix Jview.exe. All other Java Machines work
fine.*/
g.translate(in.left, in.top);
d
= getSize();
d.width
= (in.right + in.left);
d.height
= (in.top + in.bottom);
if (cropped == 0)
stat
=
Simage.IMG_display_bitmap_aspect(g,
this,
0,0,d.width,d.height,
zoom);
else
Simage.IMG_display_bitmap(g,0,0,d.width,d.height);
if (select)
snbd_draw_pen();
}
}
_________________________________________________________________________
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. The zoom value is a percentage of the image display to the container size. A value of zero will fill the current container with a best fit, either fit to width or fit to height. For example, a value of 10 will zoom the image 10% larger than the container size. This will crop the image slightly. A negative value will shrink the image by the percentage and center in the container.
|
Note: |
int IMG_display_bitmap_smooth(Graphics hdc, Container sf, int xs, int ys, int xsize, int ysize, int zoom);
Table 7-19 lists the IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) method variable descriptions.
|
Table 7-19: IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables |
|
Variable |
Description |
|
hdc |
Graphics port to draw into |
|
sf |
Container to draw into |
|
xs |
Starting X coordinate of container |
|
ys |
Starting Y coordinate of container |
|
xsize |
Xsize coordinate of container |
|
ysize |
Ysize coordinate of container |
|
zoom |
Zoom level |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
public void paint (Graphics
g)
{
if (Simage != null)
{
d = getSize();
in = getInsets();
d.width -= (in.right + in.left);
d.height -= (in.top + in.bottom);
in
= getInsets();
/* NOTE THAT
Microsoft JVIEW.EXE has a bug and does not
start the
origin at 0,0 under the title bar. Comment this
next line
to fix Jview.exe. All other JVMs work
fine.*/
g.translate(in.left, in.top);
stat
= Simage.IMG_display_bitmap_smooth(g, this, 0, 0, d.width,
d.height,zoom);
}
}
public void update(Graphics g)
{
// If the container is showing, be sure to repaint it, otherwise
// repainting it is unnecessary and will cause update flashing
if ((Simage == null) || (Simage.dis_crop_xe == Simage.dis_width)
|| (Simage.dis_crop_ye == Simage.dis_height))
{
g.setColor(getBackground());
g.fillRect(0,
0, d.width, d.height);
g.setColor(getForeground());
}
paint(g);
}
_________________________________________________________________________
This method fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance.
For 24-bit images, the color value must be a RGB-packed pixel; 1 byte red, 1 byte green, and 1 byte blue. For 1-bit black and white images, only the least significant bit is used.
|
Note: |
int IMG_erase_rect(int xs, int ys, int xsize, int ysize, int color, int in_outflag, int operation);
Table 7-20 lists the IMG_erase_rect(int, int, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xs |
Start X coordinate of rectangle |
|
ys |
Start Y coordinate of rectangle |
|
xsize |
Width of rectangle |
|
ysize |
Height of rectangle |
|
color |
Color to fill |
|
in_outflag |
1 = fill inside rectangle |
|
operation |
1 = xor image rectangle |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
if (ssb.Simage != null)
{
int width = ssb.Simage.getWidth();
int height = ssb.Simage.getHeight();
ssb.Simage.IMG_erase_rect(width
/ 20, height / 20,
width (width
/ 10), height (height / 10),0xffffffff,
0, 0);
}
repaint();
_________________________________________________________________________
This method allows filling an area of a bitmap with specified patterns found in the pattern argument.
int IMG_fill_bitmap_pattern(int xs, int ys, int xsize, int ysize, int pattern_width, int pattern_height, int x_offset, int y_offset, int byte pattern[]);
Table 7-21 lists the IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) method variable descriptions.
|
Table 7-21: IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) Method Variables |
|
Variable |
Description |
|
xs |
Start X position of image to fill |
|
ys |
Start Y position of image to fill |
|
xsize |
Width of pattern area to fill |
|
ysize |
Height of pattern area to fill |
|
pattern_width |
Width of data in pattern array |
|
pattern_height |
Height of data in pattern array |
|
x_offset |
X offset of data in pattern array |
|
y_offset |
Y offset of data in pattern array |
|
byte pattern [] |
Array of pattern data bytes |
This method flips the image horizontally to produce a mirror image. Positive X coordinates along the X-axis are swapped with negative X coordinates, and vice versa.
|
Note: |
int IMG_flip_bitmapx();
Integer. Any positive value (as well as 0) is a valid return.
This method flips the image vertically to produce a mirror image. Positive Y coordinates along the Y-axis are swapped with negative Y coordinates, and vice versa.
|
Note: |
int IMG_flip_bitmapy();
Integer. Any positive value (as well as 0) is a valid return.
This method returns a block of data from the current image and creates a Snowbnd object, where the data is specified by the rectangle constructed from the image’s coordinates. The image can then be displayed, rotated, saved, and more.
Snow.Snowbnd IMG_get_bitmap_block(int xs, int ys, int xsize, int ysize);
Table 7-21 lists the Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xs |
Starting X position for the image block |
|
ys |
Starting Y position for the image block |
|
xsize |
Horizontal size of the image block in pixels |
|
ysize |
Vertical size of the image block in pixels |
A new Snowbnd object
This method returns the skew angle for 1-bit images. When scanning multiple pages, images are often slightly skewed or rotated. The values returned in the p_angle[] array should be passed to IMG_deskew_bitmap.
See ‘‘IMG_deskew_bitmap(int)’’ for more information.
|
Note: |
int IMG_get_deskew_angle(int p_angle[], int start_angle, int end_angle);
Table 7-23 lists the IMG_get_deskew_angle(int[], int, int) method variable descriptions.
|
Variable |
Description |
|
p_angle |
Integer array to return the rotation or skew angle; this array can have a single element |
|
start_angle |
Minimum angle to start (no less than -45 degrees; -20 is optimum) |
|
end_angle |
Maximum angle to test for (no more than 45 degrees; 20 is optimum) |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
if (Simage != null)
stat =
Simage.IMG_get_deskew_angle(pangle,
-15, 15);
if (stat >= 0 && pangle[0] != 0)
{
Simage.IMG_deskew_bitmap(pangle[0]);
repaint();
}
_________________________________________________________________________
This method inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory. For bi-level images, this method changes black to white and white to black.
|
Note: |
int IMG_invert_bitmap(void);
Integer. Any positive value (as well as 0) is a valid return.
This method draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in.
|
Notes: |
int IMG_merge_block(Snowbnd shdib, int xpos, int ypos, int operation);
Table 7-24 lists the IMG_merge_block(Snow.Snowbnd, int, int, int) method variable descriptions.
|
Variable |
Description |
|
shdib |
Source snowbound image class within which to merge |
|
xpos |
Starting x merge position |
|
ypos |
Starting y merge position |
|
operation |
0 = draw entire image |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
if (Simage != null)
{
FileDialog fd = new FileDialog(this,"Open
Bitmap",FileDialog.LOAD);
fd.show();
FileName
= fd.getDirectory() + fd.getFile();
if (FileName != null)
{
tSimage =
new Snow.Snowbnd();
tSimage.IMG_decompress_bitmap(FileName,0);
Simage.IMG_merge_block(tSimage,31,31,0);
tSimage =
null;
System.gc();
}
}
_________________________________________________________________________
This method prints images loaded into an applet. This method automatically determines in which browser the applet is being displayed, and performs high-resolution corrections for that browser. It also formats the document for high-resolution printing.
|
Notes: |
int IMG_print_applet(Container C, int res);
Table 7-25 lists the IMG_print_applet(java.awt.Container, int) method variable descriptions.
|
Variable |
Description |
|
C |
java.awt.Container into which image is displayed |
|
res |
Dots per inch for printed document (must be the same as the printer resolution) |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
void button4_clicked(Event
e)
{
IMG_print_applet(this,
300);
}
_________________________________________________________________________
This method prints high-resolution multipage documents from applets.
|
Notes: |
int IMG_print_applet_pages(Container c, int res);
Table 7-26 lists the IMG_print_applet_pages(java.awt.Container, int) method variable descriptions.
|
Variable |
Description |
|
c |
Java.awt.Container of displayed image |
|
res |
Resolution in dpi (dots per inch) of the destination image |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
void button5_clicked(Event
e)
{
//for a 3
page document
for(int i
= 0; i < 3; i++)
{
Simage.IMG_decompress_bitmap_stream_onthefly(st,
i,this);
IMG_print_applet_pages(this,
300);
}
IMG_print_applet_pages(null,
0);
}
_________________________________________________________________________
This method prints the current image at the specified coordinates.
|
Note: |
int IMG_print_bitmap(Graphics g, int xs, int ys, int xsize, int ysize, int res);
Table 7-27 lists the IMG_print_bitmap(java. awt.Graphics, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
g |
Graphics port |
|
xs |
Starting X position |
|
ys |
Starting Y position |
|
xsize |
Horizontal size |
|
ysize |
Vertical size |
|
res |
Print resolution in dpi (dots per inch). Usually set to 300. |
Integer. Any positive value (as well as 0) is a valid return.
This method permanently converts the current 1, 4, or 8-bit image to a 24-bit image. This automatically disables anti-aliasing for 1-bit images.
|
Note: |
int IMG_promote_24();
Integer. Any positive value (as well as 0) is a valid return.
This method detects and converts photos of people with very red eyes to more natural colors.
|
Note: |
int IMG_remove_red_eye(int xpos, int ypos, int xsize, int ysize);
Table 7-28 lists the IMG_remove_red_eye(int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xpos |
Starting top left area for x coordinate |
|
ypos |
Starting top left area for y coordinate |
|
xsize |
Width of area to search |
|
ysize |
Height of area to search |
This method changes the internal size of the image according to the input parameters. The size of the source image is not relevant.
See ‘‘IMG_resize_bitmap_bicubic(int, int)’’ for important details on the algorithm (linear interpolation) used by this method, and for more details on creating high-quality thumbnails.
|
Notes: |
int IMG_resize_bitmap(int hres, int vres);
Table 7-29 lists the IMG_resize_bitmap(int, int) method variable descriptions.
|
Variable |
Description |
|
hres |
New horizontal size of the image |
|
vres |
New vertical size of the image |
Integer. Any positive value (as well as 0) is a valid return.
This method scales down images using a bicubic interpolation algorithm. It is good for creating high-resolution color image thumbnails. Since this operation is floating-point intensive, it is not as fast as IMG_resize_bitmap which uses a linear interpolation.
Bicubic interpolation takes a four pixel by four pixel block and produces an average of those pixels by weighting the value of the pixel in the average based on its distance from the origin pixel. Pixels farther away have less effect on the resulting pixel’s value than do its nearest neighbors.
Linear interpolation takes two pixels, separated by x pixels, and averages the two pixels to create an in-between value. These three pixels (the two original pixels and the newly created in-between pixel), are used to represent the original x + 2 pixels (the two original pixels as end points plus all of the pixels in between).
|
Note: |
int IMG_resize_bitmap_bicubic(int xsize, int ysize);
Table 7-30 lists the IMG_resize_bitmap_bicubic(int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Target width of image in pixels |
|
ysize |
Target height of image in pixels |
Integer. Any positive value (as well as 0) is a valid return.
This method resizes a 1-bit black and white image to a (smaller) 8-bit grayscale image. Use it for making thumbnail versions of documents or engineering drawings. It uses the anti-aliasing method of the display engine to create a high-quality thumbnail.
|
Note: |
int IMG_resize_to_gray(int xsize, int ysize);
Table 7-31 lists the IMG_resize_to_gray(int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Target width of image in pixels |
|
ysize |
Target height of image in pixels |
Integer. Any positive value (as well as 0) is a valid return.
This method converts the current image from 24-bit RGB data to 32-bit CMYK data. RasterMaster products support full 32-bit CMYK data as an internal 32-bit DIB format. The black plane is created.
|
Note: |
int IMG_rgb_to_cmyk();
Integer. Any positive value (as well as 0) is a valid return.
This method rotates the current image clockwise by display angle. This permanently rotates the image in memory. For fast rotation at display time (image is not altered in memory), call display_angle.
See ‘‘display_angle(int)’’ for more information.
|
Note: |
int IMG_rotate_bitmap(int angle);
Table 7-32 lists the IMG_rotate_bitmap(int) method variable descriptions.
|
Variable |
Description |
|
angle |
Angle to rotate image by, in hundredths of a degree. For example, to rotate an image by 90 degrees, enter 9000. |
Integer. Any positive value (as well as 0) is a valid return.
This method saves the current Snowbnd image object to a byte array. Multipage saving to a byte array is supported for MO:DCA and TIFF only. There is no way to know how large the image will be once compressed.
See ‘‘IMG_save_bitmap(String, int)’’ and Filter Bit Level Support in Appendix D for more information.
|
Notes: |
int IMG_save_bitmap(byte array[] b, int comp_type);
Table 7-33 lists the IMG_save_bitmap(byte, int) method variable descriptions.
|
Variable |
Description |
|
array |
Byte array in which to save. |
|
comp_type |
Output file format to write. See Appendix D for more information on supported file formats. The output constants for currently supported and unsupported file types are defined in Appendix C. |
Integer. Any positive value (as well as 0) is the size of the image in the array.
This method saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file.
TIFF is a multipage file format. If the image name already exists, a new page or image is appended to the local file, leaving the current images unchanged. If the file does not exist, it is created with only one page.
|
Notes: |
int IMG_save_bitmap(String st, int comp_type);
Table 7-34 lists the IMG_save_bitmap(String, int) method variable descriptions.
|
Variable |
Description |
|
st |
Output file name in which to save. |
|
comp_type |
Output file format to write. See Appendix B for more information on supported file formats. The output constants for currently supported and unsupported file types are defined in Appendix C. |
Integer. Any positive value (as well as 0) is a valid return.
This method scrolls the bitmap. It essentially moves the current cropping rectangle in the direction indicated by the ScrollBar thumb. For users who do not want the scrollbars visible, a similar effect can be achieved by moving the cropping rectangle around using IMG_set_croprect.
See ‘‘IMG_set_croprect(int, int, int, int)’’ for more information.
|
Notes: |
int IMG_scroll_bitmap(Container sf, Event evt);
Table 7-35 lists the IMG_scroll_bitmap(java.awt.Container, java.awt.Event) method variable descriptions.
|
Variable |
Description |
|
sf |
Current frame or window |
|
evt |
Event object passed to the event handler |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
public boolean handleEvent
(Event evt)
{
switch(evt.id)
{
case Event.SCROLL_LINE_UP:
case Event.SCROLL_LINE_DOWN:
case Event.SCROLL_PAGE_UP:
case Event.SCROLL_PAGE_DOWN:
case Event.SCROLL_ABSOLUTE:
{
Simage.IMG_scroll_bitmap(this,evt);
return
true;
}
}
return super.handleEvent(evt);
}
_________________________________________________________________________
This method sets dis_crop_xs, dis_crop_xe, dis_crop_ys, and dis_crop_ye. The cropping rectangle is essentially the size of the display container (which is usually a subclass of java.awt.Container), mapped onto the image (corrected for image scaling).
To use cropping methods with zooming, see ‘‘map_wnd_to_image(java.awt.Container, java.awt.Point)’’ and ‘‘map_image_to_wnd(java.awt.Container, java.awt.Point)’’.
|
Note: |
void IMG_set_croprect(int xs, int ys, int xsize, int ysize);
Table 7-36 lists the IMG_set_croprect(int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xs |
Coordinate on the X axis for the upper edge of the cropping rectangle |
|
ys |
Coordinate on the Y axis for the left edge of the cropping rectangle |
|
xsize |
Width of the cropping rectangle in image pixels |
|
ysize |
Height of the cropping rectangle in image pixels |
This method shifts the image data along the x and y axes, positively or negatively according to the parameters passed in. Values are relative.
|
Notes: |
int IMG_shift_bitmap(int xoffset, int yoffset);
Table 7-37 lists the IMG_shift_bitmap(int, int) method variable descriptions.
|
Variable |
Description |
|
xoffset |
Positive or negative horizontal distance to move image data |
|
yoffset |
Positive or negative vertical distance to move image data |
Integer. Any positive value (as well as 0) is a valid return.
This method changes the range of displayed pixels. It performs window leveling in 8 and 16-bit gray scale images.
|
Notes: |
int IMG_window_level(int min, int max, int on_off);
Table 7-38 lists the IMG_window_level(int, int, int) method variable descriptions.
|
Variable |
Description |
|
min |
Minimum value of window level |
|
max |
Maximum value of window level |
|
on_off |
1 = On |
Integer. Any positive value (as well as 0) is a valid return.
_________________________________________________________________________
Example
if (Simage.getBitsPerPixel()
== 16)
Simage.IMG_window_level(0,0,1);
_________________________________________________________________________
This method extracts text from PTOCA, PCL, MS Word, AFP, and MS Excel files. Returns the buffer of extracted text in ASCII format.
byte[] IMGLOW_extract_text(String bm_name, int length[], int error[], int page);
Table 7-39 lists the IMGLOW_extract_text(String, int, int, int) method variable descriptions.
|
Variable |
Description |
|
bm_name |
Name of file from which to extract text |
|
length |
Array for returning a single integer to specify the length of the buffer to receive extracted text |
|
error |
Array for returning an integer code |
|
page |
Page number of file from which to extract text |
ASCII format.
|
Note: |
___________________________________________________________________________
Example
%%SOF
/Page=0
/Width=1700
/Height=2200
/FontName=TimesRoman
/FontHeight=44
/FontBold=1
/FontItalic=0
/Xpos=1300 /Ypos=240
%%SOT
Devadas
%%EOT
/Xpos=1253 /Ypos=240
%%SOT
S.
%%EOT
%%EOF
___________________________________________________________________________
|
Variable |
Description |
|
%%SOF |
Signals the start of the buffer |
|
%%EOF |
Marks the end of extracted text |
|
Page |
Specified once at the beginning of the file to indicate the page number |
|
Width |
Specified once at the beginning of the file to indicate page width in pixels |
|
Height |
Specified once at the beginning of the file to indicate page height in pixels |
|
Font Name |
Name of font |
|
FontHeight |
Font height in pixels |
|
FontBold |
Font to be drawn plain or in bold 1 = bold |
|
FontItalic |
Font to be drawn in normal or italic 1 = italic |
|
Xpos |
X pos in pixels |
|
Ypos |
Y pos in pixels |
|
%%SOT |
Start of text block |
|
%%EOT |
End of text block |
This method returns the current brightness set by IMGLOW_set_brightness(int). The default is 0. See ‘‘IMGLOW_set_brightness(int)’’for more information.
int IMGLOW_get_brightness();
Integer. Any value between -127 and 127.
This method returns the current contrast set by IMGLOW_set_contrast(int). The default is 0. See ‘‘IMGLOW_set_contrast(int)’’ for more information.
int IMGLOW_get_contrast();
Integer. Any value between -127 and 127.
This method fills in the height, width, and bits-per-pixel without decompressing the entire file. After calling this method, you can call ‘‘getHeight(void)’’, ‘‘getWidth(void)’’, ‘‘getXdpi(void)’’, ‘‘getYdpi(void)’’, and ‘‘getBitsPerPixel(void)’’.
|
Note: |
int IMGLOW_get_fileinfo(java.io.DataInputStream di, int page);
Table 7-41 lists the IMGLOW_get_filetinfo(java.io.DataInputStream, int) method variable descriptions.
|
Variable |
Description |
|
filename |
File name and path to an image |
|
page |
Page number of multipage file |
Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.
This method returns the file type of an image. See Appendix B or our website (www.snowbound.com) for a current list of supported formats.
|
Note: |
int IMGLOW_get_filetype(String filename);
Table 7-42 lists the IMGLOW_get_filetype(String) method variable descriptions.
|
Variable |
Description |
|
filename |
File name and path to an image |
Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.
This method returns the filetype of an image. See Appendix B or our website (www.snowbound.com) for the most updated list of supported formats.
|
Note: |
int IMGLOW_get_filetype(DataInputStream dis);
Table 7-43 lists the IMGLOW_get_filetype(java.io.DataInputStream) method variable descriptions.
|
Variable |
Description |
|
dis |
Image in memory |
Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.
This method returns the current gamma set by IMGLOW_set_gamma(int). The default is 100. See ‘‘IMGLOW_set_gamma(int)’’ for more information.
int IMGLOW_get_gamma();
Integer. Any value between 0 and 400.
This method returns the orientation of the last image decompressed if the information is available. Orientation is used to determine the display angle.
|
Note: |
int IMGLOW_get_image_orientation();
Integer. Any positive value (as well as 0) is the orientation of the image.
This method returns the number of pages in a multipage document. It works for any multi-page format. See Appendix B or our website (www.snowbound.com) for a current list of supported formats.
|
Notes: |
int IMGLOW_get_pages(DataInputStream dis);
Table 7-44 lists the IMGLOW_get_pages(java.io.DataInputStream) method variable descriptions.
|
Variable |
Description |
|
dis |
An object containing compressed image data. This usually contains a file loaded into memory, and is commonly, but not necessarily, multipaged. |
Integer. Any positive value is the number of pages in the image.
This method returns the number of pages in a multipage document. It works for any multi-page format. See Appendix B or our website (www.snowbound.com) for the most updated list of supported formats.
|
Notes: |
int IMGLOW_get_pages(String filename);
Table 7-45 lists the IMGLOW_get_pages(String) method variable descriptions.
|
Variable |
Description |
|
filename |
Filename and path to an image |
Integer. Any positive value is the number of pages in the image.
This method returns the raster line specified by the position on the Y-axis into the array buffer. Data placed in the array is in the DIB format. This is one line of raw, uncompressed data.
|
Note: |
int IMGLOW_get_raster(int ypos, byte buff[]);
Table 7-46 lists the IMGLOW_get_raster(int, byte[]) method variable descriptions.
|
Variable |
Description |
|
ypos |
Line to retrieve |
|
buff |
Buffer to hold data |
Integer. Any positive value (as well as 0) is a valid return.
These methods read a TIFF tag from the file specified. The tag may be either a string returned in buff or an int, short, or byte returned in value.
int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, String file, byte[] buff, int page);
int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, DataInputStream file, byte[] buff, int page);
Table 7-47 lists the IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) method variable descriptions.
|
Table 7-47: int IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) Method Variables (Continued) |
|
Variable |
Description |
|
tag |
TIFF tag number to return. |
|
max_bytes |
Maximum bytes to read for string tags. |
|
value |
Tag value returned: |
|
file |
File to read tags from. If a string is passed in, the file must be locally accessible. |
|
buff |
String buffer for returning string tags. |
|
page |
Page number for multipage file. |
Dependent on how value variable is set.
This method replaces the raster line specified on the Y-axis with the new image data in the array buffer. The data to replace it is in the DIB format. This is one line of raw uncompressed data.
See Format for Decompressed Images for more information regarding formats for decompressed images.
|
Note: |
int IMGLOW_put_raster(int ypos, byte buff[]);
Table 7-48 lists the IMGLOW_put_raster(int, byte[]) method variable descriptions.
|
Variable |
Description |
|
ypos |
Line to replace |
|
buff |
Data with which to replace |
Integer. Any positive value (as well as 0) is a valid return.
The method returns an array of structures of classes of the type, SNBD_SEARCH_RESULT. For each class or structure there is an array of rectangles. This is to allow a search term to wrap to a new line requiring more than two rectangles to highlight.
The nCount parameter will be set to the number of rectangles required for each instance of a search term. The rectangles will be sorted from the top of the page to the bottom from the left side to the right.
|
Notes: |
SNBD_SEARCH_RESULT[] IMGLOW_search_text(byte[] buffer, String search_String, int page, int error[]);
Table 7-49 lists the IMGLOW_search_text(byte[], String, int, int, int[]) method variable descriptions.
|
Variable |
Description |
|
buffer |
Character buffer to search. Returned from a call to ‘‘IMGLOW_extract_text(String, int, int, int)’’. |
|
search_String |
String for which to search |
|
case_sensitive |
Is search case sensitive. |
|
error |
Error code |
This method sets attributes for importing an Ascii file into the Java RasterMaster library.
int IMGLOW_set_ascii_attributes(int xdpi, int ydpi, int lmargin, int rmargin, int tmargin, int bmargin, int tabs, int pwidth, int pheight, int psize, int charpline, int lineppage, boolean weigh, boolean ital, String fontName, int lnspacing, double charspacing);
Table 7-50 lists the IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) method setting descriptions.
|
Table 7-50: IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) Method Settings |
|
Setting |
Description |
|
xdpi |
Horizontal dots per inch for rendering file. 200 or 300 usually. |
|
ydpi |
Vertical dots per inch for rendering file. 200 or 300 usually. |
|
lmargin |
Left margin size in 1/1000 of an inch. |
|
rmargin |
Right margin size in 1/1000 of an inch. |
|
tmargin |
Top margin size in 1/1000 of an inch. |
|
bmargin |
Bottom margin size in 1/1000 of an inch. |
|
tabs |
Number of spaces for a tab. |
|
pwidth |
Page width in 1/1000 of an inch. |
|
pheight |
Page height in 1/1000 of an inch. |
|
psize |
Font height in pixels. |
|
charpline |
Characters per line. |
|
lineppage |
Lines per page. |
|
weigh |
Set to True for bold and False for normal. |
|
ital |
Set to True for Italic or False for normal. |
|
fontName |
Font type name. |
|
lnspacing |
Line spacing. |
|
charspacing |
Character spacing. |
This method sets the brightness of the current image.
|
Notes: |
int IMGLOW_set_brightness(int value);
Table 7-51 lists the IMGLOW_set_brightness(int) method setting descriptions.
|
Setting |
Description |
|
-127 |
Sets the image's brightness to the lowest (darkest) setting |
|
0 |
(Default) Retains the image's native brightness |
|
+127 |
Sets the image's brightness to the highest (lightest) setting |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the compression quality factor when saving JPEG images.
|
Note: |
int IMGLOW_set_comp_quality(int quality);
Table 7-52 lists the IMGLOW_set_comp_quality(int) method variable descriptions.
|
Variable |
Description |
|
quality |
1 = Smallest file size and lowest quality image |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the relative difference between the image’s black and white values.
|
Notes: |
int IMGLOW_set_contrast(int value);
Table 7-53 lists the IMGLOW_set_contrast(int) method setting descriptions.
|
Setting |
Description |
|
-127 |
(minimum) Displays the image with minimum contrast between the image’s black and white colors. |
|
0 |
(Default) Retains the image's native contrast. |
|
+127 |
(maximum) Displays maximum contrast, causing the whites to be whiter and the blacks to be blacker. |
Integer. Any positive value (as well as 0) is a valid return.
This method allows setting the destination size for an image being decompressed. At decompress time, the image is scaled to the destination x and y size. This destination size also represents the image size in pixels, as it is necessary to decompress using IMG_decompress_bitmap.
When the IMGLOW_set_alias parameter is set to 4, the above function uses the Bicubic interpolation algorithm for scaling the image smoothly. If the alias parameter is set to 0, the scaling is done by skipping pixels. There is no other processing of neighboring pixels.
|
Note: |
int IMGLOW_set_decompsize(int xsize, int ysize);
Table 7-54 lists the IMGLOW_set_decompsize(int, int) method setting descriptions.
|
Method |
Description |
|
xsize |
Destination width of image after resizing |
|
ysize |
Destination height of image after resizing |
This method allows specifying a rectangle in the image to decompress. Only this portion of the image is stored in RasterMaster’s internal memory. To turn this method off, call the method with all parameters set to 0.
|
Note: |
int IMGLOW_set_decomp_rect(int xs, int ys, int xsize, int ysize);
Table 7-55 lists the IMGLOW_set_decomp_rect(int, int, int, int) method setting descriptions.
|
Method |
Description |
|
xs |
Starting X position |
|
xy |
Starting Y position |
|
xsize |
Horizontal size of cropping rectangle |
|
ysize |
Vertical size of cropping rectangle |
This method allows document formats to be rendered in color or black and white. It also allows you to set the document size. It is used for the PDF, Word, Excel, PCL, and AFP formats.
|
Note: |
int IMGLOW_set_document_input(int dpi, int bits_pix);
Table 7-56 lists the IMGLOW_set_document_input(int, int) method setting descriptions.
|
Table 7-56: IMGLOW_set_document_input(int, int) Method Settings |
|
Method |
Description |
|
dpi |
Sets the document in dots per inch. |
|
bits_pix |
Sets the bits per pixel. |
Integer
This method sets a gamma correction factor which corrects for the gamma or response curve of the monitor. This can drastically improve the quality of some gray scale or 24-bit images.
|
Notes: |
int IMGLOW_set_gamma(int value);
Table 7-57 lists the IMGLOW_set_gamma(int) method setting descriptions.
|
Setting |
Description |
|
0 |
No gamma correction |
|
150 |
Default gamma correction (1.50) |
|
400 |
Maximum gamma correction (4.00) |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the orientation flag before saving images to the TIFF format. Orientation changes the default display angle for the image.
See the TIFF 6.0 specification (http://www.adobe.com) for the meaning of the orientation flag.
|
Note: |
int IMGLOW_set_image_orientation(int orient);
Table 7-58 lists the IMGLOW_set_image_orientation(int) method variable descriptions.
|
Variable |
Description |
|
orient |
Sets the image orientation TIFF CALS |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the JPEG interleave factor for writing JPEG images. This is the factor for decimating the blue and red chroma planes when writing out JPEG images.
|
Notes: |
int IMGLOW_set_jpg_interleave(int h_int, int v_int);
Table 7-59 lists the IMGLOW_set_jpg_interleave(int, int) method variable descriptions.
|
Variable |
Description |
|
h_int |
Integer 1, 2, or 4. Specifies the number of horizontal pixels to skip. You can specify up to the height of the file, but this is not recommended. |
|
v_int |
Integer 1, 2, or 4. Specifies the number of vertical pixels to skip. You can specify up to the width of the file, but this is not recommended. |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the path for finding overlay files. Some formats, such as MOD:CA, can contain references to overlay files. If set to null, overlay files will be ignored and only the bitmap will be decompressed.
int IMGLOW_set_overlay_path(String st);
Table 7-60 lists the IMGLOW_set_overlay_path(String) method variable descriptions.
|
Variable |
Description |
|
st |
Specify path of overlay file |
This method sets the rendering for PCL decompression. PCL files are rendered as a bitmap at decompression time. These values allow you to set the dots per inch and the pixel depth of the resulting bitmap.
|
Note: |
int IMGLOW_set_pcl_input(int dpi, int bits_pix);
Table 7-61 lists the IMGLOW_set_pcl_input(int dpi, int bits_pix) method variable descriptions.
|
Variable |
Description |
|
dpi |
Dots per inch in which to render the pcl file. |
|
bits_pix |
Bitmap pixel depth. Set to 1 or 24. |
This method allows the conversion of PDF files into bitmaps when decompressed by RasterMaster products. It allows the programmer to set the bitmap size and pixel depth of the resulting bitmap.
|
Note: |
int IMGLOW_set_pdf_input(int dpi, int bits_pix);
Table 7-62 lists the IMGLOW_set_pdf_input(int, int) method variable descriptions.
|
Variable |
Description |
|
dpi |
Dots per inch in which to render the pdf. |
|
bits_pix |
Bitmap pixel depth for resulting rendered pdf image. Set to 1 or 24. |
This method sets the destination size for saving PDF files. The xsize and ysize are the output sizes in points. A point is 1/72 of an inch.
int IMGLOW_set_pdf_output(int xsize, int ysize);
Table 7-63 lists the IMGLOW_set_pdf_output(int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Destination width of image after resizing |
|
ysize |
Destination height of image after resizing |
This method allows RasterMaster to write new and current tags. This method can be called multiple times for adding multiple tags to write.
|
Note: |
int IMGLOW_set_tiff_tag(int tag, int max_bytes, int value, byte buff[]);
Table 7-64 lists the IMGLOW_set_tiff_tag(int, int, int, byte[]) method variable descriptions.
|
Variable |
Description |
|
tag |
ID of tag to write |
|
max_bytes |
Total size of tag value or data in bytes |
|
value |
Integer value for a tag size of 4 bytes |
|
buff |
Data binary or ASCII to write if tag size is greater than 4 bytes |
This method is used to create a TIFF file with existing compressed data. The header information is passed as the Dib_Head class containing the width, height, and bits per pixel of the image to create.
int IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name);
Table 7-65 lists the IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name) method variable descriptions.
|
Table 7-65: IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name) Method Variables |
|
Variable |
Description |
|
lpbi |
The header information structure |
|
data_stream[] |
Byte array of compressed data |
|
data_size |
Size of the data_stream compressed stream of bytes |
|
file_type |
Type of compressed data in stream. Possible types: TIFF_COMP_NONE = 1, no compression |
|
bm_name |
Name of output tiff file to create |
This method converts image coordinates to screen coordinates for the currently displayed image. This is useful for converting mouse coordinates on the image to screen coordinates, as in creating a selection rectangle (rubber-band zoom).
void map_image_to_wnd(java.awt.Container sf, java.awt.Point pt);
Table 7-66 lists the map_image_to_wnd(java.awt.Container, java.awt.Point) method variable descriptions.
|
Variable |
Description |
|
sf |
Container for displayed image |
|
pt |
Point to be mapped |
This method converts screen coordinates to image coordinates. This is valid only for the currently displayed image. This is useful for converting mouse coordinates on the screen to image coordinates, as in creating a selection rectangle (rubber-band zoom).
void map_wnd_to_image(java.awt.Container sf, java.awt.Point pt);
Table 7-67 lists the map_wnd_to_image(java.awt.Container, java.awt.Point) method variable descriptions.
|
Variable |
Description |
|
sf |
Container for displayed image |
|
pt |
Point to be mapped |
This method sets the cropping rectangle for the display engine. Only the area of the image inside the current crop rectangle displays. Compare this to IMG_display_bitmap_aspect in which the zoom parameter simply sets the current crop rectangle.
See ‘‘IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)’’ for more information.
|
Note: |
int set_croprect(int xs, int ys, int xe, int ye);
Table 7-68 lists the set_croprect(int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xs |
Starting X position for cropping the image |
|
ys |
Starting Y position for cropping the image |
|
xe |
Horizontal size of cropped rectangle in pixels |
|
ye |
Vertical size, of cropped rectangle in pixels |
Integer. Any positive value (as well as 0) is a valid return.
This method sets the rectangular area of an image to display and also sets up scrollbars. Scrollbars are turned on if the size of the cropping rectangle is smaller than the height and/or width of the image.
|
Note: |
int set_croprect_scroll(java.awt.Container sf, int xs, int ys, int xe, int ye, int aspect);
Table 7-69 lists the set_croprect_scroll(java.awt.Container, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
sf |
Container for the displayed image. |
|
xs |
Starting X position for cropping the image. |
|
ys |
Starting Y position for cropping the image. |
|
xe |
Horizontal size in pixels of the cropping rectangle. |
|
ye |
Vertical size in pixels of the cropping rectangle. |
|
aspect |
1 = preserve the aspect ratio of cropped rectangle. |
The return value, if positive, is the new zoom value.
_________________________________________________________________________
Example
public void mouseReleased(MouseEvent
e)
{
Point pt,pt2;
if (select)
{
snbd_draw_pen();
pt = new Point();
pt2 = new
Point();
pt.x = selrect.x;
pt.y = selrect.y;
Simage.map_wnd_to_image(this,pt);
pt2.x = selrect.x
+ selrect.width;
pt2.y = selrect.y
+ selrect.height;
Simage.map_wnd_to_image(this,pt2);
if(pt.x >
pt2.x)
{
selrect.x
= pt.x;
pt.x
= pt2.x;
pt2.x
= selrect.x;
}
if(pt.y >
pt2.y)
{
selrect.y
= pt.y;
pt.y
= pt2.y;
pt2.y
= selrect.y;
}
zoom = Simage.set_croprect_scroll(this,
pt.x, pt.y, pt2.x
pt.x, pt2.y
pt.y,1);
if (zoom <0)
zoom
= 0;
cropped
= 1;
select
= false;
selrect
= null;
repaint();
}
}
_________________________________________________________________________
This method sets the destination container for image display.
|
Note: |
void setFrame(java.awt.Container c);
Table 7-70 lists the setFrame(java.awt.Container) method variable descriptions.
|
Variable |
Description |
|
c |
Container of displayed image (usually "this") |
This method sets the resolution, in dpi (dots per inch, 1/72nd of an inch), along the X-axis of an image. The value is saved in the image.
|
Note: |
int setXdpi(int dpi);
Integer. Any positive value (as well as 0) is a valid return.
This method sets the resolution, in dpi (dots per inch, 1/72nd of an inch), along the Y-axis of an image. The value is saved in the image.
|
Note: |
int setYdpi(int dpi);
Integer. Any positive value (as well as 0) is a valid return.
This is an alternate constructor for the Snowbnd object. This allows the creation of a blank image with allocated memory.
Snowbnd(int xsize, int ysize, int bits_pix);
Table 7-71 lists the Snowbnd(int, int, int) method variable descriptions.
|
Variable |
Description |
|
xsize |
Width of blank bitmap to create. |
|
ysize |
Height of bitmap to create. |
|
bits_pix |
Pixel depth of bitmap to create. Can be set to 1, 8, or 24. |
This is an alternate constructor that creates a new Snowbnd object by copying the contents of an existing Snowbnd object.
Snowbnd(Snowbnd toCopy);
Table 7-72 lists the Snowbnd(Snowbnd) method variable description.
|
Variable |
Description |
|
toCopy |
Existing Snowbnd object. |