本文整理汇总了Java中android.graphics.Picture.beginRecording方法的典型用法代码示例。如果您正苦于以下问题:Java Picture.beginRecording方法的具体用法?Java Picture.beginRecording怎么用?Java Picture.beginRecording使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Picture
的用法示例。
在下文中一共展示了Picture.beginRecording方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderViewToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Renders this SVG document to a Picture object using the specified view defined in the document.
* <p>
* A View is an special element in a SVG document that describes a rectangular area in the document.
* Calling this method with a {@code viewId} will result in the specified view being positioned and scaled
* to the viewport. In other words, use {@link #renderToPicture()} to render the whole document, or use this
* method instead to render just a part of it.
*
* @param viewId the id of a view element in the document that defines which section of the document is to be visible.
* @param widthInPixels the width of the initial viewport
* @param heightInPixels the height of the initial viewport
* @return a Picture object suitable for later rendering using {@code Canvas.drawPicture()}, or null if the viewId was not found.
*/
public Picture renderViewToPicture(String viewId, int widthInPixels, int heightInPixels) {
SvgObject obj = this.getElementById(viewId);
if (obj == null)
return null;
if (!(obj instanceof SVG.View))
return null;
SVG.View view = (SVG.View) obj;
if (view.viewBox == null) {
Log.w(TAG, "View element is missing a viewBox attribute.");
return null;
}
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, this.renderDPI);
renderer.renderDocument(this, view.viewBox, view.preserveAspectRatio, false);
picture.endRecording();
return picture;
}
示例2: renderViewToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Renders this SVG document to a Picture object using the specified view defined in the document.
* <p/>
* A View is an special element in a SVG document that describes a rectangular area in the document.
* Calling this method with a {@code viewId} will result in the specified view being positioned and scaled
* to the viewport. In other words, use {@link #renderToPicture()} to render the whole document, or use this
* method instead to render just a part of it.
*
* @param viewId the id of a view element in the document that defines which section of the document is to
* be visible.
* @param widthInPixels the width of the initial viewport
* @param heightInPixels the height of the initial viewport
* @return a Picture object suitable for later rendering using {@code Canvas.drawPicture()},
* or null if the viewId was not found.
*/
public Picture renderViewToPicture(String viewId, int widthInPixels, int heightInPixels) {
SvgObject obj = this.getElementById(viewId);
if (obj == null)
return null;
if (!(obj instanceof SVG.View))
return null;
SVG.View view = (SVG.View) obj;
if (view.viewBox == null) {
Log.w(TAG, "View element is missing a viewBox attribute.");
return null;
}
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, this.renderDPI);
renderer.renderDocument(this, view.viewBox, view.preserveAspectRatio, false);
picture.endRecording();
return picture;
}
示例3: renderToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Renders this SVG document to a Picture object.
*
* @param widthInPixels
* the width of the initial viewport
* @param heightInPixels
* the height of the initial viewport
* @return a Picture object suitable for later rendering using
* {@code Canvas.darwPicture()}
*/
public Picture renderToPicture(int widthInPixels, int heightInPixels) {
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels,
(float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort,
this.renderDPI);
renderer.renderDocument(this, null, null, false);
picture.endRecording();
return picture;
}
示例4: renderViewToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Renders this SVG document to a Picture object using the specified view
* defined in the document.
* <p>
* A View is an special element in a SVG document that describes a
* rectangular area in the document. Calling this method with a
* {@code viewId} will result in the specified view being positioned and
* scaled to the viewport. In other words, use {@link #renderToPicture()} to
* render the whole document, or use this method instead to render just a
* part of it.
*
* @param viewId
* the id of a view element in the document that defines which
* section of the document is to be visible.
* @param widthInPixels
* the width of the initial viewport
* @param heightInPixels
* the height of the initial viewport
* @return a Picture object suitable for later rendering using
* {@code Canvas.drawPicture()}, or null if the viewId was not
* found.
*/
public Picture renderViewToPicture(String viewId, int widthInPixels,
int heightInPixels) {
SvgObject obj = this.getElementById(viewId);
if (obj == null)
return null;
if (!(obj instanceof SVG.View))
return null;
SVG.View view = (SVG.View) obj;
if (view.viewBox == null) {
Log.w(TAG, "View element is missing a viewBox attribute.");
return null;
}
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels,
(float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort,
this.renderDPI);
renderer.renderDocument(this, view.viewBox, view.preserveAspectRatio,
false);
picture.endRecording();
return picture;
}
示例5: getPictureFromBitmap
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* bitmap to picture
*
* @param bitmap
* @return
*/
public static Picture getPictureFromBitmap(Bitmap bitmap) {
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(bitmap.getWidth(),
bitmap.getHeight());
canvas.drawBitmap(
bitmap,
null,
new RectF(0f, 0f, (float) bitmap.getWidth(), (float) bitmap
.getHeight()), null);
picture.endRecording();
return picture;
}
示例6: renderToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Renders this SVG document to a Picture object.
*
* @param widthInPixels the width of the initial viewport
* @param heightInPixels the height of the initial viewport
* @return a Picture object suitable for later rendering using {@code Canvas.darwPicture()}
*/
public Picture renderToPicture(int widthInPixels, int heightInPixels) {
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, this.renderDPI);
renderer.renderDocument(this, null, null, false);
picture.endRecording();
return picture;
}
示例7: setImageBitmap
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Displays a bitmap
*
* @param bitmap
* {@link Bitmap}
*/
public void setImageBitmap(Bitmap bitmap) {
setZoom(1.0f, false);
setContentSize(bitmap.getWidth(), bitmap.getHeight());
picture = new Picture();
Canvas c = picture
.beginRecording(bitmap.getWidth(), bitmap.getHeight());
c.drawBitmap(bitmap, 0, 0, null);
picture.endRecording();
}
示例8: resizePicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Return a differently sized picture
*/
public Picture resizePicture(int height, int width){
Picture newPicture = new Picture();
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas = newPicture.beginRecording(width, height);
canvas.drawPicture(picture, new Rect(0,0,width,height));
newPicture.endRecording();
return newPicture;
}
示例9: renderToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
@SuppressWarnings({"WeakerAccess", "unused"})
public Picture renderToPicture(int widthInPixels, int heightInPixels)
{
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, this.renderDPI);
renderer.renderDocument(this, viewPort, null, null, false);
picture.endRecording();
return picture;
}
示例10: renderViewToPicture
import android.graphics.Picture; //导入方法依赖的package包/类
@SuppressWarnings({"WeakerAccess", "unused"})
public Picture renderViewToPicture(String viewId, int widthInPixels, int heightInPixels)
{
SvgObject obj = this.getElementById(viewId);
if (obj == null)
return null;
if (!(obj instanceof SVG.View))
return null;
SVG.View view = (SVG.View) obj;
if (view.viewBox == null) {
Log.w(TAG, "View element is missing a viewBox attribute.");
return null;
}
Picture picture = new Picture();
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, this.renderDPI);
renderer.renderDocument(this, viewPort, view.viewBox, view.preserveAspectRatio, false);
picture.endRecording();
return picture;
}
示例11: renderToImage
import android.graphics.Picture; //导入方法依赖的package包/类
public Picture renderToImage(Rect bounds) {
if (document != null) {
Picture image = new Picture();
try {
Canvas c = image.beginRecording(bounds.width(), bounds.height());
document.render(c);
} catch (Exception ioe) {
PXLog.e(TAG, ioe, "Error rendering to image");
} finally {
image.endRecording();
}
return image;
}
return null;
}
示例12: createCompassRosePicture
import android.graphics.Picture; //导入方法依赖的package包/类
public static Picture createCompassRosePicture(final int mCompassRadius, final float displayDensity, final Paint northPaint, final Paint southPaint, final Paint centerPaint) {
// final int picBorderWidthAndHeight = (int) ((mCompassRadius + 5) * 2 *
// mScale);
final int picBorderWidthAndHeight = (int) ((mCompassRadius + 5) * 2);
final int center = picBorderWidthAndHeight / 2;
// Record Rose
Picture mCompassRose = new Picture();
final Canvas canvas = mCompassRose.beginRecording(picBorderWidthAndHeight, picBorderWidthAndHeight);
// Blue triangle pointing north
final Path pathNorth = new Path();
pathNorth.moveTo(center, center - (mCompassRadius - 3) * displayDensity);
pathNorth.lineTo(center + 4 * displayDensity, center);
pathNorth.lineTo(center - 4 * displayDensity, center);
pathNorth.lineTo(center, center - (mCompassRadius - 3) * displayDensity);
pathNorth.close();
canvas.drawPath(pathNorth, northPaint);
// Red triangle pointing south
final Path pathSouth = new Path();
pathSouth.moveTo(center, center + (mCompassRadius - 3) * displayDensity);
pathSouth.lineTo(center + 4 * displayDensity, center);
pathSouth.lineTo(center - 4 * displayDensity, center);
pathSouth.lineTo(center, center + (mCompassRadius - 3) * displayDensity);
pathSouth.close();
canvas.drawPath(pathSouth, southPaint);
// Draw a little white dot in the middle
canvas.drawCircle(center, center, 2, centerPaint);
mCompassRose.endRecording();
return mCompassRose;
}
示例13: recordBitmapIntoPicture
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Creates a new Picture that records drawing a provided bitmap.
* Will return an empty Picture if the Bitmap is null.
*/
@CalledByNative
private static Picture recordBitmapIntoPicture(Bitmap bitmap) {
Picture picture = new Picture();
if (bitmap != null) {
Canvas recordingCanvas = picture.beginRecording(bitmap.getWidth(), bitmap.getHeight());
drawBitmapIntoCanvas(bitmap, recordingCanvas, 0, 0);
picture.endRecording();
}
return picture;
}
示例14: setImageBitmap
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* Displays a bitmap
*
* @param bitmap
* {@link Bitmap}
*/
public void setImageBitmap(Bitmap bitmap) {
setZoom(1.0f, false);
setContentSize(bitmap.getWidth(), bitmap.getHeight());
picture = new Picture();
Canvas c = picture
.beginRecording(bitmap.getWidth(), bitmap.getHeight());
c.drawBitmap(bitmap, 0, 0, null);
picture.endRecording();
}
示例15: drawBarreds
import android.graphics.Picture; //导入方法依赖的package包/类
/**
* @return
*/
private Picture drawBarreds() {
Picture pictureContent = new Picture();
Canvas canvasContent = pictureContent.beginRecording(getWidth(), getHeight());
Paint paintContent = new Paint(Paint.ANTI_ALIAS_FLAG);
canvasContent.save();
paintContent.setColor(Color.BLUE);
paintContent.setStyle(Style.STROKE);
paintContent.setStrokeWidth(2);
paintContent.setAlpha(50);
try {
cellDimension = block.getCellDimension();
JSONArray barred = block.getBarred();
int rows = block.getShape().getInt(0);
int cols = block.getShape().getInt(1);
// this code draws all the shape:
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
canvasContent.drawRect(cellDimension * j,
cellDimension * i,
cellDimension * j + cellDimension,
cellDimension * i + cellDimension,
paintContent);
}
}
paintContent.setColor(Color.RED);
paintContent.setStyle(Style.FILL);
paintContent.setAlpha(50);
for (int i = 0; i < barred.length(); i++) {
JSONArray pos = barred.getJSONArray(i);
canvasContent.drawRect(cellDimension * pos.getInt(1),
cellDimension * pos.getInt(0),
cellDimension * pos.getInt(1) + cellDimension,
cellDimension * pos.getInt(0) + cellDimension,
paintContent);
}
this.paintBoxList(canvasContent, paintContent);
} catch (JSONException e) {
e.printStackTrace();
Log.e("Exception in DrawComponents.drawBarreds",""+e.getMessage());
}
canvasContent.restore();
pictureContent.endRecording();
return pictureContent;
}