Java Doc for Graphics.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.Graphics

Graphics
public class Graphics (Code)
Provides simple 2D geometric rendering capability.

Drawing primitives are provided for text, images, lines, rectangles, and arcs. Rectangles and arcs may also be filled with a solid color. Rectangles may also be specified with rounded corners.

A 24-bit color model is provided, with 8 bits for each of red, green, and blue components of a color. Not all devices support a full 24 bits' worth of color and thus they will map colors requested by the application into colors available on the device. Facilities are provided in the Display Display class for obtaining device characteristics, such as whether color is available and how many distinct gray levels are available. Applications may also use Graphics.getDisplayColor(int)getDisplayColor() to obtain the actual color that would be displayed for a requested color. This enables applications to adapt their behavior to a device without compromising device independence.

For all rendering operations, source pixels are always combined with destination pixels using the Source Over Destination rule [Porter-Duff]. Other schemes for combining source pixels with destination pixels, such as raster-ops, are not provided.

For the text, line, rectangle, and arc drawing and filling primitives, the source pixel is a pixel representing the current color of the graphics object being used for rendering. This pixel is always considered to be fully opaque. With source pixel that is always fully opaque, the Source Over Destination rule has the effect of pixel replacement, where destination pixels are simply replaced with the source pixel from the graphics object.

The Graphics.drawImage drawImage() and Graphics.drawRegion drawRegion() methods use an image as the source for rendering operations instead of the current color of the graphics object. In this context, the Source Over Destination rule has the following properties: a fully opaque pixel in the source must replace the destination pixel, a fully transparent pixel in the source must leave the destination pixel unchanged, and a semitransparent pixel in the source must be alpha blended with the destination pixel. Alpha blending of semitransparent pixels is required. If an implementation does not support alpha blending, it must remove all semitransparency from image source data at the time the image is created. See Alpha Processing for further discussion.

The destinations of all graphics rendering are considered to consist entirely of fully opaque pixels. A property of the Source Over Destination rule is that compositing any pixel with a fully opaque destination pixel always results in a fully opaque destination pixel. This has the effect of confining full and partial transparency to immutable images, which may only be used as the source for rendering operations.

Graphics may be rendered directly to the display or to an off-screen image buffer. The destination of rendered graphics depends on the provenance of the graphics object. A graphics object for rendering to the display is passed to the Canvas object's Canvas.paint(Graphics) paint() method. This is the only means by which a graphics object may be obtained whose destination is the display. Furthermore, applications may draw using this graphics object only for the duration of the paint() method.

A graphics object for rendering to an off-screen image buffer may be obtained by calling the Image.getGraphics getGraphics() method on the desired image. A graphics object so obtained may be held indefinitely by the application, and requests may be issued on this graphics object at any time.

The default coordinate system's origin is at the upper left-hand corner of the destination. The X-axis direction is positive towards the right, and the Y-axis direction is positive downwards. Applications may assume that horizontal and vertical distances in the coordinate system represent equal distances on the actual device display, that is, pixels are square. A facility is provided for translating the origin of the coordinate system. All coordinates are specified as integers.

The coordinate system represents locations between pixels, not the pixels themselves. Therefore, the first pixel in the upper left corner of the display lies in the square bounded by coordinates (0,0) , (1,0) , (0,1) , (1,1).

Under this definition, the semantics for fill operations are clear. Since coordinate grid lines lie between pixels, fill operations affect pixels that lie entirely within the region bounded by the coordinates of the operation. For example, the operation


 g.fillRect(0, 0, 3, 2)    

paints exactly six pixels. (In this example, and in all subsequent examples, the variable g is assumed to contain a reference to a Graphics object.)

Each character of a font contains a set of pixels that forms the shape of the character. When a character is painted, the pixels forming the character's shape are filled with the Graphics object's current color, and the pixels not part of the character's shape are left untouched. The text drawing calls Graphics.drawChar drawChar() , Graphics.drawChars drawChars() , Graphics.drawString drawString() , and Graphics.drawSubstring drawSubstring() all draw text in this manner.

Lines, arcs, rectangles, and rounded rectangles may be drawn with either a SOLID or a DOTTED stroke style, as set by the Graphics.setStrokeStylesetStrokeStyle() method. The stroke style does not affect fill, text, and image operations.

For the SOLID stroke style, drawing operations are performed with a one-pixel wide pen that fills the pixel immediately below and to the right of the specified coordinate. Drawn lines touch pixels at both endpoints. Thus, the operation


 g.drawLine(0, 0, 0, 0);    

paints exactly one pixel, the first pixel in the upper left corner of the display.

Drawing operations under the DOTTED stroke style will touch a subset of pixels that would have been touched under the SOLID stroke style. The frequency and length of dots is implementation-dependent. The endpoints of lines and arcs are not guaranteed to be drawn, nor are the corner points of rectangles guaranteed to be drawn. Dots are drawn by painting with the current color; spaces between dots are left untouched.

An artifact of the coordinate system is that the area affected by a fill operation differs slightly from the area affected by a draw operation given the same coordinates. For example, consider the operations


 g.fillRect(x, y, w, h); // 1
 g.drawRect(x, y, w, h); // 2    

Statement (1) fills a rectangle w pixels wide and h pixels high. Statement (2) draws a rectangle whose left and top edges are within the area filled by statement (1). However, the bottom and right edges lie one pixel outside the filled area. This is counterintuitive, but it preserves the invariant that


 g.drawLine(x, y, x+w, y);
 g.drawLine(x+w, y, x+w, y+h);
 g.drawLine(x+w, y+h, x, y+h);
 g.drawLine(x, y+h, x, y);     

has an effect identical to statement (2) above.

The exact pixels painted by drawLine() and drawArc() are not specified. Pixels touched by a fill operation must either exactly overlap or directly abut pixels touched by the corresponding draw operation. A fill operation must never leave a gap between the filled area and the pixels touched by the corresponding draw operation, nor may the fill operation touch pixels outside the area bounded by the corresponding draw operation.

Clipping

The clip is the set of pixels in the destination of the Graphics object that may be modified by graphics rendering operations.

There is a single clip per Graphics object. The only pixels modified by graphics operations are those that lie within the clip. Pixels outside the clip are not modified by any graphics operations.

Operations are provided for intersecting the current clip with a given rectangle and for setting the current clip outright. The application may specify the clip by supplying a clip rectangle using coordinates relative to the current coordinate system.

It is legal to specify a clip rectangle whose width or height is zero or negative. In this case the clip is considered to be empty, that is, no pixels are contained within it. Therefore, if any graphics operations are issued under such a clip, no pixels will be modified.

It is legal to specify a clip rectangle that extends beyond or resides entirely beyond the bounds of the destination. No pixels exist outside the bounds of the destination, and the area of the clip rectangle that is outside the destination is ignored. Only the pixels that lie both within the destination and within the specified clip rectangle are considered to be part of the clip.

Operations on the coordinate system, such as Graphics.translate(intint) translate() , do not modify the clip. The methods Graphics.getClipX getClipX() , Graphics.getClipY getClipY() , Graphics.getClipWidth getClipWidth() and Graphics.getClipHeight getClipHeight() must return a rectangle that, if passed to setClip without an intervening change to the Graphics object's coordinate system, must result in the identical set of pixels in the clip. The rectangle returned from the getClip family of methods may differ from the clip rectangle that was requested in Graphics.setClip(intintintint) setClip() . This can occur if the coordinate system has been changed or if the implementation has chosen to intersect the clip rectangle with the bounds of the destination of the Graphics object.

If a graphics operation is affected by the clip, the pixels touched by that operation must be the same ones that would be touched as if the clip did not affect the operation. For example, consider a clip represented by the rectangle (cx, cy, cw, ch) and a point (x1, y1) that lies outside this rectangle and a point (x2, y2) that lies within this rectangle. In the following code fragment,


 g.setClip(0, 0, canvas.getWidth(),
 canvas.getHeight());
 g.drawLine(x1, y1, x2, y2); // 3
 g.setClip(cx, cy, cw, ch);
 g.drawLine(x1, y1, x2, y2); // 4     

The pixels touched by statement (4) must be identical to the pixels within (cx, cy, cw, ch) touched by statement (3).

Anchor Points

The drawing of text is based on "anchor points". Anchor points are used to minimize the amount of computation required when placing text. For example, in order to center a piece of text, an application needs to call stringWidth() or charWidth() to get the width and then perform a combination of subtraction and division to compute the proper location. The method to draw text is defined as follows:


 public void drawString(String text, int x, int y, int anchor);
 
This method draws text in the current color, using the current font with its anchor point at (x,y). The definition of the anchor point must be one of the horizontal constants (LEFT, HCENTER, RIGHT) combined with one of the vertical constants (TOP, BASELINE, BOTTOM) using the bit-wise OR operator. Zero may also be used as the value of an anchor point. Using zero for the anchor point value gives results identical to using TOP | LEFT.

Vertical centering of the text is not specified since it is not considered useful, it is hard to specify, and it is burdensome to implement. Thus, the VCENTER value is not allowed in the anchor point parameter of text drawing calls.

The actual position of the bounding box of the text relative to the (x, y) location is determined by the anchor point. These anchor points occur at named locations along the outer edge of the bounding box. Thus, if f is g's current font (as returned by g.getFont(), the following calls will all have identical results:


 g.drawString(str, x, y, TOP|LEFT);
 g.drawString(str, x + f.stringWidth(str)/2, y, TOP|HCENTER);
 g.drawString(str, x + f.stringWidth(str), y, TOP|RIGHT);
 g.drawString(str, x,
 y + f.getBaselinePosition(), BASELINE|LEFT);
 g.drawString(str, x + f.stringWidth(str)/2,
 y + f.getBaselinePosition(), BASELINE|HCENTER);
 g.drawString(str, x + f.stringWidth(str),
 y + f.getBaselinePosition(), BASELINE|RIGHT);
 drawString(str, x,
 y + f.getHeight(), BOTTOM|LEFT);
 drawString(str, x + f.stringWidth(str)/2,
 y + f.getHeight(), BOTTOM|HCENTER);
 drawString(str, x + f.stringWidth(str),
 y + f.getHeight(), BOTTOM|RIGHT);      

For text drawing, the inter-character and inter-line spacing (leading) specified by the font designer are included as part of the values returned in the Font.stringWidth(java.lang.String) stringWidth() and Font.getHeight getHeight() calls of class Font Font . For example, given the following code:


 // (5)
 g.drawString(string1+string2, x, y, TOP|LEFT);
 // (6)
 g.drawString(string1, x, y, TOP|LEFT);
 g.drawString(string2, x + f.stringWidth(string1), y, TOP|LEFT);
 

Code fragments (5) and (6) behave similarly if not identically. This occurs because f.stringWidth() includes the inter-character spacing. The exact spacing of may differ between these calls if the system supports font kerning.

Similarly, reasonable vertical spacing may be achieved simply by adding the font height to the Y-position of subsequent lines. For example:


 g.drawString(string1, x, y, TOP|LEFT);
 g.drawString(string2, x, y + f.fontHeight(), TOP|LEFT);    

draws string1 and string2 on separate lines with an appropriate amount of inter-line spacing.

The stringWidth() of the string and the fontHeight() of the font in which it is drawn define the size of the bounding box of a piece of text. As described above, this box includes inter-line and inter-character spacing. The implementation is required to put this space below and to right of the pixels actually belonging to the characters drawn. Applications that wish to position graphics closely with respect to text (for example, to paint a rectangle around a string of text) may assume that there is space below and to the right of a string and that there is no space above and to the left of the string.

Anchor points are also used for positioning of images. Similar to text drawing, the anchor point for an image specifies the point on the bounding rectangle of the destination that is to positioned at the (x,y) location given in the graphics request. Unlike text, vertical centering of images is well-defined, and thus the VCENTER value may be used within the anchor point parameter of image drawing requests. Because images have no notion of a baseline, the BASELINE value may not be used within the anchor point parameter of image drawing requests.

Reference

Porter-Duff
Porter, T., and T. Duff. "Compositing Digital Images." Computer Graphics V18 N3 (SIGGRAPH 1984), p. 253-259.

since:
   MIDP 1.0


Field Summary
final public static  intBASELINE
     Constant for positioning the anchor point at the baseline of text.
final public static  intBOTTOM
     Constant for positioning the anchor point of text and images below the text or image.
final public static  intDOTTED
     Constant for the DOTTED stroke style.
final public static  intHCENTER
    
final public static  intLEFT
     Constant for positioning the anchor point of text and images to the left of the text or image.
final public static  intRIGHT
     Constant for positioning the anchor point of text and images to the right of the text or image.
final public static  intSOLID
     Constant for the SOLID stroke style.
final public static  intTOP
     Constant for positioning the anchor point of text and images above the text or image.
final public static  intVCENTER
     Constant for centering images vertically around the anchor point.

Constructor Summary
 Graphics()
    

Method Summary
public synchronized  voidclipRect(int x, int y, int width, int height)
     Intersects the current clip with the specified rectangle.
public synchronized  voidcopyArea(int x_src, int y_src, int width, int height, int x_dest, int y_dest, int anchor)
     Copies the contents of a rectangular area (x_src, y_src, width, height) to a destination area, whose anchor point identified by anchor is located at (x_dest, y_dest).
native public  voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
     Draws the outline of a circular or elliptical arc covering the specified rectangle, using the current color and stroke style.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall. If either width or height is less than zero, nothing is drawn.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle.

native public  voiddrawChar(char character, int x, int y, int anchor)
     Draws the specified character using the current font and color.
native public  voiddrawChars(char[] data, int offset, int length, int x, int y, int anchor)
     Draws the specified characters using the current font and color.
public  voiddrawImage(Image img, int x, int y, int anchor)
     Draws the specified image by using the anchor point. The image can be drawn in different positions relative to the anchor point by passing the appropriate position constants. See anchor points.

If the source image contains transparent pixels, the corresponding pixels in the destination image must be left untouched.

native public  voiddrawLine(int x1, int y1, int x2, int y2)
     Draws a line between the coordinates (x1,y1) and (x2,y2) using the current color and stroke style.
native public  voiddrawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha)
     Renders a series of device-independent RGB+transparency values in a specified region.
native public  voiddrawRect(int x, int y, int width, int height)
     Draws the outline of the specified rectangle using the current color and stroke style.
public  voiddrawRegion(Image src, int x_src, int y_src, int width, int height, int transform, int x_dest, int y_dest, int anchor)
     Copies a region of the specified source image to a location within the destination, possibly transforming (rotating and reflecting) the image data using the chosen transform function.

The destination, if it is an image, must not be the same image as the source image.

native public  voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
     Draws the outline of the specified rounded corner rectangle using the current color and stroke style.
native public  voiddrawString(java.lang.String str, int x, int y, int anchor)
     Draws the specified String using the current font and color.
native public  voiddrawSubstring(String str, int offset, int len, int x, int y, int anchor)
     Draws the specified String using the current font and color.
native public  voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
     Fills a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

If either width or height is zero or less, nothing is drawn.

The filled region consists of the "pie wedge" region bounded by the arc segment as if drawn by drawArc(), the radius extending from the center to this arc at startAngle degrees, and radius extending from the center to this arc at startAngle + arcAngle degrees.

native public  voidfillRect(int x, int y, int width, int height)
     Fills the specified rectangle with the current color.
native public  voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
     Fills the specified rounded corner rectangle with the current color.
native public  voidfillTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
     Fills the specified triangle will the current color.
public synchronized  intgetBlueComponent()
     Gets the blue component of the current color.
 voidgetClip(int[] region)
     Internal routine to get the clip in a single call.
public synchronized  intgetClipHeight()
     Gets the height of the current clipping area.
public synchronized  intgetClipWidth()
     Gets the width of the current clipping area.
public synchronized  intgetClipX()
     Gets the X offset of the current clipping area, relative to the coordinate system origin of this graphics context.
public synchronized  intgetClipY()
     Gets the Y offset of the current clipping area, relative to the coordinate system origin of this graphics context.
public synchronized  intgetColor()
     Gets the current color.
synchronized  ObjectgetCreator()
    
native public  intgetDisplayColor(int color)
     Gets the color that will be displayed if the specified color is requested.
public synchronized  FontgetFont()
     Gets the current font.
public synchronized  intgetGrayScale()
     Gets the current grayscale value of the color being used for rendering operations.
public synchronized  intgetGreenComponent()
     Gets the green component of the current color.
static  GraphicsgetImageGraphics(Image img)
    
static  GraphicsgetImageGraphics(Image img, int width, int height)
     Retrieve the Graphics context for the given Image and explicitly set the dimensions of the created context. It is possible the Image is bigger than area the Graphics context should provide access to, e.g.
 shortgetMaxHeight()
    
 shortgetMaxWidth()
    
public synchronized  intgetRedComponent()
     Gets the red component of the current color.
static  GraphicsgetScreenGraphics(int displayId, int width, int height)
     Retrieve the Graphics context that renders to the device's display
Parameters:
  displayId - The graphics object will be associatedwith Display with that displayId
Parameters:
  width - The width of the Graphics context
Parameters:
  height - The height of the Graphics context.
public synchronized  intgetStrokeStyle()
     Gets the stroke style used for drawing operations.
public synchronized  intgetTranslateX()
     Gets the X coordinate of the translated origin of this graphics context.
public synchronized  intgetTranslateY()
     Gets the Y coordinate of the translated origin of this graphics context.
 booleanisScreenGraphics()
     Determines if this a Graphics object used to represent the device.
 voidpreserveMIDPRuntimeGC(int systemX, int systemY, int systemW, int systemH)
     Preserve MIDP runtime GC.
 voidreset(int x1, int y1, int x2, int y2)
    
 voidreset()
    
 voidresetGC()
     Reset the Graphic context with all items related to machine independent context.
 voidrestoreMIDPRuntimeGC()
     Restore the runtime GC.
public synchronized  voidsetClip(int x, int y, int width, int height)
     Sets the current clip to the rectangle specified by the given coordinates.
public synchronized  voidsetColor(int red, int green, int blue)
     Sets the current color to the specified RGB values.
public synchronized  voidsetColor(int RGB)
     Sets the current color to the specified RGB values.
synchronized  voidsetCreator(Object creator)
    
 voidsetDimensions(int w, int h)
     Sets the width and height member variables of this Graphics object to reflect the correct values e.g.
public synchronized  voidsetFont(Font font)
     Sets the font for all subsequent text rendering operations.
public synchronized  voidsetGrayScale(int value)
     Sets the current grayscale to be used for all subsequent rendering operations.
public synchronized  voidsetStrokeStyle(int style)
     Sets the stroke style used for drawing lines, arcs, rectangles, and rounded rectangles.
public synchronized  voidtranslate(int x, int y)
     Translates the origin of the graphics context to the point (x, y) in the current coordinate system.

Field Detail
BASELINE
final public static int BASELINE(Code)
Constant for positioning the anchor point at the baseline of text.

Value 64 is assigned to BASELINE.




BOTTOM
final public static int BOTTOM(Code)
Constant for positioning the anchor point of text and images below the text or image.

Value 32 is assigned to BOTTOM.




DOTTED
final public static int DOTTED(Code)
Constant for the DOTTED stroke style.

Value 1 is assigned to DOTTED.




HCENTER
final public static int HCENTER(Code)
Constant for centering text and images horizontally around the anchor point

Value 1 is assigned to HCENTER.




LEFT
final public static int LEFT(Code)
Constant for positioning the anchor point of text and images to the left of the text or image.

Value 4 is assigned to LEFT.




RIGHT
final public static int RIGHT(Code)
Constant for positioning the anchor point of text and images to the right of the text or image.

Value 8 is assigned to RIGHT.




SOLID
final public static int SOLID(Code)
Constant for the SOLID stroke style.

Value 0 is assigned to SOLID.




TOP
final public static int TOP(Code)
Constant for positioning the anchor point of text and images above the text or image.

Value 16 is assigned to TOP.




VCENTER
final public static int VCENTER(Code)
Constant for centering images vertically around the anchor point.

Value 2 is assigned to VCENTER.





Constructor Detail
Graphics
Graphics()(Code)
Create a Graphics object




Method Detail
clipRect
public synchronized void clipRect(int x, int y, int width, int height)(Code)
Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. This method can only be used to make the current clip smaller. To set the current clip larger, use the setClip method. Rendering operations have no effect outside of the clipping area.
Parameters:
  x - the x coordinate of the rectangle to intersect the clip with
Parameters:
  y - the y coordinate of the rectangle to intersect the clip with
Parameters:
  width - the width of the rectangle to intersect the clip with
Parameters:
  height - the height of the rectangle to intersect the clip with
See Also:   Graphics.setClip(int,int,int,int)



copyArea
public synchronized void copyArea(int x_src, int y_src, int width, int height, int x_dest, int y_dest, int anchor)(Code)
Copies the contents of a rectangular area (x_src, y_src, width, height) to a destination area, whose anchor point identified by anchor is located at (x_dest, y_dest). The effect must be that the destination area contains an exact copy of the contents of the source area immediately prior to the invocation of this method. This result must occur even if the source and destination areas overlap.

The points (x_src, y_src) and (x_dest, y_dest) are both specified relative to the coordinate system of the Graphics object. It is illegal for the source region to extend beyond the bounds of the graphic object. This requires that:


 x_src + tx >= 0
 y_src + ty >= 0
 x_src + tx + width <= width of Graphics object's destination
 y_src + ty + height <= height of Graphics object's destination
 

where tx and ty represent the X and Y coordinates of the translated origin of this graphics object, as returned by getTranslateX() and getTranslateY(), respectively.

However, it is legal for the destination area to extend beyond the bounds of the Graphics object. Pixels outside of the bounds of the Graphics object will not be drawn.

The copyArea method is allowed on all Graphics objects except those whose destination is the actual display device. This restriction is necessary because allowing a copyArea method on the display would adversely impact certain techniques for implementing double-buffering.

Like other graphics operations, the copyArea method uses the Source Over Destination rule for combining pixels. However, since it is defined only for mutable images, which can contain only fully opaque pixels, this is effectively the same as pixel replacement.


Parameters:
  x_src - the x coordinate of upper left corner of source area
Parameters:
  y_src - the y coordinate of upper left corner of source area
Parameters:
  width - the width of the source area
Parameters:
  height - the height of the source area
Parameters:
  x_dest - the x coordinate of the destination anchor point
Parameters:
  y_dest - the y coordinate of the destination anchor point
Parameters:
  anchor - the anchor point for positioning the region withinthe destination image
throws:
  IllegalStateException - if the destination of thisGraphics object is the display device
throws:
  IllegalArgumentException - if the region to be copied exceedsthe bounds of the source image



drawArc
native public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)
Draws the outline of a circular or elliptical arc covering the specified rectangle, using the current color and stroke style.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall. If either width or height is less than zero, nothing is drawn.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.


Parameters:
  x - the x coordinate of the upper-left cornerof the arc to be drawn
Parameters:
  y - the y coordinate of the upper-left cornerof the arc to be drawn
Parameters:
  width - the width of the arc to be drawn
Parameters:
  height - the height of the arc to be drawn
Parameters:
  startAngle - the beginning angle
Parameters:
  arcAngle - the angular extent of the arc, relative tothe start angle
See Also:   Graphics.fillArc(int,int,int,int,int,int)



drawChar
native public void drawChar(char character, int x, int y, int anchor)(Code)
Draws the specified character using the current font and color.
Parameters:
  character - the character to be drawn
Parameters:
  x - the x coordinate of the anchor point
Parameters:
  y - the y coordinate of the anchor point
Parameters:
  anchor - the anchor point for positioning the text; seeanchor points
throws:
  IllegalArgumentException - if anchoris not a legal value
See Also:   Graphics.drawString(java.lang.String,int,int,int)
See Also:   Graphics.drawChars(char[],int,int,int,int,int)



drawChars
native public void drawChars(char[] data, int offset, int length, int x, int y, int anchor)(Code)
Draws the specified characters using the current font and color.

The offset and length parameters must specify a valid range of characters within the character array data. The offset parameter must be within the range [0..(data.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= data.length.


Parameters:
  data - the array of characters to be drawn
Parameters:
  offset - the start offset in the data
Parameters:
  length - the number of characters to be drawn
Parameters:
  x - the x coordinate of the anchor point
Parameters:
  y - the y coordinate of the anchor point
Parameters:
  anchor - the anchor point for positioning the text; seeanchor points
throws:
  ArrayIndexOutOfBoundsException - if offsetand lengthdo not specify a valid range within the data array
throws:
  IllegalArgumentException - if anchor is not a legal value
throws:
  NullPointerException - if data is null
See Also:   Graphics.drawString(java.lang.String,int,int,int)



drawImage
public void drawImage(Image img, int x, int y, int anchor)(Code)
Draws the specified image by using the anchor point. The image can be drawn in different positions relative to the anchor point by passing the appropriate position constants. See anchor points.

If the source image contains transparent pixels, the corresponding pixels in the destination image must be left untouched. If the source image contains partially transparent pixels, a compositing operation must be performed with the destination pixels, leaving all pixels of the destination image fully opaque.

If img is the same as the destination of this Graphics object, the result is undefined. For copying areas within an Image, Graphics.copyArea copyArea should be used instead.


Parameters:
  img - the specified image to be drawn
Parameters:
  x - the x coordinate of the anchor point
Parameters:
  y - the y coordinate of the anchor point
Parameters:
  anchor - the anchor point for positioning the image
throws:
  IllegalArgumentException - if anchoris not a legal value
throws:
  NullPointerException - if img is null
See Also:   Image



drawLine
native public void drawLine(int x1, int y1, int x2, int y2)(Code)
Draws a line between the coordinates (x1,y1) and (x2,y2) using the current color and stroke style.
Parameters:
  x1 - the x coordinate of the start of the line
Parameters:
  y1 - the y coordinate of the start of the line
Parameters:
  x2 - the x coordinate of the end of the line
Parameters:
  y2 - the y coordinate of the end of the line



drawRGB
native public void drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha)(Code)
Renders a series of device-independent RGB+transparency values in a specified region. The values are stored in rgbData in a format with 24 bits of RGB and an eight-bit alpha value (0xAARRGGBB), with the first value stored at the specified offset. The scanlength specifies the relative offset within the array between the corresponding pixels of consecutive rows. Any value for scanlength is acceptable (even negative values) provided that all resulting references are within the bounds of the rgbData array. The ARGB data is rasterized horizontally from left to right within each row. The ARGB values are rendered in the region specified by x, y, width and height, and the operation is subject to the current clip region and translation for this Graphics object.

Consider P(a,b) to be the value of the pixel located at column a and row b of the Image, where rows and columns are numbered downward from the top starting at zero, and columns are numbered rightward from the left starting at zero. This operation can then be defined as:


 P(a, b) = rgbData[offset + (a - x) + (b - y) * scanlength]
 

for


 x <= a < x + width
 y <= b < y + height    

This capability is provided in the Graphics class so that it can be used to render both to the screen and to offscreen Image objects. The ability to retrieve ARGB values is provided by the Image.getRGB method.

If processAlpha is true, the high-order byte of the ARGB format specifies opacity; that is, 0x00RRGGBB specifies a fully transparent pixel and 0xFFRRGGBB specifies a fully opaque pixel. Intermediate alpha values specify semitransparency. If the implementation does not support alpha blending for image rendering operations, it must remove any semitransparency from the source data prior to performing any rendering. (See Alpha Processing for further discussion.) If processAlpha is false, the alpha values are ignored and all pixels must be treated as completely opaque.

The mapping from ARGB values to the device-dependent pixels is platform-specific and may require significant computation.


Parameters:
  rgbData - an array of ARGB values in the format0xAARRGGBB
Parameters:
  offset - the array index of the first ARGB value
Parameters:
  scanlength - the relative array offset between thecorresponding pixels in consecutive rows in thergbData array
Parameters:
  x - the horizontal location of the region to be rendered
Parameters:
  y - the vertical location of the region to be rendered
Parameters:
  width - the width of the region to be rendered
Parameters:
  height - the height of the region to be rendered
Parameters:
  processAlpha - true if rgbDatahas an alpha channel,false if all pixels are fully opaque
throws:
  ArrayIndexOutOfBoundsException - if the requested operationwill attempt to access an element of rgbDatawhose index is either negative or beyond its length
throws:
  NullPointerException - if rgbData is null



drawRect
native public void drawRect(int x, int y, int width, int height)(Code)
Draws the outline of the specified rectangle using the current color and stroke style. The resulting rectangle will cover an area (width + 1) pixels wide by (height + 1) pixels tall. If either width or height is less than zero, nothing is drawn.
Parameters:
  x - the x coordinate of the rectangle to be drawn
Parameters:
  y - the y coordinate of the rectangle to be drawn
Parameters:
  width - the width of the rectangle to be drawn
Parameters:
  height - the height of the rectangle to be drawn
See Also:   Graphics.fillRect(int,int,int,int)



drawRegion
public void drawRegion(Image src, int x_src, int y_src, int width, int height, int transform, int x_dest, int y_dest, int anchor)(Code)
Copies a region of the specified source image to a location within the destination, possibly transforming (rotating and reflecting) the image data using the chosen transform function.

The destination, if it is an image, must not be the same image as the source image. If it is, an exception is thrown. This restriction is present in order to avoid ill-defined behaviors that might occur if overlapped, transformed copies were permitted.

The transform function used must be one of the following, as defined in the javax.microedition.lcdui.game.Sprite Sprite class:
Sprite.TRANS_NONE - causes the specified image region to be copied unchanged
Sprite.TRANS_ROT90 - causes the specified image region to be rotated clockwise by 90 degrees.
Sprite.TRANS_ROT180 - causes the specified image region to be rotated clockwise by 180 degrees.
Sprite.TRANS_ROT270 - causes the specified image region to be rotated clockwise by 270 degrees.
Sprite.TRANS_MIRROR - causes the specified image region to be reflected about its vertical center.
Sprite.TRANS_MIRROR_ROT90 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 90 degrees.
Sprite.TRANS_MIRROR_ROT180 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 180 degrees.
Sprite.TRANS_MIRROR_ROT270 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 270 degrees.

If the source region contains transparent pixels, the corresponding pixels in the destination region must be left untouched. If the source region contains partially transparent pixels, a compositing operation must be performed with the destination pixels, leaving all pixels of the destination region fully opaque.

The (x_src, y_src) coordinates are relative to the upper left corner of the source image. The x_src, y_src, width, and height parameters specify a rectangular region of the source image. It is illegal for this region to extend beyond the bounds of the source image. This requires that:


 x_src >= 0
 y_src >= 0
 x_src + width <= source width
 y_src + height <= source height    

The (x_dest, y_dest) coordinates are relative to the coordinate system of this Graphics object. It is legal for the destination area to extend beyond the bounds of the Graphics object. Pixels outside of the bounds of the Graphics object will not be drawn.

The transform is applied to the image data from the region of the source image, and the result is rendered with its anchor point positioned at location (x_dest, y_dest) in the destination.


Parameters:
  src - the source image to copy from
Parameters:
  x_src - the x coordinate of the upper left corner of the regionwithin the source image to copy
Parameters:
  y_src - the y coordinate of the upper left corner of the regionwithin the source image to copy
Parameters:
  width - the width of the region to copy
Parameters:
  height - the height of the region to copy
Parameters:
  transform - the desired transformation for the selected regionbeing copied
Parameters:
  x_dest - the x coordinate of the anchor point in thedestination drawing area
Parameters:
  y_dest - the y coordinate of the anchor point in thedestination drawing area
Parameters:
  anchor - the anchor point for positioning the region withinthe destination image
throws:
  IllegalArgumentException - if src is thesame image as thedestination of this Graphics object
throws:
  NullPointerException - if src is null
throws:
  IllegalArgumentException - if transform is invalid
throws:
  IllegalArgumentException - if anchor is invalid
throws:
  IllegalArgumentException - if the region to be copied exceedsthe bounds of the source image



drawRoundRect
native public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)
Draws the outline of the specified rounded corner rectangle using the current color and stroke style. The resulting rectangle will cover an area (width + 1) pixels wide by (height + 1) pixels tall. If either width or height is less than zero, nothing is drawn.
Parameters:
  x - the x coordinate of the rectangle to be drawn
Parameters:
  y - the y coordinate of the rectangle to be drawn
Parameters:
  width - the width of the rectangle to be drawn
Parameters:
  height - the height of the rectangle to be drawn
Parameters:
  arcWidth - the horizontal diameter of the arc at the four corners
Parameters:
  arcHeight - the vertical diameter of the arc at the four corners
See Also:   Graphics.fillRoundRect(int,int,int,int,int,int)



drawString
native public void drawString(java.lang.String str, int x, int y, int anchor)(Code)
Draws the specified String using the current font and color. The x,y position is the position of the anchor point. See anchor points.
Parameters:
  str - the String to be drawn
Parameters:
  x - the x coordinate of the anchor point
Parameters:
  y - the y coordinate of the anchor point
Parameters:
  anchor - the anchor point for positioning the text
throws:
  NullPointerException - if str is null
throws:
  IllegalArgumentException - if anchor is not a legal value
See Also:   Graphics.drawChars(char[],int,int,int,int,int)



drawSubstring
native public void drawSubstring(String str, int offset, int len, int x, int y, int anchor)(Code)
Draws the specified String using the current font and color. The x,y position is the position of the anchor point. See anchor points.

The offset and len parameters must specify a valid range of characters within the string str. The offset parameter must be within the range [0..(str.length())], inclusive. The len parameter must be a non-negative integer such that (offset + len) <= str.length().


Parameters:
  str - the String to be drawn
Parameters:
  offset - zero-based index of first character in the substring
Parameters:
  len - length of the substring
Parameters:
  x - the x coordinate of the anchor point
Parameters:
  y - the y coordinate of the anchor point
Parameters:
  anchor - the anchor point for positioning the text
See Also:    #drawString(String, int, int, int).
throws:
  StringIndexOutOfBoundsException - if offsetand length do not specifya valid range within the String str
throws:
  IllegalArgumentException - if anchoris not a legal value
throws:
  NullPointerException - if str is null



fillArc
native public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)
Fills a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

If either width or height is zero or less, nothing is drawn.

The filled region consists of the "pie wedge" region bounded by the arc segment as if drawn by drawArc(), the radius extending from the center to this arc at startAngle degrees, and radius extending from the center to this arc at startAngle + arcAngle degrees.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.


Parameters:
  x - the x coordinate of the upper-left corner ofthe arc to be filled.
Parameters:
  y - the y coordinate of the upper-left corner of thearc to be filled.
Parameters:
  width - the width of the arc to be filled
Parameters:
  height - the height of the arc to be filled
Parameters:
  startAngle - the beginning angle.
Parameters:
  arcAngle - the angular extent of the arc,relative to the start angle.
See Also:   Graphics.drawArc(int,int,int,int,int,int)



fillRect
native public void fillRect(int x, int y, int width, int height)(Code)
Fills the specified rectangle with the current color. If either width or height is zero or less, nothing is drawn.
Parameters:
  x - the x coordinate of the rectangle to be filled
Parameters:
  y - the y coordinate of the rectangle to be filled
Parameters:
  width - the width of the rectangle to be filled
Parameters:
  height - the height of the rectangle to be filled
See Also:   Graphics.drawRect(int,int,int,int)



fillRoundRect
native public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)
Fills the specified rounded corner rectangle with the current color. If either width or height is zero or less, nothing is drawn.
Parameters:
  x - the x coordinate of the rectangle to be filled
Parameters:
  y - the y coordinate of the rectangle to be filled
Parameters:
  width - the width of the rectangle to be filled
Parameters:
  height - the height of the rectangle to be filled
Parameters:
  arcWidth - the horizontal diameter of the arc at the fourcorners
Parameters:
  arcHeight - the vertical diameter of the arc at the four corners
See Also:   Graphics.drawRoundRect(int,int,int,int,int,int)



fillTriangle
native public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3)(Code)
Fills the specified triangle will the current color. The lines connecting each pair of points are included in the filled triangle.
Parameters:
  x1 - the x coordinate of the first vertex of the triangle
Parameters:
  y1 - the y coordinate of the first vertex of the triangle
Parameters:
  x2 - the x coordinate of the second vertex of the triangle
Parameters:
  y2 - the y coordinate of the second vertex of the triangle
Parameters:
  x3 - the x coordinate of the third vertex of the triangle
Parameters:
  y3 - the y coordinate of the third vertex of the triangle



getBlueComponent
public synchronized int getBlueComponent()(Code)
Gets the blue component of the current color. integer value in range 0-255
See Also:   Graphics.setColor(int,int,int)



getClip
void getClip(int[] region)(Code)
Internal routine to get the clip in a single call. The input parameter must be a 4 element integer array. The values of the array upon return will be equal to the same values as would be returned from getClipX(), getClipY(), getClipX()+getClipWidth(), and getClipY()+getClipHeight().
Parameters:
  region - a four element array to hold the clip rectangle



getClipHeight
public synchronized int getClipHeight()(Code)
Gets the height of the current clipping area. height of the current clipping area.
See Also:   Graphics.clipRect(int,int,int,int)
See Also:   Graphics.setClip(int,int,int,int)



getClipWidth
public synchronized int getClipWidth()(Code)
Gets the width of the current clipping area. width of the current clipping area.
See Also:   Graphics.clipRect(int,int,int,int)
See Also:   Graphics.setClip(int,int,int,int)



getClipX
public synchronized int getClipX()(Code)
Gets the X offset of the current clipping area, relative to the coordinate system origin of this graphics context. Separating the getClip operation into two methods returning integers is more performance and memory efficient than one getClip() call returning an object. X offset of the current clipping area
See Also:   Graphics.clipRect(int,int,int,int)
See Also:   Graphics.setClip(int,int,int,int)



getClipY
public synchronized int getClipY()(Code)
Gets the Y offset of the current clipping area, relative to the coordinate system origin of this graphics context. Separating the getClip operation into two methods returning integers is more performance and memory efficient than one getClip() call returning an object. Y offset of the current clipping area
See Also:   Graphics.clipRect(int,int,int,int)
See Also:   Graphics.setClip(int,int,int,int)



getColor
public synchronized int getColor()(Code)
Gets the current color. an integer in form 0x00RRGGBB
See Also:   Graphics.setColor(int,int,int)



getCreator
synchronized Object getCreator()(Code)
Returns the creator of this Graphics object Graphics creator reference



getDisplayColor
native public int getDisplayColor(int color)(Code)
Gets the color that will be displayed if the specified color is requested. This method enables the developer to check the manner in which RGB values are mapped to the set of distinct colors that the device can actually display. For example, with a monochrome device, this method will return either 0xFFFFFF (white) or 0x000000 (black) depending on the brightness of the specified color.
Parameters:
  color - the desired color (in 0x00RRGGBBformat, the high-orderbyte is ignored) the corresponding color that will be displayed on the device'sscreen (in 0x00RRGGBB format)



getFont
public synchronized Font getFont()(Code)
Gets the current font. current font
See Also:   javax.microedition.lcdui.Font
See Also:   Graphics.setFont(javax.microedition.lcdui.Font)



getGrayScale
public synchronized int getGrayScale()(Code)
Gets the current grayscale value of the color being used for rendering operations. If the color was set by setGrayScale(), that value is simply returned. If the color was set by one of the methods that allows setting of the red, green, and blue components, the value returned is computed from the RGB color components (possibly in a device-specific fashion) that best approximates the brightness of that color. integer value in range 0-255
See Also:   Graphics.setGrayScale



getGreenComponent
public synchronized int getGreenComponent()(Code)
Gets the green component of the current color. integer value in range 0-255
See Also:   Graphics.setColor(int,int,int)



getImageGraphics
static Graphics getImageGraphics(Image img)(Code)
Retrieve the Graphics context for the given Image
Parameters:
  img - The Image to get a Graphics context for Graphics Will return a new ImageGraphics object ifthe Image is non-null.



getImageGraphics
static Graphics getImageGraphics(Image img, int width, int height)(Code)
Retrieve the Graphics context for the given Image and explicitly set the dimensions of the created context. It is possible the Image is bigger than area the Graphics context should provide access to, e.g. off-screen buffer created for full screen mode, but used for both normal and full modes with no resizing.
Parameters:
  img - The Image to get a Graphics context for
Parameters:
  width - The width of the Graphics context
Parameters:
  height - The height of the Graphics context Graphics Will return a new ImageGraphics object ifthe Image is non-null.



getMaxHeight
short getMaxHeight()(Code)
Returns the maximal height available for the clipping withing this Graphics context The height of the Graphics context



getMaxWidth
short getMaxWidth()(Code)
Returns the maximal width available for the clipping withing this Graphics context The width of the Graphics context



getRedComponent
public synchronized int getRedComponent()(Code)
Gets the red component of the current color. integer value in range 0-255
See Also:   Graphics.setColor(int,int,int)



getScreenGraphics
static Graphics getScreenGraphics(int displayId, int width, int height)(Code)
Retrieve the Graphics context that renders to the device's display
Parameters:
  displayId - The graphics object will be associatedwith Display with that displayId
Parameters:
  width - The width of the Graphics context
Parameters:
  height - The height of the Graphics context. Graphics



getStrokeStyle
public synchronized int getStrokeStyle()(Code)
Gets the stroke style used for drawing operations. stroke style, SOLID or DOTTED
See Also:   Graphics.setStrokeStyle



getTranslateX
public synchronized int getTranslateX()(Code)
Gets the X coordinate of the translated origin of this graphics context. X of current origin



getTranslateY
public synchronized int getTranslateY()(Code)
Gets the Y coordinate of the translated origin of this graphics context. Y of current origin



isScreenGraphics
boolean isScreenGraphics()(Code)
Determines if this a Graphics object used to represent the device. true if this Graphics represents the device;false - otherwise



preserveMIDPRuntimeGC
void preserveMIDPRuntimeGC(int systemX, int systemY, int systemW, int systemH)(Code)
Preserve MIDP runtime GC. - Our internal MIDP clip to protect it from MIDlet drawing on top of our widget. - Translation
Parameters:
  systemX - The system upper left x coordinate
Parameters:
  systemY - The system upper left y coordinate
Parameters:
  systemW - The system width of the rectangle
Parameters:
  systemH - The system height of the rectangle



reset
void reset(int x1, int y1, int x2, int y2)(Code)
Reset this Graphics context with the given coordinates
Parameters:
  x1 - The upper left x coordinate
Parameters:
  y1 - The upper left y coordinate
Parameters:
  x2 - The lower right x coordinate
Parameters:
  y2 - The lower right y coordinate



reset
void reset()(Code)
Reset this Graphics context to its default dimensions (same as reset(0, 0, maxWidth, maxHeight)



resetGC
void resetGC()(Code)
Reset the Graphic context with all items related to machine independent context. There is no translation and clipping involve since different implementations may map it directly or not. Only Font, Style, and Color are reset in this function.



restoreMIDPRuntimeGC
void restoreMIDPRuntimeGC()(Code)
Restore the runtime GC. - Release the internal runtime clip values by unsetting the variable. - Restore the original translation



setClip
public synchronized void setClip(int x, int y, int width, int height)(Code)
Sets the current clip to the rectangle specified by the given coordinates. Rendering operations have no effect outside of the clipping area.
Parameters:
  x - the x coordinate of the new clip rectangle
Parameters:
  y - the y coordinate of the new clip rectangle
Parameters:
  width - the width of the new clip rectangle
Parameters:
  height - the height of the new clip rectangle
See Also:   Graphics.clipRect(int,int,int,int)



setColor
public synchronized void setColor(int red, int green, int blue)(Code)
Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color.
Parameters:
  red - the red component of the color being set in range0-255
Parameters:
  green - the green component of the color being set in range0-255
Parameters:
  blue - the blue component of the color being set in range0-255
throws:
  IllegalArgumentException - if any of the color componentsare outside of range 0-255
See Also:   Graphics.getColor



setColor
public synchronized void setColor(int RGB)(Code)
Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color. The RGB value passed in is interpreted with the least significant eight bits giving the blue component, the next eight more significant bits giving the green component, and the next eight more significant bits giving the red component. That is to say, the color component is specified in the form of 0x00RRGGBB. The high order byte of this value is ignored.
Parameters:
  RGB - the color being set
See Also:   Graphics.getColor



setCreator
synchronized void setCreator(Object creator)(Code)
Sets the creator of this Graphics object
Parameters:
  creator - the reference to creator of this Graphics object



setDimensions
void setDimensions(int w, int h)(Code)
Sets the width and height member variables of this Graphics object to reflect the correct values e.g. for clipping correctly
Parameters:
  w - the width of this Graphics object
Parameters:
  h - the height of this Graphics object



setFont
public synchronized void setFont(Font font)(Code)
Sets the font for all subsequent text rendering operations. If font is null, it is equivalent to setFont(Font.getDefaultFont()).
Parameters:
  font - the specified font
See Also:   javax.microedition.lcdui.Font
See Also:   Graphics.getFont()
See Also:   Graphics.drawString(java.lang.String,int,int,int)
See Also:   Graphics.drawChars(char[],int,int,int,int,int)



setGrayScale
public synchronized void setGrayScale(int value)(Code)
Sets the current grayscale to be used for all subsequent rendering operations. For monochrome displays, the behavior is clear. For color displays, this sets the color for all subsequent drawing operations to be a gray color equivalent to the value passed in. The value must be in the range 0-255.
Parameters:
  value - the desired grayscale value
throws:
  IllegalArgumentException - if the gray value is out of range
See Also:   Graphics.getGrayScale



setStrokeStyle
public synchronized void setStrokeStyle(int style)(Code)
Sets the stroke style used for drawing lines, arcs, rectangles, and rounded rectangles. This does not affect fill, text, and image operations.
Parameters:
  style - can be SOLID or DOTTED
throws:
  IllegalArgumentException - if the style is illegal
See Also:   Graphics.getStrokeStyle



translate
public synchronized void translate(int x, int y)(Code)
Translates the origin of the graphics context to the point (x, y) in the current coordinate system. All coordinates used in subsequent rendering operations on this graphics context will be relative to this new origin.

The effect of calls to translate() are cumulative. For example, calling translate(1, 2) and then translate(3, 4) results in a translation of (4, 6).

The application can set an absolute origin (ax, ay) using the following technique:

g.translate(ax - g.getTranslateX(), ay - g.getTranslateY())


Parameters:
  x - the x coordinate of the new translation origin
Parameters:
  y - the y coordinate of the new translation origin
See Also:   Graphics.getTranslateX()
See Also:   Graphics.getTranslateY()




Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.