SoFunction
Updated on 2025-04-10

ShapeDrawable Magical Uses of Android Magnifier ShapeDrawable


float scale = 1.2f;

int cx = 224;
int cy = 357;
int r = 200;

// Create a ShapeDrawable by specifying the shape
ShapeDrawable shape=new ShapeDrawable(new OvalShape());
Bitmap bm = (getResources(),.bg1);
BitmapShader bs = new BitmapShader(bm, , );

Matrix m = new Matrix();
(r-cx, r-cy);
(scale, scale);
(m);   // Graphic transformation can be implemented here, including area specification

// Set up Shader for ShapeDrawable
().setShader(bs);

// Specify the location of the drawing target
((int)(cx-r*scale),(int)(cy-r*scale),(int)(cx+r*scale),(int)(cy+r*scale));
(bm, 0, 0, null);
(canvas);

float scale = 1.2f;

int cx = 224;
int cy = 357;
int r = 200;


// Create a ShapeDrawable by specifying the shape
ShapeDrawable shape=new ShapeDrawable(new OvalShape());
Bitmap bm = (getResources(),.bg1);
BitmapShader bs = new BitmapShader(bm, , );

Matrix m = new Matrix();
(r-cx, r-cy);
(scale, scale);
(m); // Graphic transformation can be implemented here, including area specification

// Set up Shader for ShapeDrawable
().setShader(bs);

// Specify the location of the drawing
((int)(cx-r*scale),(int)(cy-r*scale),(int)(cx+r*scale),(int)(cy+r*scale));
(bm, 0, 0, null);
(canvas);