This chapter describes the available methods for the Snow.Snowbnd class. The chapter contains the following topics:
‘‘IMG_autocrop_bitmap(int, int)’’
‘IMG_auto_orient(Snow.Snowbnd, int)’’
‘‘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(byte, int, int, int)’’
‘‘IMG_save_bitmap(int, int, int, int)’’
‘‘IMG_save_bitmap(String, int)’’
‘‘IMG_save_document(String, byte, int)’’
‘‘IMG_save_document(byte, byte, 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_page(String, int, int)’’
‘‘IMGLOW_extract_page(java.io.DataInputStream, 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_fast_convert(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_set_UTF_8(int)’’
‘‘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 5-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 5-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 5-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 5-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 function finds and clips any white border around the image in all directions. The border is discarded and the image is resized to the new cropped rectangle plus the margin.
The margin may be a value of 0.
|
Notes: |
int SNBDAPI IMG_autocrop_bitmap(int hdib, int margin);
Table 5-5 lists the IMG_autocrop_bitmap(int, int) method variable descriptions.
|
Variable |
Description |
|
hdib |
Standard RasterMaster image handle. |
|
margin |
Number of pixels to add to the autocrop rectangle. |
Integer. Any positive value (as well as 0) is a valid return.
This function returns the orientation of the image. The value is 90 or 0. If the value is 90, you may want to fix the image by using IMG_rotate_bitmap() as follows:
IMG_auto_orient(imghandle,angle)
if (angle == 90)
IMG_rotate_bitmap(imghandle,andle[0] * 100)
See ‘‘IMG_rotate_bitmap(int)’’ for more information.
|
Note: |
int SNBDAPI IMG_auto_orient(Snowbnd hdib, int *p_angle);
Table 5-6 lists the IMG_auto_orient(Snow.Snowbnd, int) method variable descriptions.
|
Variable |
Description |
|
hdib |
Standard RasterMaster image object. |
|
p_angle |
p_angle Angle returned as the current orientation. Either 90 or 0 is returned. |
Integer. Any positive value (as well as 0) is a valid return.
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 5-7 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 5-8 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 5-9 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. It only decompresses an image from a DataInputStream and created from a ByteArray. Then, you can call decompress on a ByteArray or create a DataInputStream from this ByteArray.
|
Note: |
int IMG_decompress_bitmap(java.io.DataInputStream di, int page);
Table 5-10 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 5-11 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 5-12 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 5-13 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 5-14 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 5-15 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 5-16 lists the IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) method variable descriptions.
|
Table 5-16: 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 5-17 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 5-18 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 5-19 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 5-20 lists the IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) method variable descriptions.
|
Table 5-20: 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 5-21 lists the IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) method variable descriptions.
|
Table 5-21: 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 5-22 lists the IMG_erase_rect(int, int, int, int, int, int, int) method variable descriptions.
|
Variable |
Description |
|
xs |
Start X coordinate of rectangle in pixels. |
|
ys |
Start Y coordinate of rectangle in pixels. |
|
xsize |
Width of rectangle in pixels. |
|
ysize |
Height of rectangle in pixels. |
|
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 5-23 lists the IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) method variable descriptions.
|
Table 5-23: 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 5-24 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 5-25 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 coordin