android.graphicsパッケージ - Canvasクラスを使用します。
* View.onDraw()をオーバーライドし、渡されたCanvasインスタンスを操作することでグラフィックスを描画できます。
サンプルソースコード
public class GraphicsTestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new GraphicsTestView(this));
}
private class GraphicsTestView extends View {
public GraphicsTestView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.argb(255, 255, 255, 255));
canvas.drawLine(0, 0, 100, 50, paint);
}
}
}
android.graphics
Provides low level graphics tools such as canvases, color filters, points, and rectangles that let you handle drawing to the screen directly.
Classes
AvoidXfermode xfermode will draw the src everywhere except on top of the opColor or, depending on the Mode, draw only on top of the opColor. | |
| |
Creates Bitmap objects from various sources, including files, streams, and byte-arrays. | |
| |
BitmapRegionDecoder can be used to decode a rectangle region from an image. | |
Shader used to draw a bitmap as a texture. | |
This takes a mask, and blurs its edge by the specified radius. | |
A camera instance can be used to compute 3D transformations and generate a matrix that can be applied, for instance, on a | |
The Canvas class holds the "draw" calls. | |
The Color class defines methods for creating and converting color ints. | |
| |
5x4 matrix for transforming the color+alpha components of a Bitmap. | |
| |
| |
A subclass of shader that returns the coposition of two other shaders, combined by an | |
| |
| |
| |
A DrawFilter subclass can be installed in a Canvas. | |
| |
| |
| |
| |
| |
| |
MaskFilter is the base class for object that perform transformations on an alpha-channel mask before drawing it. | |
The Matrix class holds a 3x3 matrix for transforming coordinates. | |
| |
The NinePatch class permits drawing a bitmap in nine sections. | |
The Paint class holds the style and color information about how to draw geometries, text and bitmaps. | |
Class that describes the various metrics for a font at a given text size. | |
Convenience method for callers that want to have FontMetrics values as integers. | |
| |
The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. | |
| |
PathEffect is the base class for objects in the Paint that affect the geometry of a drawing primitive before it is transformed by the canvas' matrix and drawn. | |
| |
A picture records drawing calls (via the canvas returned by beginRecording) and can then play them back (via picture.draw(canvas) or canvas.drawPicture). | |
| |
PixelXorXfermode implements a simple pixel xor (op ^ src ^ dst). | |
Point holds two integer coordinates | |
PointF holds two float coordinates | |
| |
| |
| |
| |
| |
Rect holds four integer coordinates for a rectangle. | |
RectF holds four float coordinates for a rectangle. | |
| |
| |
Shader is the based class for objects that return horizontal spans of colors during drawing. | |
| |
Captures frames from an image stream as an OpenGL ES texture. | |
| |
The Typeface class specifies the typeface and intrinsic style of a font. | |
Xfermode is the base class for objects that are called to implement custom "transfer-modes" in the drawing pipeline. | |
YuvImage contains YUV data and provides a method that compresses a region of the YUV data to a Jpeg. |
0 件のコメント:
コメントを投稿