Android PictureDrawable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PictureDrawable class.

This code example shows how to use the following methods:
    /** 
     * Create a picture drawable from the SVG. 
     * @return the PictureDrawable. 
     */ 
    public PictureDrawable createPictureDrawable() { 
        return new PictureDrawable(picture); 
//        return new PictureDrawable(picture) { 
//            @Override 
//            public int getIntrinsicWidth() { 
//                if (bounds != null) { 
//                    return (int) bounds.width(); 
//                } else if (limits != null) { 
//                    return (int) limits.width(); 
//                } else { 
//                    return -1; 
//                } 
//            } 
// 
//            @Override 
//            public int getIntrinsicHeight() { 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getIntrinsicHeight, getIntrinsicWidth, getPicture
This code example shows how to use the following methods:
This code example shows how to use the following methods:setBounds, getIntrinsicHeight, getIntrinsicWidth
			pd = new PictureDrawable(this.drawSpot());
			break; 
		case 21: 
			width = 20;
			height = 44;
			pd = new PictureDrawable(this.drawSpot());
			break; 
		case 22: 
			width = 32;
			height = 70;
			pd = new PictureDrawable(this.drawSpot());
			break; 
		default: 
			//pd = new PictureDrawable(this.drawPointer()); 
			pd = new PictureDrawable(this.drawSpot());
			break; 
		} 
		pd.setBounds(-(int) Math.ceil(pd.getIntrinsicWidth() / 2),
				-(int) Math.ceil(pd.getIntrinsicHeight() / 2),
				(int) Math.ceil(pd.getIntrinsicWidth() / 2),

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBounds, draw
    } 
 
    public BitmapDrawable createBitmapDrawable(Context context, SVG svg) {
        Bitmap bitmap = Bitmap.createBitmap(svg.getPicture().getWidth(), svg.getPicture().getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        PictureDrawable drawable = new PictureDrawable(svg.getPicture());
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return new BitmapDrawable(context.getResources(), bitmap);
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 *  
	 * @return the PictureDrawable. 
	 */ 
	public PictureDrawable getDrawable() { 
		if (drawable == null) { 
			drawable = new PictureDrawable(picture); 
		} 
		return drawable; 
		// return new PictureDrawable(picture) { 
		// @Override 
		// public int getIntrinsicWidth() { 
		// if (bounds != null) { 
		// return (int) bounds.width(); 
		// } else if (limits != null) { 
		// return (int) limits.width(); 
		// } else { 
		// return -1; 
		// } 
		// } 
		// 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    /** 
     * Create a picture drawable from the SVG. 
     * @return the PictureDrawable. 
     */ 
    public PictureDrawable createPictureDrawable() { 
        return new PictureDrawable(picture); 
//        return new PictureDrawable(picture) { 
//            @Override 
//            public int getIntrinsicWidth() { 
//                if (bounds != null) { 
//                    return (int) bounds.width(); 
//                } else if (limits != null) { 
//                    return (int) limits.width(); 
//                } else { 
//                    return -1; 
//                } 
//            } 
// 
//            @Override 
//            public int getIntrinsicHeight() { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPicture
                mCanvas.drawBitmap(b.getBitmap(), mat, null);
            } catch (ClassCastException e) {
                try { 
                    PictureDrawable p = (PictureDrawable)drawable;
                    mCanvas.concat(mat);
                    mCanvas.drawPicture(p.getPicture());
                    mat.invert(mat);
                    mCanvas.concat(mat);
                } catch (ClassCastException e2) {
                } catch (UnsupportedOperationException e3) { // GLES20Canvas, >=api11
                    e.printStackTrace();
                    if (mView != null) {                    // 改为软实现后下次绘制才生效
                        mView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                    } 
                } 
            } 
        } 
    } 
     
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android PictureDrawable Questions & Answers:

See Code Examples for Android PictureDrawable Methods: