Picture beginRecording - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Picture beginRecording method.

This code example shows how to use the following methods:beginRecording, endRecording
     * 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);
            picture.endRecording();
        } 
        return picture;
    } 
 
    // Should never be instantiated. 
    private JavaBrowserViewRendererHelper() { 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
        canvas.restore();
    } 
 
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
        mPicture.endRecording();
 
        int x = getWidth()/2;
        int y = getHeight()/2;
 
        if (false) { 
            canvas.drawPicture(mPicture);
        } else { 
            drawPict(canvas, 0, 0, x, y,  1,  1);
            drawPict(canvas, x, 0, x, y, -1,  1);
            drawPict(canvas, 0, y, x, y,  1, -1);
            drawPict(canvas, x, y, x, y, -1, -1);
        } 
    } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, draw, endRecording, getHeight, getWidth
		// 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) * mScale);
		pathNorth.lineTo(center + 4 * mScale, center);
		pathNorth.lineTo(center - 4 * mScale, center);
		pathNorth.lineTo(center, center - (mCompassRadius - 3) * mScale);
		pathNorth.close();
		canvas.drawPath(pathNorth, northPaint);
 
		// Red triangle pointing south 
		final Path pathSouth = new Path();
		pathSouth.moveTo(center, center + (mCompassRadius - 3) * mScale);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, draw, endRecording, getHeight, getWidth
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
This code example shows how to use the following methods:beginRecording, draw, endRecording, getHeight, getWidth
        // Compute Draw 
 
    } 
 
    // @Override 
    public void onSubBackground(Canvas canvas) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, String.format(" width = %s  // height = %s", getWidth(), getHeight()));
        } 
        mCompassMatrix.setRotate(-bearing, COMPASS_ROSE_CENTER_X, COMPASS_ROSE_CENTER_Y);
        mCompassMatrix.postTranslate(-COMPASS_ROSE_CENTER_X, -COMPASS_ROSE_CENTER_Y);
        mCompassMatrix.postTranslate(centerX, centerY);
        canvas.drawBitmap(compassRose, mCompassMatrix, mPaint);
 
    } 
 
    /** 
     * This is called during layout when the size of this view has changed. If 
     * you were just added to the view hierarchy, you're called with the old 
     * values of 0. 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
        p1 = projection.fromPixels(screenWidth / 2, (screenHeight / 2) - (ydpi / 2));
        p2 = projection.fromPixels(screenWidth / 2, (screenHeight / 2) + (ydpi / 2));
 
        final int yMetersPerInch = ((GeoPoint) p1).distanceTo(p2);
 
        final Canvas canvas = scaleBarPicture.beginRecording((int) xdpi, (int) ydpi);
 
        if (latitudeBar) {
            final String xMsg = scaleBarLengthText(xMetersPerInch, imperial, nautical);
            final Rect xTextRect = new Rect();
            textPaint.getTextBounds(xMsg, 0, xMsg.length(), xTextRect);
 
            final int textSpacing = (int) (xTextRect.height() / 5.0);
 
            canvas.drawRect(0, 0, xdpi, lineWidth, barPaint);
            canvas.drawRect(xdpi, 0, xdpi + lineWidth,
                    xTextRect.height() + lineWidth + textSpacing, barPaint);
 
            if (!longitudeBar) {
                canvas.drawRect(0, 0, lineWidth, xTextRect.height() + lineWidth + textSpacing,

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
		mWidth = width;
		mPaint = new Paint();
		 
	} 
	public Picture getContourPicture(){
		Picture p = new Picture();
		Canvas canvas = p.beginRecording(mWidth, mHeight);
		if (mPath != null){
			canvas.drawPath(mPath, mPaint);
		} 
		p.endRecording();
		return p;
	} 
	 
	public void addPath(Path path){
		mPathList.add(new Path(path));
	} 
	 
	public void addRectangle(Rect rect) {
	    Path path = new Path();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
        canvas.restore();
    } 
 
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
        mPicture.endRecording();
         
        int x = getWidth()/2;
        int y = getHeight()/2;
         
        if (false) { 
            canvas.drawPicture(mPicture);
        } else { 
            drawPict(canvas, 0, 0, x, y,  1,  1);
            drawPict(canvas, x, 0, x, y, -1,  1);
            drawPict(canvas, 0, y, x, y,  1, -1);
            drawPict(canvas, x, y, x, y, -1, -1);
        } 
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beginRecording, endRecording
        canvas.restore();
    } 
 
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
        mPicture.endRecording();
 
        int x = getWidth()/2;
        int y = getHeight()/2;
 
        if (false) { 
            canvas.drawPicture(mPicture);
        } else { 
            drawPict(canvas, 0, 0, x, y,  1,  1);
            drawPict(canvas, x, 0, x, y, -1,  1);
            drawPict(canvas, 0, y, x, y,  1, -1);
            drawPict(canvas, x, y, x, y, -1, -1);
        } 
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Picture beginRecording Questions & Answers:

beginRecording Method Overview
To record a picture, call beginRecording() and then draw into the Canvas that is returned.
See Code Examples for other Android Picture Methods: