This sample is an image viewer that demonstrates the following image manipulations: altering the viewable size, changing the orientation, changing the size and resolution, making corrections, and flipping through pages of a multi-page file. You can find the samples in the
This sample also demonstrates several annotation methods, such as adding edits, bitmaps, lines, sticky notes, and more through a variety of methods. These annotations can be in both text and graphic format.
Listed below are the methods used in this sample:
IMG_decompress_bitmap(String, int)reads in a document in any format and converts it to a valid Snowbound image.
IMG_deskew_bitmap(int)is a fast rotate for 1-bit skewed images.
IMG_despeckle_bitmap(int)removes noise (random pixel data) from 1-bit images.
IMG_display_bitmap(java.awt.Graphics, int, int, int, int)displays the current image at the current X andY coordinates and is not corrected for aspect ratio.
IMG_display_bitmap_aspect(java.awt.Graphics,java.awt.Container, int, int, int, int, int)displays the current image, corrected for aspect ratio, at the current X andY coordinates.
IMG_erase_rect(int, int, int, int, int, int, int)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.
IMG_flip_bitmapx(void)flips the image horizontally to produce a mirror image.
IMG_flip_bitmapy(void)flips the image vertically to produce a mirror image.
IMG_get_deskew_angle(int, int, int)returns the skew angle for 1-bit images.
IMG_invert_bitmap(void)inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory.
IMG_merge_block(Snow.Snowbnd, int, int, int)draws a source image on top of the current image at the x and y coordinates(x pos and y pos) passed in.
IMG_print_applet_pages(java.awt.Container, int)prints high-resolution multi-page documents from applets.
IMG_resize_bitmap(int, int)resizes the image.
IMG_rotate_bitmap(int)rotates the current image clockwise by display angle.
IMG_save_bitmap(byte, int)saves the current
Snowbndimage object to the format
specifiedbycomp_type. The string value is the output file.
IMG_scroll_bitmap(java.awt.Container,java.awt.Event)scrolls the bitmap. It essentially moves the current cropping rectangle in the direction indicated by the Scroll Bar thumb. For users who do not want the scroll bars visible, a similar effect can be achieved by moving the cropping rectangle around using IMG_set_croprect.
IMG_window_level(int, int, int)changes the range of displayed pixels. It performs window leveling and 16-bit gray scale images.
SANN_read_ann(DataInputStream, int)reads an annotation file from disk. Pathnames are absolute. It supports multi-page annotation files.
SANN_set_croprect(int, int, int, int)sets the cropping rectangle is essentially the size of the display container (whichisusuallyasubclassofjava.awt.Container), mapped on to the image(corrected for image scaling).
SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)displays all current annotations (superimposes on the image) to the Graphics context pointed by
GetClientRect(java.awt.Container, Snow.SANN_RECT)fills a SANN_RECT object with the current height and width of the display area.
SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int)highlights the bounding box of the annotation object specified by
ui_delete(java.awt.Container)deletes the currently selected annotation object. It is used by a built in annotation editing pop-up menu to fire the SANN_delete_object method on the currently selected annotation object.
ui_startmove(java.awt.Container)notifies the annotation library that the current annotation object is being moved.
ui_startresize(java.awt.Container)notifies the annotation library that the current annotation object is being resized.
ui_wm_lbuttondown(java.awt.Container, int, int, byte)begins tracking mouse movements when the mouse button is pressed. Call this method during the mouse down or mouse pressed events.
ui_wm_mousemove(java.awt.Container, int, int, byte)notifies the library of the current mouse coordinates.
ui_wm_lbuttonup(java.awt.Container, int, int, byte)notifies the annotation library that the mouse button has been released.
SANN_write_ann(String, int, byte)writes out annotations to the disk file.
SANN_activate_all_objects(void)activates all text based annotation objects to allow text editing in the TextArea represented by these objects. Currently used only on the SANN_EDIT and SANN_POSTIT objects.
SANN_deactivate_all_objects(void)is used on the
SANN_POSTITobjects to disallow editing of text in all text based objects. It makes the window inactive and draws the object data statically, superimposed on the image.
SnowAnn Sann= new SnowAnn(int, int);
Have questions, corrections, or concerns about this topic? Please let us know!