java.lang.Object
com.port80.swt.apps.ImageViewer3
- public class ImageViewer3
- extends java.lang.Object
An image viewer using swt.
A GC can be created on an Image and then use it to draw into the Image.
To display very large image, pixel data is loaded into ImageData and then
tiles of the data are used to create Image's for display.
This is an more acceptable version of ImageViewer2. Instead of allocating a new Image
on scroll, the buffered Image is scrolled and damaged area is updated. A new Image is
allocated only when the size of the Canvas client area changed.
Small scrolling is quite smooth for really small scroll but noticably worse when scroll step get larger.
There are flicker in the damaged region as it is cleared before updated.
Large scrolls (512 pixels) left the damaged region as cleared for fraction of a second before being updated.
Expose redraw is instantaneous.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME
private static final java.lang.String NAME
- See Also:
- Constant Field Values
IMAGE_SUFFICES
private static final java.lang.String[] IMAGE_SUFFICES
IMAGE_FILTER_NAMES
private static final java.lang.String[] IMAGE_FILTER_NAMES
fDisplay
private org.eclipse.swt.widgets.Display fDisplay
fShell
private org.eclipse.swt.widgets.Shell fShell
fFont
private org.eclipse.swt.graphics.Font fFont
fWhiteColor
private org.eclipse.swt.graphics.Color fWhiteColor
fBlackColor
private org.eclipse.swt.graphics.Color fBlackColor
fLightColor
private org.eclipse.swt.graphics.Color fLightColor
fCrossCursor
private org.eclipse.swt.graphics.Cursor fCrossCursor
fImage
private org.eclipse.swt.graphics.Image fImage
fImageDatas
private org.eclipse.swt.graphics.ImageData[] fImageDatas
fImageData
private org.eclipse.swt.graphics.ImageData fImageData
fImageDataIndex
private int fImageDataIndex
fScale
private double fScale
fX
private int fX
fY
private int fY
fImageX
private int fImageX
fImageY
private int fImageY
fImageW
private int fImageW
fImageH
private int fImageH
fClientW
private int fClientW
fClientH
private int fClientH
fLastPath
private java.lang.String fLastPath
fTransparent
private boolean fTransparent
fShowMask
private boolean fShowMask
fIncremental
private boolean fIncremental
fLoadTime
private long fLoadTime
fFilename
private java.lang.String fFilename
fScaleCombo
private org.eclipse.swt.widgets.Combo fScaleCombo
fImageCanvas
private org.eclipse.swt.widgets.Canvas fImageCanvas
fSash
private org.eclipse.swt.widgets.Sash fSash
fDataLabel
private org.eclipse.swt.widgets.Label fDataLabel
fStatusLabel
private org.eclipse.swt.widgets.Label fStatusLabel
fDataText
private org.eclipse.swt.custom.StyledText fDataText
fInfoLabel
private org.eclipse.swt.widgets.Label fInfoLabel
ImageViewer3
public ImageViewer3()
main
public static void main(java.lang.String[] args)
open
public org.eclipse.swt.widgets.Shell open(org.eclipse.swt.widgets.Display display)
dispose
void dispose()
getShell
org.eclipse.swt.widgets.Shell getShell()
getDisplay
org.eclipse.swt.widgets.Display getDisplay()
createWidgets
void createWidgets()
createMenuBar
org.eclipse.swt.widgets.Menu createMenuBar()
createFileMenu
void createFileMenu(org.eclipse.swt.widgets.Menu menuBar)
openFile
void openFile()
openURL
void openURL()
displayImage
void displayImage(org.eclipse.swt.graphics.ImageData newImageData)
paintImage
void paintImage(org.eclipse.swt.events.PaintEvent event)
createImage
org.eclipse.swt.graphics.Image createImage(int x,
int y,
int w,
int h)
- Extract an Image from the given area of the original image, fImageData.
showColorAt
void showColorAt(int mx,
int my)
showColorForPixel
void showColorForPixel(int x,
int y)
showColorForData
void showColorForData()
scrollHorizontally
void scrollHorizontally(org.eclipse.swt.widgets.ScrollBar scrollBar)
scrollVertically
void scrollVertically(org.eclipse.swt.widgets.ScrollBar scrollBar)
scaleImage
void scaleImage()
resetScaleCombo
void resetScaleCombo()
resetScrollBars
void resetScrollBars()
resizeScrollBars
void resizeScrollBars()
resizeShell
void resizeShell(org.eclipse.swt.events.ControlEvent event)
reset
void reset()
showErrorDialog
void showErrorDialog(java.lang.String operation,
java.lang.String filename,
java.lang.Exception e)
fileTypeString
static java.lang.String fileTypeString(int filetype)
createMsg
static java.lang.String createMsg(java.lang.String msg,
java.lang.Object arg)
i18n
static java.lang.String i18n(java.lang.String str)