當前位置: 首頁>>代碼示例>>Java>>正文


Java Picture.beginRecording方法代碼示例

本文整理匯總了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;
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:39,代碼來源:SVG.java

示例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;
}
 
開發者ID:robinxdroid,項目名稱:XDroidAnimation,代碼行數:41,代碼來源:SVG.java

示例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;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:25,代碼來源:SVG.java

示例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;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:52,代碼來源:SVG.java

示例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;
}
 
開發者ID:onlylemi,項目名稱:MapView,代碼行數:19,代碼來源:MapUtils.java

示例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;
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:20,代碼來源:SVG.java

示例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();
}
 
開發者ID:MaKeAppDev,項目名稱:Redpin,代碼行數:17,代碼來源:ZoomAndScrollImageView.java

示例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;
}
 
開發者ID:thinkingcow,項目名稱:svg-android-2,代碼行數:13,代碼來源:SVG.java

示例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;
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:15,代碼來源:SVG.java

示例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;
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:28,代碼來源:SVG.java

示例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;
}
 
開發者ID:Pixate,項目名稱:pixate-freestyle-android,代碼行數:16,代碼來源:PXShapeView.java

示例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;

    }
 
開發者ID:gabuzomeu,項目名稱:osmLib,代碼行數:37,代碼來源:CompassPictureFactory.java

示例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;
}
 
開發者ID:mogoweb,項目名稱:chromium_webview,代碼行數:15,代碼來源:JavaBrowserViewRendererHelper.java

示例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();
}
 
開發者ID:BenjaminMesre,項目名稱:UPMCarte,代碼行數:17,代碼來源:ZoomAndScrollImageView.java

示例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;

}
 
開發者ID:CRS4-IOT,項目名稱:indoorlib,代碼行數:61,代碼來源:CustomView.java


注:本文中的android.graphics.Picture.beginRecording方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。