how to Draw in a canvas in put it in a Bitmap?

Problems with Canvas, OpenGL, etc...

how to Draw in a canvas in put it in a Bitmap?

Postby rjuy » Mon Jan 03, 2011 3:52 am

Hello!

Can somebody help me in drawing for example : Circle, Line or Rect inside a Bitmap?

I have a code but its not working.

Please see below.

Code: Select all
@Override
protected void onDraw(Canvas canvas) {
           
           Canvas can = canvas;

           // Draw the background...
      Paint background = new Paint();
      background.setColor(color);
         
      Bitmap mBitmap = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
           canvas = new Canvas(mBitmap);
       
           can.drawRect(0, 0, getWidth(), getHeight(), background);
      canvas.drawBitmap(mBitmap, null, new Paint());
}


I need to put what I've drawn in a Bitmap because I need it in saving what i've drawn in the later part of my school project.

Please help me guys.

thanks

-Jason
rjuy
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Oct 25, 2010 2:38 am

Top

Re: how to Draw in a canvas in put it in a Bitmap?

Postby FredyFoxX » Mon Jan 17, 2011 10:59 pm

FredyFoxX
Freshman
Freshman
 
Posts: 5
Joined: Fri Jan 07, 2011 8:28 pm

Re: how to Draw in a canvas in put it in a Bitmap?

Postby rjuy » Tue Jan 18, 2011 9:41 pm

thanks on this
rjuy
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Oct 25, 2010 2:38 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest