
ImageGear Professional
Java Bean User’s Guide
© 2002 AccuSoft Corporation. All
Rights Reserved. AccuSoft and ImageGear are registered trademarks of AccuSoft Corporation.
The AccuSoft Image Guaranteeä , Pro Gold, and High Performance Imagingä are
trademarks of AccuSoft Corporation. All company and brand names are trademarks
or registered trademarks of their respective owners.
ImageGear Java comes in two versions, a Java
Class Library for access to low-level programming functions, and a Java
Beans toolkit for higher-level programming.
ImageGear Java includes:
ImageGear Java Bean (IGBean) is derived from Java’s AWT Panel. IGBean allows for the association (loading) an arbitrary number of images. Only one image is active; it is visible in the IGBean window. Most of the IGBean properties, for example, "loadPage", and "rotatePage" work with an active image. There is an API to navigate through the images.
IGBean is a complete multithread-safe component. There are two ways of performing pixel operations such as loading, saving, printing, and IP using IGBean: These are the sync and async mode. Only one thread performs the pixel operation at one time. If you use it in the "sync" mode, other threads wait until the current thread finishes with the pixel operation. If you use it in the "async" mode, IGBean sets an error if more than one thread is trying to perform a pixel operation.
After the ImageGear Professional installation you need to obtain license key.
If you're evaluating the product please use AccuSoft ImageGear evaluation page (https://www.accusoft.com/licensing/v1/WebEvalClient/product.aspx). Please login using the same e-mail and password you have registered with on AccuSoft Web site. After you supply login credentials your license key will be automatically generated and displayed in the browser’s window. You can copy and paste it into your application.
Evaluation license enables you to use any features of the product on your machine for a limited period of time.
To extend Evaluation license:
1. Login to the AccuSoft ImageGear evaluation page.
2. Click Submit extension request button.
Your request will be considered and you will receive e-mail notification when your license is extended. Then you would need to login to the AccuSoft ImageGear evaluation page again to generate new license key.
If you have bought development copy of ImageGear Professional please use AccuSoft license page for developers (https://www.accusoft.com/licensing/v1/WebProductClient/login.aspx). You will be prompted to login using e-mail and password you have registered with on AccuSoft Web site. Upon login you will be presented with the page that has the combo-box containing different access keys for the AccuSoft products you have bought and allows you to generate a development license for each access key. Once you generated the license you can copy and paste it into your application.
Development license enables you to use any of the ImageGear features on the limited number of computers.
Note:
If you don’t have Internet connection, please call AccuSoft at 1-508-351-9092.
Note:
Development license enables you to develop any applications but in order to deploy your ImageGear-based application you need to obtain a deployment license. Please contact AccuSoft when you’re ready to deploy your solution.
IGBean’s API
IGBean provides an API that is a set of properties, methods, and events. For example, to load and display an image into the Bean, you would write the following:
Bean1. setLoadPage
("your_filename.tif").
IGBean’s API is accessible from the "accusoft.ig.bean.IGBean.class". Property editors provide you constants that you are able to pass into IGBean’s API as parameters. IGBean uses useful classes and interfaces from the "accusoft.ig" and "accusoft.ig.GUI" packages.You would need to import all three of these packages to use all of IGBean’s capabilities:
import
accusoft.ig.bean.*;
import
accusoft.ig.*;
import
accusoft.ig.GUI.*;
IGBean API categories:
Below is a brief description for each group. Please see the Bean API reference doc for details.
Load & Save API
The Load & Save API, loads and
saves images. Images can be loaded from a local file or a URL. Images can be
saved only to a local file. You can specify the page number for both load and
save operations. The API works with the active image.
Image Processing API
The Image Processing API performs image
processing functions: rotation (90 degrees, 180 degrees, 270 degrees), rotation
on any angle (with expand and shrink options), resize, flip, and crop. The API
works with the active image.
Image Management API
IGBean allows images to be organized as an
array. By default, the zero entry of the array is created automatically when
you load the first image into IGBean. Each entry of the array contains IGBean's
Page Object within it. The "ImageIndex" property determines
which entry is active.
The four stages of an IGBean's Page Object:
Display Attributes API
The Display Attributes API controls
and retrieves information about: aspect ratio, scale method (none and scale to
gray for B/W images), scroll, zoom, rectangles: device rectangle, image
rectangle, and clip rectangle, fit method, and centered flag. There is also a
zoom to rectangle API and a GUI version. There is a method to perform device to
image coordinate conversion and disable display ("AutoRedraw")
flag. IGBean's Page Object contains all display parameters as thread-dependent;
the same image is displayed or printed from more than one thread using
different parameters in each thread. There are reasonable default values for
all the display attributes.
Here are some definitions and rules that
provide a better understanding about how the display code works.
The previous graphic represents the image in
green and the logical area to display the image with gray. The following table
provides definitions for this graphic.
|
ImageRect |
The ImageRect defines the
part of image used in all display operations. In other words, the area not
inside ImageRect is ignored. This rectangle is calculated in image
coordinates - (0,0) means the top-left pixel of the image and (width-1,
height-1) means the bottom-right pixel. "getImageRect" and "setImageRect" methods get and set the ImageRect parameter. The default value is the whole image. ImageRect can not be larger than the actual image and can not intersect on image boundaries. |
|
DeviceRect |
DeviceRect defines the
logical area to display the image and calculates the device coordinates that
are related to the current output device – component. (0,0) means top-left
corner of component. "getDeviceRect" and "setDeviceRect" get and set the device rectangle. The default value is null - the device rectangle is calculated automatically from the component size. |
|
ClipRect |
ClipRect is the rectangle
that defines an area inside of a component where to draw the image. In other
words, this is a clipping rectangle that tells which part of the component is
allocated for drawing the image. "getClipRect" and "setClipRect" get and set ClipRect. The default value is null – the whole component is used for drawing. |
|
Aratio |
Aratio is the
relationship between the width and height of an image or rectangle. The aspect
ratio can be fixed or not fixed. Fixed means the display code preserves the
specified aspect ratio; Not fixed means the ratio may change depending upon
other parameters. The method "getAspectRatioMode"
returns the current aspect ratio mode which can be either:
|
|
FitMode |
This parameter tells how
to map an image to a device rectangle. Possible values are:
|
|
Centered |
This flag specifies how
to locate the image inside a device rectangle after applying the fit method
and aspect mode. If this flag is set then the display code centers the image
inside the device rectangle, otherwise, the image is located at the top-left
corner. Methods "getDisplayCentered"
and "setDisplayCentered" get and set this value. Default value is true. |
|
ZoomValue |
ZoomValue is a
relationship between the size of the visual representation of an image and
its actual size. It can be fixed or not fixed. If this value is fixed then
the display code applies correction after the fit method, aspect ratio and
centered is done to keep the specified zoom value. There are 2 methods that
allow getting and setting this value:
The default value is null – the zoom value is not fixed. |
|
ScrollPos |
If the image does not fit
to ClipRect, then the scroll position is used to move the viewed area inside
of the ClipRect. ImageGear automates scrolling by handling standard Scrollbar
messages. However, it is possible
to obtain scroll parameters using the methods "getScrollHPos",
"getScrollVPos", "getScrollHRange",
"getScrollVRange". "setScrollHPos", "setScrollVPos" can be used to set scroll position. |
"AdeviceRect" is a rectangle that is calculated using
all the parameters described in the table. It is defined as the "actual
device rectangle" that incompasses the entire image.
The display attributes "get" and
"set" work on the absence or existence of IGBean's Page Object and
whether it is associated with the active index. This condition is tested using
the "PageCreated" property. If it returns "true"
then a valid IGBean's Page Object is associated with the active index. If it
returns "false" then IGBean's Page Object is not allocated in
the active index.
When you set the display option, IGBean
remembers it. If the Page Object is allocated, it sets the corresponding
attributes of the object also. When you create a new Object (you do it before
the first image is loaded into the image index, or after applying "DelPage")
your last display settings are used to initialize the new Page Object.
When you get a display option, IGBean’s
behavior depends on the "PageCreated" state. If "PageCreated"
is "true", then you receive the actual option from the Page
Object. If "PageCreated" is "false", then
IGBean provides the default value.
Print API
The Print API prints the image taking Java’s
"PrintJob" as a parameter.
Status Event API
The Status Event API monitors the progress
and cancels execution of the pixel operations such as load, save, IP, and
print. You implement the "IG_Status" interface and pass it into
the "setStatusEvent" method. Next, IG calls your "HandleEvent"
each time the pixel operation starts, reports progress, and finishes.
Image and File Info API
This API retrieves information about the image
that has been loaded into IGBean or file/URL: Bit Depth, Width, Height,
Resolution, Compression, File Format and allows you to change the resolution of
the loaded image.
IGBean's options API
This API retrieves and sets IGBean’s
options, for example, the "sync"/"async" mode
of execution, etc.
Error handling API
IGBean has an error stack that keeps track
of errors. There is an API that retrieves the current error count, clears the
error stack, and retrieves the information about an individual error. The error
stack is either global (default) or thread-dependent. The "ErrorHandlingType"
property controls this. It can be set to:
IGBean also has the option to report errors
as they occur. There are 3 types of error reporting in IGBean: "None",
"ErrorEvent", and "GUI report":
"None" means that IGBean
takes no special reporting action upon detecting an error.
"ErrorEvent" means your
class receives a special error event when the error occurs.
You add/remove the event listeners using
IGBean’s API. Error Event contains the last error code and thread name
as parameters.
"GUI report" means that
IGBean displays a GUI report window. It is useful in the debug stage as a
simple and ready out-of-the-box type of error report.
Version Control API
This API retrieves information about the current
version of IGBean.
GUI API
This API provides you with GUI to perform
useful operations like zoom to rect.
List of file formats and compression
algorithms supported in this version:
Read:
Important note: The AccuSoft Image Guaranteeä works for
all supported formats listed above, except GIF and JPEG, where Java’s API is
used to read those and therefore AccuSoft can not guarantee the correct reading
of these.
Write:
"XDpi" - Horizontal resolution of image.
Type: Integer.
Default: 200.
"YDpi" - Vertical resolution of image.
Type: Integer.
Default: 200.
"MarginsLeft" - Left text margin on page, expressed as thousandths of an inch.
Type: Integer.
Default: 1000.
"MarginsRight" - Right text margin on page, expressed as thousandths of an inch.
Type: Integer.
Default: 1000.
"MarginsTop" - Top text margin on page, expressed as thousandths of an inch.
Type: Integer.
Default: 1000.
"MarginsBottom" - Bottom text margin on page, expressed as thousandths of an inch.
Type: Integer.
Default: 1000.
"TabStop" - The number of characters per tab.
Type: Integer.
Default: 3.
"PageWidth" - Width of resulting page, expressed as thousandths of an inch.
Type: Integer.
Default: 8500.
"PageHeight" - Height of resulting page, expressed as thousandths of an inch.
Type: Integer.
Default: 11000.
"TypeFace" - Font metric:typeface name of the font.
Type: String.
Default: "Courier".
"Italic" - Font metric: if true use italic font.
Type: Boolean.
Default: false.
"Bold" - Font metric: if true use bold font.
Type: Boolean.
Default: false.
"PointSize" - Font metric: If 0 then lines per page or character per line is used, else - specifies font size.
Type: Integer.
Default: 10.
"LinesPerPage" - Number of lines per page. Used when PointSize is set to 0.
Type: Integer.
Default: 0.
"CharsPerLine" - Number of characters per line. Used when PointSize and LinesPerPage are set to 0.
Type: Integer.
Default: 0.
NOTE: "CharsPerLine" parameter is supposed to be used for monospace fonts, like "Courier". Using it with non-monospace fonts could produce not precisely right results.
API reference: