LEADTOOLS JPEG2000 COM Object Documentation

The LEADTOOLS JPEG2000 COM Object extends web browsers that support ActiveX controls (Internet Explorer) to include JPEG2000 support. JPEG2000 images have numerous benefits over other natively supported image formats to include higher compression ratios while maintaining superior quality, multiple resolution support to save on bandwidth, and much more.

The LEADTOOLS JPEG2000 COM Object is available as part of the LEADTOOLS JPEG2000 Plug-in to LEADTOOLS Raster Imaging Pro or higher. For details on purchasing this product, contact sales@LEADTOOLS.com

When loading or viewing a JPEG2000 image with the LEADTOOLS JPEG2000 COM Object, you can specify the desired resolution to load or view.  Only the image data (bytes) needed to decompress and display the desired resolution will be downloaded. Downloaded data is cached, so that if you re-load a previously loaded level, the data is not re-downloaded.

The features of the LEADTOOLS JPEG2000 COM Object include:

 

The LEADTOOLS JPEG2000 COM Object contains the following Methods, Properties, and Events:

Properties:

 

Name

Type

Description

Appearance

APPEARANCE_TYPE

The control appearance. Possible values are:

APPEARANCE_FLAT [0] Flat appearance, the default.

APPEARANCE_THREED [1] 3-D appearance.

AutoLoad

VARIANT_BOOL

If set to TRUE, forces a reload when changing relevant properties. Relevant properties are:

Level property,
LoadResolutionWidth property,
LoadResolutionHeight property.

You can set this property to FALSE before changing one or more of the relevant properties, then set it back to TRUE to force an update.

BackColor

OLE_COLOR

The background color.

This color will appear only if the loaded image size is smaller than the control size.

BitmapDataPath

BSTR

Loads the JPEG2000 file at the specified path. This can be an http, ftp, or local path.

BorderStyle

long

The controls border style. Possible values are:

0

No border.

1

Solid.

CacheExpiry

short

The period, in days, after which some cache file expires.

CacheFlags

short

Flags to control the caching process. Possible value are:

J2K_CACHE_DISABLE [0x0000] No caching.

J2K_CACHE_ENABLE [0x0001] Caching is enabled.

J2K_CACHE_NO_REVERT_IF_CONNECT_FAIL [0x0002] Caching is enabled but the cache will not be used if connecting to the source is failed.

CachePath

BSTR

The path on the client machine to use for storing cache files.

DisplayMode

J2KDisplayModeConstants

Gets/Sets the DisplayMode

J2K_DISPLAY_MODE_FIT_IMAGE [0] Fit the image to the Control

J2K_DISPLAY_MODE_SIZE_CONTROL [1] Size the control to image width/height.

J2K_DISPLAY_MODE_NORMAL [2] Show image in normal layer size.

J2K_DISPLAY_MODE_MAX [3] Show the image in largest layer size (image size).

EnableContextMenu

VARIANT_BOOL

TRUE to enable the shortcut menu on right-click. The shortcut menu contains options needed by end users like navigating between levels, linking, and changing the display mode.

EnableKeyboardControl

VARIANT_BOOL

Enables keyboard shortcuts. For more information on keyboard shortcuts, see Keyboard shortcuts.

EnableMethodErrors

VARIANT_BOOL

Enables runtime exceptions.

Level

short

The desired level of the JPEG2000 file to load. You can get information about levels using the Levels property and the LevelInfoIndex property. Updating this property affects the LoadResolutionWidth and LoadResolutionHeight properties.

LevelHeight

int

Gets the vertical dimension for the level set by the LevelInfoindex property for the currently loaded image.

LevelInfoIndex

short

Sets/Gets the level for which to get information using LevelWidth and LevelHeight properties.

Levels

short

Gets the total number of levels (resolutions) in the loaded (or being loaded) image.

LevelWidth

int

Gets the horizontal dimension for the level set by the LevelInfoindex property for the currently loaded image.

LinkFlags

short

Flags to control the hyperlinking ability of the control. Possible values are (can be ORed):

J2K_LINK_FLAGS_NONE [0x00] No flags, the default. The link will be activated with a single click in the same window the control resides in.

J2K_LINK_LAUNCH_ON_DBLCLICK [0x01] The link will be activated with a double click.

J2K_LINK_LAUNCH_IN_NEWWINDOW [0x02] The link will be launched in a new browser window.

LinkURL

BSTR

The URL to link to when the control is clicked or double-clicked, if the UseLinkCursor property is set to TRUE.  The link URL will not appear at the explorer’s status bar when moving the mouse over the control, try to do this using HTML.

LoadResolutionHeight

long

Gets/Sets the desired height of the image to be loaded (or loaded). This will be mapped to the nearest available height, see the Level property. This property will cause a reload if the AutoLoad property is set to TRUE.

LoadResolutionWidth

long

Gets/Sets the desired width of the image to be loaded (or loaded). This will be mapped to the nearest available width, see the Level property. This property will cause a reload if the AutoLoad property is set to TRUE.

MaxCacheFiles

short

The maximum number of cache files allowed to be created in the CachePath.

PaintWhileLoad

VARIANT_BOOL

True to paint the image as it is loaded, gradually.

SourceInitialized

VARIANT_BOOL

Gets the source initialization status. TRUE if a connection is established and the source is initialized.

Tooltip

BSTR

The tooltip text to view when the mouse stops over the control. Set to an empty string to disable the tooltip.

UseLinkCursor

VARIANT_BOOL

True to use the hand cursor and enable the control to hyperlink using the URL set by the LinkURL property. If this property is set to true, the user will not be able to move the loaded image by the mouse. See the LinkURL and LinkFlags properties.

ZoomStep

short

The zoom percentage of the current level size used in ZoomIn and ZoomOut methods. Must be positive.

 


 

 

Methods:

 

Name

Parameters

Description

Abort

None.

Forces the current download to stop.

DeleteAllCacheFiles

None.

Deletes all cached files from the cache folder. See the CachePath property.

GoToLevel

short level: The desired level to load.

Loads a specified level of the loaded image.

ScrollHorizontal

short nScrollH: The desired scroll units. Use negative values to move the image left, and positive values to move the image right.

Scrolls horizontally. Moves the loaded image left (-ve values) or right (+ve values). This method has effect only if the display mode is set to Normal or Max and the loaded width is larger than the control width. The scrolling unit is pixel.

ScrollVertical

short nScrollV: The desired scroll units. Use negative values to move the image down, and positive values to move the image up.

Scrolls vertically. Moves the loaded image down (-ve values) or up (+ve values). This method has effect only if the display mode is set to Normal or Max and the loaded height is larger than the control height. The scrolling unit is pixel.

ZoomIn

None.

Zooms in the viewed image by a percentage specified by the ZoomStep property. This method will affect the Level property as the appropriate level is loaded when its neighborhood is reached. Currently, the largest dimensions allowed in the zooming process are the dimensions of the last level.

ZoomOut

None.

Zooms out the viewed image by a percentage specified by the ZoomStep property. This method will affect the Level property as the appropriate level is loaded when its neighborhood is reached. Currently, the smallest dimensions allowed in the zooming process are the dimensions of the first level.

 


 

 

Events:

 

Name

Parameters

Description

Click

 

Fired when the user clicks the left button of the mouse.

DblClick

 

Fired when the user double clicks the left button of the mouse.

DownloadProgress

long DownloadedBytes: Total number of bytes downloaded.

long TotalBytes: Total number of bytes to download (the source file size). This might be zero if there is a problem reading the source file size.

short CurrentLayer: The layer being downloaded.

long DownloadedBytesForCurrentLayer: Number of byted downloaded for the current layer if known.

long TotalBytesForCurrentLayer: Total number of bytes needed by the current layer if known. Note: TotalBytesForCurrentLayer might be zero to indicate that this amount is unknown for the loaded image. Also this number might be saved incorrectly in the image, the case in which TotalBytesForCurrentLayer will be reported the same as DownloadedBytesForCurrentLayer.

 

DownloadStatus

long lStatus: The download status. Possible values are:

J2K_DOWNLOAD_STARTED [0]

Downloading has just started.

J2K_DOWNLOAD_FAILURE [1]

Download failed. Might be caused by difficulties reading from the source file or writing to disk file.

J2K_DOWNLOAD_COMPLETE [2]

Download is complete.

J2K_DOWNLOAD_ABORTED [3]

Download is aborted by the user calling the Abort method.

J2K_DOWNLOAD_ERROR_INV_DATAPATHNAME [4]

An invalid path (URL) is passed.

J2K_DOWNLOAD_ERROR_SOURCE_ACCESS [5]

The control encountered a problem while accessing (or trying to access) the source file.

J2K_DOWNLOAD_ERROR_CACHE_ACCESS [6]

The control encountered a problem while accessing (or trying to access) the cache.

J2K_DOWNLOAD_ERROR_CONNECT [7]

The control encountered a problem while connecting to the source file.

J2K_DOWNLOAD_ERROR_J2KFILE [8]

Error in the source JPEG2000 file.

J2K_DOWNLOAD_CACHE_REVERT [9]

The control failed to connect to the source file and will revert to a cached copy.

J2K_DOWNLOAD_CACHE_FILE_EXPIRED [10]

The file in cache has expired; a fresh copy will be retrieved.

Fired to report the image download status.

 

Context menu:

Currently, the control provides the shown shortcut menu. It can be displayed by clicking the right mouse button or pressing “Shift+F10”.

 

 

The menu can be disabled or enabled using the EnableContextMenu property.

 

Keyboard shortcuts:

Currently the control provides the following keyboard shortcuts:

 

Shortcut

Description

Ctrl + -> (Control and Right Arrow)

Go to next level

Ctrl + <- (Control and Left Arrow)

Go to previous level

Ctrl + Home (Control and Home)

Go to first level (smallest)

Ctrl + End (Control and End)

Go to last level (largest)

Left arrow

Scroll left

Right arrow

Scroll right

Up arrow

Scroll up

Down arrow

Scroll down

+ (Add)

Zoom in. The control will keep zooming in until the button is release, then the image will be updated (clarified with new level info)

- (Subtract)

Zoom out. The control will keep zooming out until the button is release, then the image will be updated (clarified with new level info)

 

The keyboard shortcuts can be disabled or enabled using the EnableKeyboardControl property.

 

 

 

HTML Image tags substitution:

The following table shows how to replace an existing IMG HTML object with the LEADTOOLS JPEG2000 COM Object:

Replace This:

<IMG SRC="http://www.myserver.com/images/image1.jpg">

With This:

<OBJECT ID="LEADJ2K" NAME="LEADJ2K" CLASSID="CLSID:00140020-B1BA-11CE-ABC6-F5B2E79D9E3F"
CODEBASE=http://www.myserver.com/controls/ltj2k.cab>
<param name="PaintWhileLoad" value=TRUE>
<param name="DisplayMode" value=1>
<param name="Level" value=4>
<param name="BitmapDataPath" value="http://www.myserver.com/images/image1.j2k">
</OBJECT>