net.rim.device.api.ui.extension.container
Class ZoomScreen

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.ScrollView
          extended by net.rim.device.api.ui.Manager
              extended by net.rim.device.api.ui.Screen
                  extended by net.rim.device.api.ui.container.FullScreen
                      extended by net.rim.device.api.ui.container.MainScreen
                          extended by net.rim.device.api.ui.extension.container.ZoomScreen
All Implemented Interfaces:
AdjustmentListener

public class ZoomScreen
extends MainScreen

A screen for zooming-in, and panning around images. Includes an overlay graphic illustrating the viewed portion of the image. On touch screen devices, this screen supports a two finger touch feature where two-fingers-down define the diagonally opposite corners of the region to zoom.

This class supports image orientation either through the use of embedded JPEG EXIF data, or by explicitly specifying an orientation in the constructor.

ZoomScreen supports the following orientation values:

ZoomScreen.ROTATE_0_DEGREES
To correctly display an image with no rotation.
 FFFFFF
 FF
 FFFF
 FF
 FF
 
ZoomScreen.ROTATE_90_DEGREES
To correctly display an image rotated counter clockwise by 90 degrees.
 FF
 FF  FF
 FFFFFFFFFF
 
ZoomScreen.ROTATE_180_DEGREES
To correctly display an image rotated by 180 degrees.
     FF
     FF
   FFFF
     FF
 FFFFFF
 
ZoomScreen.ROTATE_270_DEGREES
To correctly display an image rotated clockwise by 90 degrees.
 FFFFFFFFFF
     FF  FF
         FF
 

Since:
BlackBerry API 5.0.0

Field Summary
static int ROTATE_0_DEGREES
          EXIF orientation value for correctly displaying images with no rotation.
static int ROTATE_180_DEGREES
          EXIF orientation value for correctly displaying images that are rotated by 180 degrees.
static int ROTATE_270_DEGREES
          EXIF orientation value for correctly displaying images that are rotated clockwise by 90 degrees.
static int ROTATE_90_DEGREES
          EXIF orientation value for correctly displaying images that are rotated counter clockwise by 90 degrees.
 
Fields inherited from class net.rim.device.api.ui.Screen
DEFAULT_CLOSE, DEFAULT_MENU, NO_SYSTEM_MENU_ITEMS
 
Fields inherited from class net.rim.device.api.ui.Manager
BOTTOMMOST, DOWNWARD, HORIZONTAL_SCROLL, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_MASK, HORIZONTAL_SCROLL_MASK, LEAVE_BLANK_SPACE, LEFTMOST, LEFTWARD, NO_HORIZONTAL_SCROLL, NO_HORIZONTAL_SCROLLBAR, NO_SCROLL_RESET, NO_VERTICAL_SCROLL, NO_VERTICAL_SCROLLBAR, QUANTA_FONT, RIGHTMOST, RIGHTWARD, TOPMOST, UPWARD, VERTICAL_SCROLL, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_MASK, VERTICAL_SCROLL_MASK
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, AXIS_HORIZONTAL, AXIS_SEQUENTIAL, AXIS_VERTICAL, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Constructor Summary
ZoomScreen(EncodedImage encodedImage)
          Constructs a new ZoomScreen.
ZoomScreen(EncodedImage encodedImage, int orientation)
          Constructs a new ZoomScreen using the specified orientation to display the image.
 
Method Summary
 int getX()
          Returns the top left corner of the viewable portion of the image relative to the current zoom level Note: this value may be negative if the image is smaller than the size of this manager
 int getY()
          Returns the top left corner of the viewable portion of the image relative to the current zoom level Note: this value may be negative if the image is smaller than the size of this manager
 float getZoomLevel()
          Function to get the current zoom level
 void setViewableArea(float zoomFactor, float relativeFocalPointX, float relativeFocalPointY)
          Sets the viewed portion of the image by the zoom-factor and the relative coordinates of the center-point.
 void zoomedOutNearToFit()
          This function is called when the image is zoomed out to approximately the size of fitting the screen.
 
Methods inherited from class net.rim.device.api.ui.container.MainScreen
addMenuItem, getAccessibleContext, getField, getFieldCount, getFieldWithFocus, getFieldWithFocusIndex, getMainManager, getToolbar, keyCharUnhandled, makeMenu, onSavePrompt, removeAllMenuItems, removeMenuItem, setBanner, setId, setStatus, setTitle, setTitle, setTitle, setToolbar
 
Methods inherited from class net.rim.device.api.ui.container.FullScreen
sublayout
 
Methods inherited from class net.rim.device.api.ui.Screen
add, addInputSettings, addKeyListener, addScreenUiEngineAttachedListener, addTrackwheelListener, clearInputSettings, close, cursorClick, cursorUnclick, delete, deleteRange, doPaint, ensureRegionVisible, getApplication, getContextMenuProvider, getDefaultMenuItem, getDelegate, getFieldAtLocation, getFocusRect, getGraphics, getInputHelper, getInputSettings, getLeafFieldWithFocus, getMenu, getScreenAbove, getScreenBelow, getServiceMode, getTitleBar, getUiEngine, getVirtualKeyboard, insert, invalidate, invalidate, invalidateAll, invalidateLayout, invokeAction, isDataValid, isDirty, isDisplayed, isFocus, isFocusable, isGlobal, isGlobalStatus, isMuddy, isSelecting, keyChar, keyControl, keyDown, keyRepeat, keyStatus, keyUp, layoutDelegate, navigationClick, navigationMovement, navigationUnclick, onClose, onDisplay, onExposed, onFocus, onFocusNotify, onMenu, onMenuDismissed, onMenuDismissed, onObscured, onSave, onUiEngineAttached, onUndisplay, onUnfocus, openDevelopmentBackdoor, openProductionBackdoor, paint, paintBackground, removeFocus, removeInputSettings, removeKeyListener, removeScreenUiEngineAttachedListener, removeTrackwheelListener, replace, save, scroll, setBackdoorAltStatus, setContextMenuProvider, setCursorInputMode, setDefaultClose, setDirty, setFocus, setFocus, setHorizontalQuantization, setInputHelper, setPositionDelegate, setServiceMode, setServiceModeImpl, setTitleBar, setTrackballFilter, setTrackballSensitivityXOffset, setTrackballSensitivityYOffset, setVerticalQuantization, suggestServiceMode, touchEvent, trackwheelClick, trackwheelClickUnhandled, trackwheelRoll, trackwheelUnclick, updateDisplay
 
Methods inherited from class net.rim.device.api.ui.Manager
addAll, cursorMovement, deleteAll, getHorizontalScroll, getPreferredHeightOfChild, getPreferredWidthOfChild, getVerticalScroll, getVirtualHeight, getVirtualWidth, insertAll, invalidateFieldRange, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, nextFocus, paintChild, setFocus, setPositionChild, setScrollingInertial, setVirtualExtent, shouldCursorScroll, subpaint
 
Methods inherited from class net.rim.device.api.ui.ScrollView
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, setCurrentLocation, setExtent, setHorizontalAdjustment, setHorizontalScroll, setHorizontalScroll, setScrollListener, setVerticalAdjustment, setVerticalScroll, setVerticalScroll, valueChanged, waitForScrolling
 
Methods inherited from class net.rim.device.api.ui.Field
drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getCommandItemProvider, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredHeight, getPreferredWidth, getScreen, getStyle, getTextFillColor, getTextStrokeColor, getTop, getVisualState, getWidth, isEditable, isEnabled, isLeftToRight, isPasteable, isScrollCopyable, isSelectable, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, makeContextMenu, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCommandItemProvider, setCookie, setEditable, setEnabled, setFocusListener, setFont, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

ROTATE_0_DEGREES

public static final int ROTATE_0_DEGREES
EXIF orientation value for correctly displaying images with no rotation.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_180_DEGREES

public static final int ROTATE_180_DEGREES
EXIF orientation value for correctly displaying images that are rotated by 180 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_90_DEGREES

public static final int ROTATE_90_DEGREES
EXIF orientation value for correctly displaying images that are rotated counter clockwise by 90 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_270_DEGREES

public static final int ROTATE_270_DEGREES
EXIF orientation value for correctly displaying images that are rotated clockwise by 90 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0


Constructor Detail

ZoomScreen

public ZoomScreen(EncodedImage encodedImage)
Constructs a new ZoomScreen. If encodedImage is a JPEG any embedded EXIF orientation data is applied but can be overridden using the alternative constructor ZoomScreen.ZoomScreen(EncodedImage, int).

Parameters:
encodedImage - the image to display.
Since:
BlackBerry API 5.0.0

ZoomScreen

public ZoomScreen(EncodedImage encodedImage,
                  int orientation)
Constructs a new ZoomScreen using the specified orientation to display the image. For example, if the image needs to be rotated 90 degrees clockwise before being displayed, use ROTATE_90_DEGREES If no rotation is necessary, use ROTATE_0_DEGREES or the alternative constructor ZoomScreen.ZoomScreen(EncodedImage).

Parameters:
encodedImage - the image to display.
orientation - a rotation constant to specify how the image should be rotated before being displayed. One of ROTATE_* values. Any other values will be ignored and will act as if ROTATE_0_DEGREES had been passed.
Since:
BlackBerry API 5.0.0


Method Detail

setViewableArea

public void setViewableArea(float zoomFactor,
                            float relativeFocalPointX,
                            float relativeFocalPointY)
Sets the viewed portion of the image by the zoom-factor and the relative coordinates of the center-point.

Parameters:
zoomFactor - a positive number where 1 is the absolute size, 2 doubles the size etc. Alternatively set this to -1 to use the default initial zoom level.
relativeFocalPointX - a value between 0 and 1 where 0 is the left-most point and 1 is the right-most.
relativeFocalPointY - a value between 0 and 1 where 0 is the top-most point and 1 is the bottom-most.
Since:
BlackBerry API 7.0.0

zoomedOutNearToFit

public void zoomedOutNearToFit()
This function is called when the image is zoomed out to approximately the size of fitting the screen.

Since:
BlackBerry API 6.0.0

getX

public int getX()
Returns the top left corner of the viewable portion of the image relative to the current zoom level Note: this value may be negative if the image is smaller than the size of this manager

Returns:
x coordinate
Since:
BlackBerry API 7.0.0

getY

public int getY()
Returns the top left corner of the viewable portion of the image relative to the current zoom level Note: this value may be negative if the image is smaller than the size of this manager

Returns:
y coordinate
Since:
BlackBerry API 7.0.0

getZoomLevel

public float getZoomLevel()
Function to get the current zoom level

Returns:
The current zoom level as a float
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal