graphics.pushRegion(rectangle);
graphics.fillRect(10, 10, 30, 30);
graphics.drawRect(15, 15, 30, 30);
graphics.popContext();
5.
Invert a specified
XYRect
object.
6.
Specify the portion of the
Graphics
object to push onto the stack.
7.
After you invoke
pushContext()
(or
pushRegion()
), provide the portion of the
Graphics
object to invert.
graphics.pushContext(rectangle);
graphics.invert(rectangle);
graphics.popContext();
8.
Invoke
translate()
. The
XYRect
is translated from its origin of (1, 1) to an origin of (20, 20). After translation, the
bottom portion of the
XYRect
object extends past the bounds of the graphics context and clips it.
XYRect rectangle = new XYRect(1, 1, 100, 100);
XYPoint newLocation = new XYPoint(20, 20);
rectangle.translate(newLocation);
Touch screen orientation and direction
You can specify the orientation and direction of the
Screen
in a BlackBerry® device application.
Orientation refers to the
Screen
aspect ratio, relative to the ground, where the left, right, top, bottom, front, or back of the
device are furthest from the ground.
Direction refers to the top of the drawing area of the screen, relative to the location of the BlackBerry logo. If you change the
direction that a
Screen
supports, the change takes effect the next time the
Screen
orientation of the device changes.
A
Screen
for a BlackBerry device application can have the following directions and orientations:
Direction
•
DIRECTION_NORTH - the top of the drawable area is the screen side closest to the BlackBerry logo
•
DIRECTION_WEST - the top of the drawable area is to the left of the logo
•
DIRECTION_EAST - the top of the drawable area is to the right of the logo
•
DIRECTION_SOUTH - the top of the drawable area is the screen side farthest from the BlackBerry logo
Orientation
•
DIRECTION_LANDSCAPE - the top of the drawable area is the screen side farthest from the BlackBerry logo
•
DIRECTION_PORTRAIT - the screen is display in protrait view
Retrieve the orientation of the touch screen
1.
Import the
net.rim.device.api.system.Display
class.
Development Guide
Touch screen orientation and direction
10