beautypg.com

Screen pixel ratio, Screen background color – Sun Microsystems Computer Accessories User Manual

Page 41

background image

Chapter 3

Examining Device Property Files

27

Referring to the right image in

FIGURE 5

, the full screen display area is defined as

the upper left coordinate of the display area, (

screenPaintableRegion.

x,

screenPaintableRegion

.y), and the bottom right coordinate of the screen area

(

screen.

x+

screen.

width,

screen.

y+

screen.

height).

Customization of the display area will be available in future versions of the
Wireless Toolkit.

Screen Pixel Ratio

The following commands enable you to compensate for the difference in aspect
ratio between the actual device screen and the device image on the PC screen.

The pixel size ratio property defines the number of pixels in the device’s PC image
that correspond to a single pixel on the real device in both the horizontal and
vertical direction.

Note –

MIDP requires that pixels be square. Therefore, you should only use pixel

ratios that preserve the square, for example, x:y = 2:2 or 3:3 (that is, magnifying
the image), and you should not use pixel ratios that distort the square, for example,
x:y = 1:2 or 2:1.

The ratios are defined as follows:

screenPixelRatio.x = horizontal_image_pixels/

horizontal_device_pixels

screenPixelRatio.y = vertical_image_pixels/vertical_device_pixels

For most devices, use the following values:

screenPixelRatio.x = 1

screenPixelRatio.y = 1

The values of

screenPixelRatio.x

and

screenPixelRatio.y

must be whole

numbers.

Screen Background Color

For a device with a grayscale screen, the background color of the screen can be set.
The color is defined as a hexadecimal integer according to the standard Java color
map. That is, the integer has the form RRGGBB, where RR, GG, and BB are the red,
green and blue components of the color, respectively. For example, white would be
0xffffff and red would be 0xff0000.

The background color is defined with the property

screenBGColor

.

For example:

screenBGColor = 0x64b890