public class GGBitmap
extends java.lang.Object
| Constructor and Description | 
|---|
GGBitmap(int width,
        int height)
Creates a GGBitmap with given number of horizontal and vertical pixels
 that holds a Bitmap instance to draw graphics elements. 
 | 
GGBitmap(int width,
        int height,
        int bgColor)
Creates a GGBitmap with given number of horizontal and vertical pixels
 that holds a Bitmap instance to draw graphics elements. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
clear()
Clears the frame buffer by painting it with the current background color. 
 | 
void | 
clear(int color)
Sets the background color to the given color and clears the frame buffer
 by painting it with the given color. 
 | 
static android.graphics.Bitmap | 
crop(android.graphics.Bitmap bm,
    int x1,
    int y1,
    int x2,
    int y2)
Extracts the partial image if the given rectangular area. 
 | 
void | 
drawArc(android.graphics.Point pt,
       int radius,
       double startAngle,
       double extendAngle)
Draws an arc with given center, radius, start and end angle. 
 | 
void | 
drawCircle(android.graphics.Point center,
          int radius)
Draws a circle with given center and given radius. 
 | 
void | 
drawImage(android.graphics.Bitmap image,
         int x,
         int y)
Draws a given bitmap image into the background at the given position. 
 | 
void | 
drawLine(int x1,
        int y1,
        int x2,
        int y2)
Draws a line from one coordinate pair to another coordinate pair. 
 | 
void | 
drawLine(android.graphics.Point pt1,
        android.graphics.Point pt2)
Draws a line from one coordinate pair to another coordinate pair. 
 | 
void | 
drawPoint(int x,
         int y)
Draws a single point into the background. 
 | 
void | 
drawPolygon(android.graphics.Point[] vertexes)
Draws a polygon with given vertexes. 
 | 
void | 
drawRectangle(android.graphics.Point pt1,
             android.graphics.Point pt2)
Draws a rectangle with given opposite corners. 
 | 
void | 
drawText(java.lang.String text,
        android.graphics.Point pt)
Displays the given text at the given position using the current font. 
 | 
void | 
fillArc(android.graphics.Point pt,
       int radius,
       double startAngle,
       double extendAngle)
Fills an arc with given center, radius, start and end angle. 
 | 
void | 
fillCircle(android.graphics.Point center,
          int radius)
Draws a filled circle with given center and given radius. 
 | 
void | 
fillPolygon(android.graphics.Point[] vertexes)
Draws a filled polygon with given vertexes. 
 | 
void | 
fillRectangle(android.graphics.Point pt1,
             android.graphics.Point pt2)
Draws a filled rectangle with given opposite corners. 
 | 
static android.graphics.Bitmap | 
floodFill(android.graphics.Bitmap bitmap,
         android.graphics.Point pt,
         int oldColor,
         int newColor)
Fills a bounded single-colored region with 
 the given color. 
 | 
android.graphics.Bitmap | 
getBitmap()
Returns the bitmap attributed to this GGBitmap. 
 | 
static android.graphics.Bitmap | 
getBitmap(java.lang.String filename)
Loads the image from given image file and returns the Bitmap reference for
 this image. 
 | 
android.graphics.Canvas | 
getCanvas()
Returns a Canvas reference of the current background. 
 | 
int | 
getColor(android.graphics.Point pt)
Returns the color of the pixel of the bitmap at given point. 
 | 
static android.graphics.Bitmap | 
getRotatedImage(android.graphics.Bitmap bitmap,
               double angle)
Returns the bitmap rotated by the given angle. 
 | 
static android.graphics.Bitmap | 
getRotatedImage(java.lang.String filename,
               double angle)
Returns the bitmap from the given file rotated by the given angle. 
 | 
static android.graphics.Bitmap | 
getScaledImage(android.graphics.Bitmap bitmap,
              double factor,
              double angle)
Returns the bitmap scaled by the given factor and rotated by the given angle. 
 | 
static android.graphics.Bitmap | 
getScaledImage(java.lang.String filename,
              double factor,
              double angle)
Returns the bitmap from the given file scaled by the given factor and 
 rotated by the given angle. 
 | 
static android.graphics.Bitmap | 
getZoomedImage(android.graphics.Bitmap bitmap,
              double factor)
Returns the bitmap scaled by the given factor. 
 | 
static android.graphics.Bitmap | 
getZoomedImage(java.lang.String filename,
              double factor)
Returns the bitmap from the given file scaled by the given factor. 
 | 
static android.graphics.Bitmap | 
paste(android.graphics.Bitmap original,
     android.graphics.Bitmap replacement,
     int xStart,
     int yStart)
Returns a clone of the original image where a part is replaced by
 another image. 
 | 
void | 
setLineWidth(int lineWidth)
Sets the current line width for all future painting. 
 | 
void | 
setPaintColor(int color)
Sets the current color for all future painting. 
 | 
public GGBitmap(int width,
        int height)
width - the width of the Bitmap in pixelsheight - the height of the Bitmap in pixelspublic GGBitmap(int width,
        int height,
        int bgColor)
width - the width of the Bitmap in pixelsheight - the height of the Bitmap in pixelsbgColor - the color of the backgroundpublic static android.graphics.Bitmap getZoomedImage(android.graphics.Bitmap bitmap,
                                     double factor)
bitmap - the original image bitmapfactor - the zoom factor (>1 zoom-in, <1 zoom-out)public static android.graphics.Bitmap getZoomedImage(java.lang.String filename,
                                     double factor)
filename - the path or URL to the image filefactor - the zoom factor (>1 zoom-in, <1 zoom-out)public static android.graphics.Bitmap getRotatedImage(android.graphics.Bitmap bitmap,
                                      double angle)
bitmap - the original image bitmapangle - the rotation angle (in degrees clockwise)public static android.graphics.Bitmap getRotatedImage(java.lang.String filename,
                                      double angle)
filename - the path or URL to the image fileangle - the rotation angle (in degrees clockwise)public static android.graphics.Bitmap getScaledImage(android.graphics.Bitmap bitmap,
                                     double factor,
                                     double angle)
bitmap - the original image bitmapfactor - the zoom factor (>1 zoom-in, <1 zoom-out)angle - the rotation angle (in degrees clockwise)public static android.graphics.Bitmap getScaledImage(java.lang.String filename,
                                     double factor,
                                     double angle)
filename - the path or URL to the image filefactor - the zoom factor (>1 zoom-in, <1 zoom-out)angle - the rotation angle (in degrees clockwise)public static android.graphics.Bitmap floodFill(android.graphics.Bitmap bitmap,
                                android.graphics.Point pt,
                                int oldColor,
                                int newColor)
bitmap - the bitmap containing the connected regionpt - a point inside the regionoldColor - the old color of the regionnewColor - the new color of the regionpublic static android.graphics.Bitmap getBitmap(java.lang.String filename)
filename - the path or URL to the image filepublic android.graphics.Canvas getCanvas()
public android.graphics.Bitmap getBitmap()
public void setPaintColor(int color)
color - the new color for paintingpublic void setLineWidth(int lineWidth)
lineWidth - the new line width (in pixels) for paintingpublic void drawImage(android.graphics.Bitmap image,
             int x,
             int y)
image - the bitmap of the imagex - the x-coordinate of the upper left cornery - the y-coordinate of the upper left cornerpublic void drawPoint(int x,
             int y)
x - the x-coordinate of the pointy - the y-coordinate of the pointpublic void clear(int color)
public void clear()
public void drawLine(int x1,
            int y1,
            int x2,
            int y2)
x1 - the x-coordinate of the start pointy1 - the y-coordinate of the start pointx2 - the x-coordinate of the endpointy2 - the y-coordinate of the endpointpublic void drawLine(android.graphics.Point pt1,
            android.graphics.Point pt2)
pt1 - the start pointpt2 - the endpointpublic void drawCircle(android.graphics.Point center,
              int radius)
radius - the radius of the circlepublic void fillCircle(android.graphics.Point center,
              int radius)
center - the center of the circleradius - the radius of the circlepublic void drawRectangle(android.graphics.Point pt1,
                 android.graphics.Point pt2)
pt1 - upper left vertex of the rectanglept2 - lower right vertex of the rectanglepublic void fillRectangle(android.graphics.Point pt1,
                 android.graphics.Point pt2)
pt1 - upper left vertex of the rectanglept2 - lower right vertex of the rectanglepublic void drawArc(android.graphics.Point pt,
           int radius,
           double startAngle,
           double extendAngle)
pt - the center of the arcradius - the radius of the arcstartAngle - the start angle in degrees (zero to east, positive counterclockwise)extendAngle - the extend angle in degrees (zero to east, positive counterclockwise)public void fillArc(android.graphics.Point pt,
           int radius,
           double startAngle,
           double extendAngle)
pt - the center of the arcradius - the radius of the arcstartAngle - the start angle in degrees (zero to east, positive counterclockwise)extendAngle - the extendAngle in degrees (zero to east, positive counterclockwise)public void drawPolygon(android.graphics.Point[] vertexes)
vertexes - the vertexes of the polygonpublic void fillPolygon(android.graphics.Point[] vertexes)
vertexes - the vertexes of the polygonpublic int getColor(android.graphics.Point pt)
pt - point, where to pick the colorpublic void drawText(java.lang.String text,
            android.graphics.Point pt)
text - the text to displaypt - the start point of the text baselinepublic static android.graphics.Bitmap crop(android.graphics.Bitmap bm,
                           int x1,
                           int y1,
                           int x2,
                           int y2)
bm - the image bitmap where to extract the partial imagex1 - the x-coordinate of one of the rectangle vertexy1 - the y-coordinate of this vertexx2 - the x-coordinate of the opposite vertexy2 - the y-coordinate of this vertexpublic static android.graphics.Bitmap paste(android.graphics.Bitmap original,
                            android.graphics.Bitmap replacement,
                            int xStart,
                            int yStart)
original - the original imagereplacement - the image to insertxStart - the upper left x-coordinate where the replacement startsyStart - the upper left y-coordinate where the replacement starts