开发者

Android fingerpaint canvas color

开发者 https://www.devze.com 2023-01-30 03:14 出处:网络
I\'m messing about with Fingerpaint.java in the SDK http://developer.android.com/re开发者_如何学运维sources/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.html

I'm messing about with Fingerpaint.java in the SDK http://developer.android.com/re开发者_如何学运维sources/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.html

I've made a few adjustments to where I can save the bitmap and reopen to edit it later. Got that all working. Only issue is the canvas color on the saved copy is black rather than the color I set it too which means the canvas color when I go into edit is also black. I load my saved bitmap as such: The rest of the file is more or less the same as the one in the SDK. I'm just trying to figure out how I can get my canvas back to the desired color as when I first created it.

    public MyView(Context c) {
        super(c);           
        Bundle extras = getIntent().getExtras();
        imageURI = extras.getString(Intent.EXTRA_SUBJECT);
        mBitmap = BitmapFactory.decodeFile(imageURI);
        Drawable d = new BitmapDrawable(mBitmap);
          Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
          Canvas canvas = new Canvas(bitmap);
          d.setBounds(0, 0, width, height);
          d.draw(canvas);
          mBitmap = bitmap;
          mCanvas = canvas;
          mPath = new Path();
          mBitmapPaint = new Paint(Paint.DITHER_FLAG);  
    }


Nevermind, it was the way it was being saved. Fixed now

0

精彩评论

暂无评论...
验证码 换一张
取 消