Chapter 7 - Class Snow.Snowbnd Methods

This chapter describes the available methods for the Snow.Snowbnd class. The chapter contains the following topics:

‘‘display_angle(int)’’

‘‘finalize(void)’’

‘‘fit_to_height(int)’’

‘‘fit_to_width(int)’’

‘‘getBitsPerPixel(void)’’

‘‘get_fit_to_height()’’

‘‘get_fit_to_width()’’

‘‘getHeight(void)’’

‘‘getInitialZoom(int, int)’’

‘‘getWidth(void)’’

‘‘getXdpi(void)’’

‘‘getYdpi(void)’’

‘‘IMG_antique_effect(void)’’

‘‘IMG_color_gray(void)’’

‘‘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_deskew_bitmap(int)’’

‘‘IMG_despeckel_bitmap(int)’’

‘‘IMG_diffusion_mono(void)’’

‘‘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_flip_bitmapx(void)’’

‘‘IMG_flip_bitmapy(void)’’

‘‘IMG_get_bitmap_block(int, int, int, int)’’

‘‘IMG_get_deskew_angle(int[], int, int)’’

‘‘IMG_invert_bitmap(void)’’

‘‘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_promote_24(void)’’

‘‘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_rgb_to_cmyk(void)’’

‘‘IMG_rotate_bitmap(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_brightness()’’

‘‘IMGLOW_get_contrast()’’

‘‘IMGLOW_get_fileinfo(java.io.DataInputStream, int)’’

‘‘IMGLOW_get_filetype(String)’’

‘‘IMGLOW_get_filetype(java.io.DataInputStream)’’

‘‘IMGLOW_get_gamma()’’

‘‘IMGLOW_get_image_orientation(void)’’

‘‘IMGLOW_get_pages(java.io.DataInputStream)’’

‘‘IMGLOW_get_pages(String)’’

‘IMGLOW_get_raster(int, byte[])’’

‘‘IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int) IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int)’’

‘‘IMGLOW_put_raster(int, byte[])’’

‘‘IMGLOW_search_text(byte[], String, int, int, int[])’’

‘‘IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double)’’

‘‘IMGLOW_set_brightness(int)’’

‘‘IMGLOW_set_comp_quality(int)’’

‘‘IMGLOW_set_contrast(int)’’

‘‘IMGLOW_set_decompsize(int, int)’’

‘‘IMGLOW_set_decomp_rect(int, int, int, int)’’

‘‘IMGLOW_set_document_input(int, int)’’

‘‘IMGLOW_set_gamma(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)’’

‘‘setXdpi(int)’’

‘‘setYdpi(int)’’

‘‘Snowbnd(int, int, int)’’

‘‘Snowbnd(Snowbnd)’’

display_angle(int)

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.

Syntax

void display_angle(int angle);

Remark

Table 7-1 lists the display_angle(int) method setting descriptions.

Table 7-1: display_angle(int) Method Settings

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();
}

________________________________________________________________________

finalize(void)

This method is a recommended call when a Snowbnd object is no longer needed.

Notes:
 
If scrollbars are used, failure to call this method may result in a resource leak.
Calling this method before the system has completed all requested operations may result in NullPointerExceptions or ArrayIndexOutOfBoundsExceptions. It is important to be particularly vigilant when calling this method in multithreaded environments.

Syntax

void finalize();

fit_to_height(int)

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.

Syntax

void fit_to_height(int flag);

Remark

Table 7-2 lists the fit_to_height(int) method variable descriptions.

Table 7-2: fit_to_height(int) Method Variables

Variable

Description

flag

0 = Method is off
1 = Method is on

_________________________________________________________________________

Example

myPanel1.zoom = 0;
myPanel1.Simage.fit_to_height(1);
myPanel1.repaint();

_________________________________________________________________________

fit_to_width(int)

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.

Syntax

void fit_to_width(int flag);

Remark

Table 7-3 lists the fit_to_width(int) method setting descriptions.

Table 7-3: fit_to_width(int) Method Settings  

Setting

Description

0

Method is off

1

Method is on

_________________________________________________________________________

Example

myPanel1.zoom = 0;
myPanel1.Simage.fit_to_width(1);
myPanel1.repaint();

_________________________________________________________________________

getBitsPerPixel(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int getBitsPerPixel();

Returns

Integer. Any positive value (as well as 0) is a valid return.

get_fit_to_height()

This method returns the value set by fit_to_height(int).

Syntax

int get_fit_to_height();

Returns

Integer. It returns a 0 if off or 1 if on.

get_fit_to_width()

This method returns the value set by fit_to_width(int).

Syntax

int get_fit_to_width();

Returns

Integer. It returns a 0 if off or 1 if on.

getHeight(void)

This method returns the height of the image in pixels.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int getHeight();

Returns

Integer. Any positive value (as well as 0) is a valid return.

getInitialZoom(int, int)

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:
For the first zoom operation on an image, assuming the scrollbars are off, always zoom the image by at least the amount returned from this method.
A negative value indicates an error. See Appendix G for more information.
The getInitialZoom(int, int) method is based on the width and height of the panel. Scrolling will not work unless the image fills the entire panel.

Syntax

int getInitialZoom(int xsize, int ysize);

Remark

Table 7-4 lists the getInitialZoom(int, int) method variable descriptions.

Table 7-4: getInitialZoom(int, int) Method Variables

Variable

Description

xsize

Panel width in pixels

ysize

Panel height in pixels

getWidth(void)

This method returns the width of the image in pixels.

Syntax

int getWidth();

Returns

Integer. Any positive value (as well as 0) is a valid return.

getXdpi(void)

This method returns the X resolution, in dpi (dots per inch), of the image.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int getXdpi();

Returns

Integer. Any positive value (as well as 0) is a valid return.

getYdpi(void)

This method returns the Y resolution, in dpi (dots per inch), of the image.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int getYdpi();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_antique_effect(void)

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:
This method only works with 24-bit color images.

Syntax

int IMG_antique_effect();

IMG_color_gray(void)

This method converts 24-bit color images to 8-bit gray scale images.

Note:
This method only works with 24-bit images.

Syntax

int IMG_color_gray();

IMG_create_thumbnail(int, int)

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.

Syntax

int IMG_create_thumbnail(int xsize, int ysize);

Remark

Table 7-5 lists the IMG_create_thumbnail(int, int) method variable descriptions.

Table 7-5: IMG_create_thumbnail(int, int) Method Variables

Variable

Description

xsize

Destination width of image after resizing

ysize

Destination height of image after resizing

IMG_decompress_bitmap(String, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_bitmap(String st, int page);

Remark

Table 7-6 lists the IMG_decompress_bitmap(String, int) method variable descriptions.

Table 7-6: IMG_decompress_bitmap(String, int) Method Variables

Variable

Description

st

Path and filename of the image to decompress

page

Page number for the multipage image file

Returns

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);
}
____
_____________________________________________________________________

IMG_decompress_bitmap(java.awt.Image, int)

This method imports a Java™ image object.

Note:
A negative value indicates an error. See Appendix G for more information.

 

Syntax

int IMG_decompress_bitmap(java.awt.Image img, int bits_pix);

Remark

Table 7-7 lists the IMG_decompress_bitmap(java.awt.Image, int) method variable descriptions.

Table 7-7: IMG_decompress_bitmap(java.awt.Image, int) Method Variables

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.

Returns

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(),

_________________________________________________________________________

IMG_decompress_bitmap(java.io.DataInputStream, int)

This method decompresses data from a DataInputStream and automatically detects the file format.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_bitmap(java.io.DataInputStream di, int page);

Remark

Table 7-8 lists the IMG_decompress_bitmap(java.io.DataInputStream, int) method variable descriptions.

Table 7-8: IMG_decompress_bitmap(java.io.DataInputStream, int) Method Variables

Variable

Description

di

Java.io.DataInputStream

page

Page number if reading from multipage image file

Returns

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);

_________________________________________________________________________

IMG_decompress_bitmap_fd(String, int, int)

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.

Syntax

int IMG_decompress_bitmap_fd(String bm_name, int offset, int page);

Note:
A negative value indicates an error. See Appendix G for more information.

Remark

Table 7-9 lists the IMG_decompress_bitmap_fd(String, int, int) method variable descriptions.

Table 7-9: IMG_decompress_bitmap_fd(String, int, int) Method Variables  

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.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_decompress_bitmap_stream(String, int)

This method reads images from a standard URL. This method automatically detects the file format and is normally used by applets.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_bitmap_stream(String st, int page);

Remark

Table 7-10 lists the IMG_decompress_bitmap_stream(String, int) method variable descriptions.

Table 7-10: IMG_decompress_bitmap_stream(String, int) Method Variables  

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

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container)

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:
 
A display container is required for this method.
  
This method should not be used when there are no Graphical User Interface classes.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);

Remark

Table 7-11 lists the IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) method variable descriptions.

Table 7-11: IMG_decompress_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

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_decompress_fax(java.lang.String, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_fax(String bm_name, int xsize, int ysize, int type, int fill_order, int offset);

Remark

Table 7-12 lists the IMG_decompress_fax(java.lang.String, int, int, int, int, int) method variable descriptions.

Table 7-12: IMG_decompress_fax(java.lang.String, int, int, int, int, int) Method Variables

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
3 = Group 3
4 = Group 4 fax

fill_order

Bit order in each byte. Normal values:
0 = CALS, Intel byte order (MSB -> LSB)
2 = G3 and G4, Motorola byte order (LSB -> MSB)

offset

Absolute position of the first byte of compressed data

Returns

Integer

IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_fax(java.io.DataInputStream di, int xsize, int ysize, int type, int fill_order, int offset);

Remark

Table 7-13 lists the IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) method variable descriptions.

Table 7-13: IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) Method Variables

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
3 = Group 3
4 = Group 4 fax

fill_order

Bit order in each byte. Normal values:
0 = CALS, Intel byte order (MSB -> LSB)
2 = G3 and G4, Motorola byte order (LSB -> MSB)

offset

Absolute position of the first byte of compressed data

Returns

Integer

IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container)

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: 
A display container is required for this method.
This method should not be used when there are no Graphical User Interface classes.
 
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_decompress_multipage_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);

Remark

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

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_deskew_bitmap(int)

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:
When a call is made to IMG_deskew_bitmap, the internal Snowbound image object is stored in memory for viewing. The function needs to be saved to the library for the change to be permanent.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_deskew_bitmap(int rot_angle);

Remark

Table 7-15 lists the IMG_deskew_bitmap(int) method variable descriptions.

Table 7-15: IMG_deskew_bitmap(int) Method Variables

Variable

Description

rot_angle

Angle to rotate image

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_despeckel_bitmap(int)

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:
When a call is made to IMG_despeckel_bitmap, the internal Snowbound image object is stored in memory for viewing. The function needs to be saved to the library for the change to be permanent.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_despeckel_bitmap(int quality);

Remark

Table 7-16 lists the IMG_despeckel_bitmap(int) method setting descriptions.

Table 7-16: IMG_despeckel_bitmap(int) Method Settings

Setting

Description

1

Minimum noise reduction

30

Normal noise reduction

100

Maximum noise reduction

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_diffusion_mono(void)

This method converts 4, 8, or 24 bit images to 1-bit per pixel bi-level images.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_diffusion_mono();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_display_bitmap(java.awt.Graphics, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_display_bitmap(Graphics g, int xpos, int ypos, int xsize, int ysize);

Remark

Table 7-17 lists the IMG_display_bitmap(java.awt.Graphics, int, int, int, int) method variable descriptions.

Table 7-17: IMG_display_bitmap(java.awt.Graphics, int, int, int, int) Method Variables  

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

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_display_bitmap_aspect(Graphics g, Container f, int xpos, int ypos, int xsize, int ysize, int zoom);

Remark

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
0 = Display entire image
100 = One-to-one pixel display (one pixel per screen)

Returns

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();
      
}
}

_________________________________________________________________________

IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_display_bitmap_smooth(Graphics hdc, Container sf, int xs, int ys, int xsize, int ysize, int zoom);

Remark

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

Returns

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);

}

_________________________________________________________________________

IMG_erase_rect(int, int, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_erase_rect(int xs, int ys, int xsize, int ysize, int color, int in_outflag, int operation);

Remark

Table 7-20 lists the IMG_erase_rect(int, int, int, int, int, int, int) method variable descriptions.

Table 7-20: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables

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
0 = fill outside rectangle to the borders of the image

operation

1 = xor image rectangle
0 = fill image

Returns

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();

_________________________________________________________________________

IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[])

This method allows filling an area of a bitmap with specified patterns found in the pattern argument.

Syntax

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[]);

Remark

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

IMG_flip_bitmapx(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_flip_bitmapx();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_flip_bitmapy(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_flip_bitmapy();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_get_bitmap_block(int, int, int, int)

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.

Syntax

Snow.Snowbnd IMG_get_bitmap_block(int xs, int ys, int xsize, int ysize);

Remark

Table 7-21 lists the Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int) method variable descriptions.

Table 7-22: Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int) Method Variables

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

Returns

A new Snowbnd object

IMG_get_deskew_angle(int[], int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_get_deskew_angle(int p_angle[], int start_angle, int end_angle);

Remark

Table 7-23 lists the IMG_get_deskew_angle(int[], int, int) method variable descriptions.

Table 7-23: IMG_get_deskew_angle(int[], int, int) Method Variables

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)

Returns

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();
}

_________________________________________________________________________

IMG_invert_bitmap(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_invert_bitmap(void);

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_merge_block(Snow.Snowbnd, int, int, int)

This method draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in.

Notes:
 
The images must have compatible bit depths.
  
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_merge_block(Snowbnd shdib, int xpos, int ypos, int operation);

Remark

Table 7-24 lists the IMG_merge_block(Snow.Snowbnd, int, int, int) method variable descriptions.

Table 7-24: IMG_merge_block(Snow.Snowbnd, int, int, int) Method Variables

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
1 = draw only the black part of 1-bit images

Returns

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();
      
}
}

_________________________________________________________________________

IMG_print_applet(java.awt.Container, int)

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:
This method is for the Internet Explorer and Netscape Navigator browsers only. Results may vary with other browsers.
A negative value indicates an error. See Appendix G for more information

Syntax

int IMG_print_applet(Container C, int res);

Remark

Table 7-25 lists the IMG_print_applet(java.awt.Container, int) method variable descriptions.

Table 7-25: IMG_print_applet(java.awt.Container, int) Method Variables

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)

Returns

Integer. Any positive value (as well as 0) is a valid return.

_________________________________________________________________________

Example

void button4_clicked(Event e)
      
{
         
IMG_print_applet(this, 300);
      
}

_________________________________________________________________________

IMG_print_applet_pages(java.awt.Container, int)

This method prints high-resolution multipage documents from applets.

Notes:
This method is for the Internet Explorer and Netscape Navigator browsers only. Results may vary with other browsers. The resolution passed into this method must match the printer resolution. For example, if the printer is set to print at 300 DPI, make res = 300. Call this method for each page, pass c as null after the last page. A print dialog displays (in Windows), and the print job begins.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_print_applet_pages(Container c, int res);

Remark

Table 7-26 lists the IMG_print_applet_pages(java.awt.Container, int) method variable descriptions.

Table 7-26: IMG_print_appiet_pages(java.awt.Container, int) Method Variables

Variable

Description

c

Java.awt.Container of displayed image

res

Resolution in dpi (dots per inch) of the destination image

Returns

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);
}

_________________________________________________________________________

IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)

This method prints the current image at the specified coordinates.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_print_bitmap(Graphics g, int xs, int ys, int xsize, int ysize, int res);

Remark

Table 7-27 lists the IMG_print_bitmap(java. awt.Graphics, int, int, int, int, int) method variable descriptions.

Table 7-27: IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) Method Variables  

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.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_promote_24(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_promote_24();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_remove_red_eye(int, int, int, int)

This method detects and converts photos of people with very red eyes to more natural colors.

Note:
If xpos, ypos, xsize, or ysize is set to -1, the entire photo is searched.
For best results, refine the search area.
This method works only with 24-bit color images.

Syntax

int IMG_remove_red_eye(int xpos, int ypos, int xsize, int ysize);

Remarks

Table 7-28 lists the IMG_remove_red_eye(int, int, int, int) method variable descriptions.

Table 7-28: IMG_remove_red_eye(int, int, int, int) Method Variables

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

IMG_resize_bitmap(int, int)

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:
Do not use this method for zooming; you will permanently alter the image data.
A negative value indicates an error. See Appendix G for more information

Syntax

int IMG_resize_bitmap(int hres, int vres);

Remark

Table 7-29 lists the IMG_resize_bitmap(int, int) method variable descriptions.

Table 7-29: IMG_resize_bitmap(int, int) Method Variables

Variable

Description

hres

New horizontal size of the image

vres

New vertical size of the image

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_resize_bitmap_bicubic(int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_resize_bitmap_bicubic(int xsize, int ysize);

Remark

Table 7-30 lists the IMG_resize_bitmap_bicubic(int, int) method variable descriptions.

Table 7-30: IMG_resize_bitmap_bicubic(int, int) Method Variables

Variable

Description

xsize

Target width of image in pixels

ysize

Target height of image in pixels

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_resize_to_gray(int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_resize_to_gray(int xsize, int ysize);

Remark

Table 7-31 lists the IMG_resize_to_gray(int, int) method variable descriptions.

Table 7-31: IMG_resize_to_gray(int, int) Method Variables 

Variable

Description

xsize

Target width of image in pixels

ysize

Target height of image in pixels

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_rgb_to_cmyk(void)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_rgb_to_cmyk();

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_rotate_bitmap(int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_rotate_bitmap(int angle);

Remark

Table 7-32 lists the IMG_rotate_bitmap(int) method variable descriptions.

Table 7-32: IMG_rotate_bitmap(int) Method Variables

Variable

Description

angle

Angle to rotate image by, in hundredths of a degree. For example, to rotate an image by 90 degrees, enter 9000.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_save_bitmap(byte, int)

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:
 
To save multiple pages for other formats, see ‘‘IMG_save_bitmap(String, int)’’ and Appendix D for more information.
This method returns a length of the compressed image in the byte array.
A negative value indicates an error. See Appendix G for more information.
This method returns a length of the compressed image in the byte array.

Syntax

int IMG_save_bitmap(byte array[] b, int comp_type);

Remark

Table 7-33 lists the IMG_save_bitmap(byte, int) method variable descriptions.

Table 7-33: IMG_save_bitmap(byte, int) Method Variables

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.

Returns

Integer. Any positive value (as well as 0) is the size of the image in the array.

IMG_save_bitmap(String, int)

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:
Only applications and signed applets can save to a file.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_save_bitmap(String st, int comp_type);

Remark

Table 7-34 lists the IMG_save_bitmap(String, int) method variable descriptions.

Table 7-34: IMG_save_bitmap(String, int) Method Variables

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.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_scroll_bitmap(java.awt.Container, java.awt.Event)

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:
 
A HandleEvent method for scrolling is not needed because it is handled internally.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_scroll_bitmap(Container sf, Event evt);

Remark

Table 7-35 lists the IMG_scroll_bitmap(java.awt.Container, java.awt.Event) method variable descriptions.

Table 7-35: IMG_scroll_bitmap(java.awt.Container, java.awt.Event) Method Variables

Variable

Description

sf

Current frame or window

evt

Event object passed to the event handler

Returns

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);
}

_________________________________________________________________________

IMG_set_croprect(int, int, int, int)

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:
This method is interchangeable with ‘‘set_croprect(int, int, int, int)’’.
 
Crop values are static and cannot be used in a multi-threading environment.

Syntax

void IMG_set_croprect(int xs, int ys, int xsize, int ysize);

Remark

Table 7-36 lists the IMG_set_croprect(int, int, int, int) method variable descriptions.

Table 7-36: IMG_set_croprect(int, int, int, int) Method Variables

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

IMG_shift_bitmap(int, int)

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: 
The height and width of the image do not change, so any data shifted beyond the border of the image is permanently lost.
 
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_shift_bitmap(int xoffset, int yoffset);

Remark

Table 7-37 lists the IMG_shift_bitmap(int, int) method variable descriptions.

Table 7-37: IMG_shift_bitmap(int, int) Method Variables

Variable

Description

xoffset

Positive or negative horizontal distance to move image data

yoffset

Positive or negative vertical distance to move image data

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMG_window_level(int, int, int)

This method changes the range of displayed pixels. It performs window leveling in 8 and 16-bit gray scale images.

Notes:
If the min and max values are set to zero, the method automatically calculates the min and max values by analyzing the image.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMG_window_level(int min, int max, int on_off);

Remark

Table 7-38 lists the IMG_window_level(int, int, int) method variable descriptions.

Table 7-38: IMG_window_level(int, int, int) Method Variables

Variable

Description

min

Minimum value of window level

max

Maximum value of window level

on_off   

1 = On
0 = Off

Returns

Integer. Any positive value (as well as 0) is a valid return.

_________________________________________________________________________

Example

if (Simage.getBitsPerPixel() == 16)
      
Simage.IMG_window_level(0,0,1);

_________________________________________________________________________

IMGLOW_extract_text(String, int, int, int)

This method extracts text from PTOCA, PCL, MS Word, AFP, and MS Excel files. Returns the buffer of extracted text in ASCII format.

Syntax

byte[] IMGLOW_extract_text(String bm_name, int length[], int error[], int page);

Remarks

Table 7-39 lists the IMGLOW_extract_text(String, int, int, int) method variable descriptions.

Table 7-39: IMGLOW_extract_text(String, int, int, int) Method Variables 

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

Returns

ASCII format.

Note:
Some PDF or PCL files may be in a format that will not allow text searching.

___________________________________________________________________________

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

___________________________________________________________________________

Table 7-40: Variables Included in Extracted Text

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
0 = plain

FontItalic

Font to be drawn in normal or italic

1 = italic
0 = normal

Xpos

X pos in pixels

Ypos

Y pos in pixels

%%SOT

Start of text block

%%EOT

End of text block

IMGLOW_get_brightness()

This method returns the current brightness set by IMGLOW_set_brightness(int). The default is 0. See ‘‘IMGLOW_set_brightness(int)’’for more information.

Syntax

int IMGLOW_get_brightness();

Returns

Integer. Any value between -127 and 127.

IMGLOW_get_contrast()

This method returns the current contrast set by IMGLOW_set_contrast(int). The default is 0. See ‘‘IMGLOW_set_contrast(int)’’ for more information.

Syntax

int IMGLOW_get_contrast();

Returns

Integer. Any value between -127 and 127.

IMGLOW_get_fileinfo(java.io.DataInputStream, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_fileinfo(java.io.DataInputStream di, int page);

Remark

Table 7-41 lists the IMGLOW_get_filetinfo(java.io.DataInputStream, int) method variable descriptions.

Table 7-41: IMGLOW_get_fileinfo(java.io.DataInputStream, int) Method Variables  

Variable

Description

filename

File name and path to an image

page

Page number of multipage file

Returns

Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.

IMGLOW_get_filetype(String)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_filetype(String filename);

Remark

Table 7-42 lists the IMGLOW_get_filetype(String) method variable descriptions.

Table 7-42: IMGLOW_get_filetype(String) Method Variables

Variable

Description

filename

File name and path to an image

Returns

Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.

IMGLOW_get_filetype(java.io.DataInputStream)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_filetype(DataInputStream dis);

Remark

Table 7-43 lists the IMGLOW_get_filetype(java.io.DataInputStream) method variable descriptions.

Table 7-43: IMGLOW_get_filetype(java.io.DataInputStream) Method Variables

Variable

Description

dis

Image in memory

Returns

Integer. Any positive value (as well as 0) is the image type as defined in Snow.Defines, Appendix C.

IMGLOW_get_gamma()

This method returns the current gamma set by IMGLOW_set_gamma(int). The default is 100. See ‘‘IMGLOW_set_gamma(int)’’ for more information.

Syntax

int IMGLOW_get_gamma();

Returns

Integer. Any value between 0 and 400.

IMGLOW_get_image_orientation(void)

This method returns the orientation of the last image decompressed if the information is available. Orientation is used to determine the display angle.

Note: 
Currently, TIFF and CALS can return orientation information.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_image_orientation();

Returns

Integer. Any positive value (as well as 0) is the orientation of the image.

IMGLOW_get_pages(java.io.DataInputStream)

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: 
 
The first page is 0.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_pages(DataInputStream dis);

Remark

Table 7-44 lists the IMGLOW_get_pages(java.io.DataInputStream) method variable descriptions.

Table 7-44: IMGLOW_get_pages(java.io.DataInputStream) Method Variables

Variable

Description

dis

An object containing compressed image data. This usually contains a file loaded into memory, and is commonly, but not necessarily, multipaged.

Returns

Integer. Any positive value is the number of pages in the image.

IMGLOW_get_pages(String)

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: 
The first page is 0.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_pages(String filename);

Remark

Table 7-45 lists the IMGLOW_get_pages(String) method variable descriptions.

Table 7-45: IMGLOW_get_pages(String) Method Variables

Variable

Description

filename

Filename and path to an image

Returns

Integer. Any positive value is the number of pages in the image.

IMGLOW_get_raster(int, byte[])

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_get_raster(int ypos, byte buff[]);

Remark

Table 7-46 lists the IMGLOW_get_raster(int, byte[]) method variable descriptions.

Table 7-46: IMGLOW_get_raster(int, byte[]) Method Variables

Variable

Description

ypos

Line to retrieve

buff

Buffer to hold data

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int)

IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int)

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.

Syntax

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);

Remark

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:
1 = String
0 = Non String

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.

Returns

Dependent on how value variable is set.

IMGLOW_put_raster(int, byte[])

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_put_raster(int ypos, byte buff[]);

Remark

Table 7-48 lists the IMGLOW_put_raster(int, byte[]) method variable descriptions.

Table 7-48: IMGLOW_put_raster(int, byte[]) Method Variables

Variable

Description

ypos

Line to replace

buff

Data with which to replace

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_search_text(byte[], String, int, int, int[])

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:
A negative value indicates an error. See Appendix G for more information.
The following file formats are supported: AFP, PCL, PDF, Word and Excel.

Syntax

SNBD_SEARCH_RESULT[] IMGLOW_search_text(byte[] buffer, String search_String, int page, int error[]);

Remark

Table 7-49 lists the IMGLOW_search_text(byte[], String, int, int, int[]) method variable descriptions.

Table 7-49: IMGLOW_search_text(byte[], String, int, int, int[]) Method Variables

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.
0 = Not case sensitive
1 = case sensitive

error

Error code

IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double)

This method sets attributes for importing an Ascii file into the Java RasterMaster library.

Syntax

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);

Remark

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.

IMGLOW_set_brightness(int)

This method sets the brightness of the current image.

Notes: 
Setting and saving the brightness permanently affects color and grayscale image data.
This method has no effect on 1-bit images, except at display time (if anti-alias is on, and alias = 2).
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_set_brightness(int value);

Remark

Table 7-51 lists the IMGLOW_set_brightness(int) method setting descriptions.

Table 7-51: IMGLOW_set_brightness(int) Method Settings

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

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_comp_quality(int)

This method sets the compression quality factor when saving JPEG images.

Note:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_set_comp_quality(int quality);

Remark

Table 7-52 lists the IMGLOW_set_comp_quality(int) method variable descriptions.

Table 7-52: IMGLOW_set_comp_quality(int) Method Variables  

Variable

Description

quality

1 = Smallest file size and lowest quality image
100 = Largest file size and highest quality image

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_contrast(int)

This method sets the relative difference between the image’s black and white values.

Notes: 
Setting and saving the contrast permanently affects color and grayscale image data.
 
This method has no effect on 1-bit images, except at display time if anti-alias is on and alias = 2.
  
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_set_contrast(int value);

Remark

Table 7-53 lists the IMGLOW_set_contrast(int) method setting descriptions.

Table 7-53: IMGLOW_set_contrast(int) Method Settings

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.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_decompsize(int, int)

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:
The destination size must be set before calling any decompress method.

Syntax

int IMGLOW_set_decompsize(int xsize, int ysize);

Remark

Table 7-54 lists the IMGLOW_set_decompsize(int, int) method setting descriptions.

Table 7-54: IMGLOW_set_decompsize(int, int) Method Settings

Method

Description

xsize

Destination width of image after resizing

ysize

Destination height of image after resizing

IMGLOW_set_decomp_rect(int, int, int, int)

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:
This must be set prior to decompressing an image.

Syntax

int IMGLOW_set_decomp_rect(int xs, int ys, int xsize, int ysize);

Remarks

Table 7-55 lists the IMGLOW_set_decomp_rect(int, int, int, int) method setting descriptions.

Table 7-55: IMGLOW_set_decomp_rect(int, int, int, int) Method Settings

Method

Description

xs

Starting X position

xy

Starting Y position

xsize

Horizontal size of cropping rectangle

ysize

Vertical size of cropping rectangle

IMGLOW_set_document_input(int, int)

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:
The default is 200 dpi and 24 bits per pixel for PDF. The default is 300 dpi and 1 bit per pixel for PCL, AFP, Word, and Excel.

Syntax

int IMGLOW_set_document_input(int dpi, int bits_pix);

Remarks

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.
1 = black and white documents
24 = color images

Returns

Integer

IMGLOW_set_gamma(int)

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: 
Setting and saving the gamma factor permanently affects color and grayscale image data.
This method has no effect on 1-bit images, except at display time if anti-alias is on, and alias = 2.
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_set_gamma(int value);

Remark

Table 7-57 lists the IMGLOW_set_gamma(int) method setting descriptions.

Table 7-57: IMGLOW_set_gamma(int) Method Settings  

Setting

Description

0

No gamma correction

150

Default gamma correction (1.50)

400

Maximum gamma correction (4.00)

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_image_orientation(int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int IMGLOW_set_image_orientation(int orient);

Remark

Table 7-58 lists the IMGLOW_set_image_orientation(int) method variable descriptions.

Table 7-58: IMGLOW_set_image_orientation(int) Method Variables

Variable

Description

orient

Sets the image orientation

TIFF
1 = Rotated 0 degrees
2 = Flipped in the x direction
3 = Rotated 180 degrees
4 = Rotated 180 degrees and flipped in the x direction
5= Rotated 90 degrees and flipped in the x direction
6= Rotated 90 degrees
7 = Rotated 270 degrees and flipped in the x direction
8 = Rotated 270 degrees

CALS
0 = Rotated 0 degrees
90 = Rotated 90 degrees
180 = Rotated 180 degrees
270 = Rotated 270 degrees

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_jpg_interleave(int, int)

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:
To obtain the highest quality image, set both variables to a value of 1. (It does not skip any lines).
A negative value indicates an error. See Appendix G for more information.
The default, JPEG uses a 2:1 interleaving factor. It skips every other pixel in the X direction.

Syntax

int IMGLOW_set_jpg_interleave(int h_int, int v_int);

Remark

Table 7-59 lists the IMGLOW_set_jpg_interleave(int, int) method variable descriptions.

Table 7-59: IMGLOW_set_jpg_interleave(int, int) Method Variables

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.

Returns

Integer. Any positive value (as well as 0) is a valid return.

IMGLOW_set_overlay_path(String)

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.

Syntax

int IMGLOW_set_overlay_path(String st);

Remark

Table 7-60 lists the IMGLOW_set_overlay_path(String) method variable descriptions.

Table 7-60: IMGLOW_set_overlay_path(String) Method Variables

Variable

Description

st

Specify path of overlay file

IMGLOW_set_pcl_input(int, int)

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:
A negative value indicates an error. See the imgerr.h file or Appendix G for more information.

Syntax

int IMGLOW_set_pcl_input(int dpi, int bits_pix);

Remark

Table 7-61 lists the IMGLOW_set_pcl_input(int dpi, int bits_pix) method variable descriptions.

Table 7-61: IMGLOW_set_pcl_input(int dpi, int bit_pix) Method Variables

Variable

Description

dpi

Dots per inch in which to render the pcl file.

bits_pix

Bitmap pixel depth. Set to 1 or 24.

IMGLOW_set_pdf_input(int, int)

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:
When used for black and white PDF documents calling IMGLOW_set_pdf_input() set to a dpi of 200 and bits per pixel of 1, it provides optimal decompress and display performance. Also, it is ideal for TIFF Group 4 conversions.

Syntax

int IMGLOW_set_pdf_input(int dpi, int bits_pix);

Remark

Table 7-62 lists the IMGLOW_set_pdf_input(int, int) method variable descriptions.

Table 7-62: IMGLOW_set_pdf_input(int, int) Method Variables

Variable

Description

dpi

Dots per inch in which to render the pdf.
typical dpi is 300
1-bit images such as documents dpi is 200
color images dpi is 100 or 200

bits_pix

Bitmap pixel depth for resulting rendered pdf image. Set to 1 or 24.

IMGLOW_set_pdf_output(int, int)

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.

Syntax

int IMGLOW_set_pdf_output(int xsize, int ysize);

Remark

Table 7-63 lists the IMGLOW_set_pdf_output(int, int) method variable descriptions.

Table 7-63: IMGLOW_set_pdf_output(int, int) Method Variables  

Variable

Description

xsize

Destination width of image after resizing

ysize

Destination height of image after resizing

IMGLOW_set_tiff_tag(int, int, int, byte[])

This method allows RasterMaster to write new and current tags. This method can be called multiple times for adding multiple tags to write.

Note:
Setting the tag ID to -1 clears out all extra tags from being written to the file.

Syntax

int IMGLOW_set_tiff_tag(int tag, int max_bytes, int value, byte buff[]);

Remarks

Table 7-64 lists the IMGLOW_set_tiff_tag(int, int, int, byte[]) method variable descriptions.

Table 7-64: IMGLOW_set_tiff_tag(int, int, int, byte[]) Method Variables

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

IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String)

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.

Syntax

int IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name);

Remarks

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
TIFF_COMP_GIII = 2, modified huffman group 3
TIFF_COMP_GIIIP = 3, modified huffman group 3 padding
TIFF_COMP_G4 = 4, modified huffman group 4
TIFF_COMP_LZW = 5, lzw compression
TIFF_COMP_PACK = 32773, pack bits compression
TIFF_COMP_JPEG = 6, JPEG compression
TIFF_COMP_JPEG_GRAY = 7, JPEG compression 8 bit gray scale
TIFF_COMP_G4_FO = 4000, modified huffman group 4
TIFF_COMP_JBIG = 34661, JBIG format

bm_name

Name of output tiff file to create

 

map_image_to_wnd(java.awt.Container, java.awt.Point)

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).

Syntax

void map_image_to_wnd(java.awt.Container sf, java.awt.Point pt);

Remark

Table 7-66 lists the map_image_to_wnd(java.awt.Container, java.awt.Point) method variable descriptions.

Table 7-66: map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables  

Variable

Description

sf

Container for displayed image

pt

Point to be mapped

map_wnd_to_image(java.awt.Container, java.awt.Point)

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).

Syntax

void map_wnd_to_image(java.awt.Container sf, java.awt.Point pt);

Remark

Table 7-67 lists the map_wnd_to_image(java.awt.Container, java.awt.Point) method variable descriptions.

Table 7-67: map_wnd_to_image(java.awt.Container, java.awt.Point) Method Variables

Variable

Description

sf

Container for displayed image

pt

Point to be mapped

set_croprect(int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int set_croprect(int xs, int ys, int xe, int ye);

Remark

Table 7-68 lists the set_croprect(int, int, int, int) method variable descriptions.

Table 7-68: set_croprect(int, int, int, int) Method Variables

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

Returns

Integer. Any positive value (as well as 0) is a valid return.

set_croprect_scroll(java.awt.Container, int, int, int, int, int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int set_croprect_scroll(java.awt.Container sf, int xs, int ys, int xe, int ye, int aspect);

Remark

Table 7-69 lists the set_croprect_scroll(java.awt.Container, int, int, int, int, int) method variable descriptions.

Table 7-69: set_croprect_scroll(java.awt.Container, int, int, int, int, int) Method Variables  

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.
Any other value stretches the image.

Returns

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();
      
}

}

_________________________________________________________________________

setFrame(java.awt.Container)

This method sets the destination container for image display.

Note:
This method must be called prior to decompressing PTOCA or ASCII files.

Syntax

void setFrame(java.awt.Container c);

Remark

Table 7-70 lists the setFrame(java.awt.Container) method variable descriptions.

Table 7-70: setFrame(java.awt.Container) Method Variables

Variable

Description

c

Container of displayed image (usually "this")

setXdpi(int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int setXdpi(int dpi);

Returns

Integer. Any positive value (as well as 0) is a valid return.

setYdpi(int)

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:
A negative value indicates an error. See Appendix G for more information.

Syntax

int setYdpi(int dpi);

Returns

Integer. Any positive value (as well as 0) is a valid return.

Snowbnd(int, int, int)

This is an alternate constructor for the Snowbnd object. This allows the creation of a blank image with allocated memory.

Syntax

Snowbnd(int xsize, int ysize, int bits_pix);

Remark

Table 7-71 lists the Snowbnd(int, int, int) method variable descriptions.

Table 7-71: Snowbnd(int, int, int) Method Variables

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.

Snowbnd(Snowbnd)

This is an alternate constructor that creates a new Snowbnd object by copying the contents of an existing Snowbnd object.

Syntax

Snowbnd(Snowbnd toCopy);

Remark

Table 7-72 lists the Snowbnd(Snowbnd) method variable description.

Table 7-72: Snowbnd(Snowbnd) Method Variables

Variable

Description

toCopy

Existing Snowbnd object.