Canvas/Bitmap Save function is very distorted

Problems with Canvas, OpenGL, etc...

Canvas/Bitmap Save function is very distorted

Postby jumpoutofatree » Tue Mar 29, 2011 11:11 pm

Image

So kind of a little kink in my bitmap save... Any clues? here's the code...

Code: Select all
            case R.id.saveBtn:
                final Activity currentActivity  = this;
                Handler saveHandler = new Handler(){
                    @Override
                    public void handleMessage(Message msg) {
                        final AlertDialog alertDialog = new AlertDialog.Builder(currentActivity).create();
                        alertDialog.setTitle("Saved 1");
                        alertDialog.setMessage("Your drawing had been saved.");
                        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                return;
                            }
                        });
                        alertDialog.show();
                    }
                } ;
               new ExportBitmapToFile(this,saveHandler, drawingSurface.getBitmap()).execute();
            break;


I hope that's all the code you need otherwise it could get hairy... any clues are much appreciated.

-Robert
jumpoutofatree
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Mar 23, 2010 4:48 pm
Location: Gainesville, Florida

Top

Re: Canvas/Bitmap Save function is very distorted

Postby raj_J2ME » Wed Mar 30, 2011 8:09 am

Are you getting any error/exception while you are clicking the button of which you have shared the code?

Please explain the issue in much more details,
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Canvas/Bitmap Save function is very distorted

Postby jumpoutofatree » Wed Mar 30, 2011 2:41 pm

No the whole canvas drawing thing is working fine but when i try to save the canvas it to my sdcard it comes out looking like that.
jumpoutofatree
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Mar 23, 2010 4:48 pm
Location: Gainesville, Florida

Re: Canvas/Bitmap Save function is very distorted

Postby raj_J2ME » Thu Mar 31, 2011 8:48 am

jumpoutofatree wrote:No the whole canvas drawing thing is working fine but when i try to save the canvas it to my sdcard it comes out looking like that.

What that is stand for?
Please come with some detailed reply in order to get the exact answer.
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Canvas/Bitmap Save function is very distorted

Postby jumpoutofatree » Thu Mar 31, 2011 3:47 pm

Do you not see the picture? The picture is what i'm talking about when i export the drawing canvas to an image file saved on my sdcard. It comes out very distorted. I am not sure what is wrong with it.
jumpoutofatree
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Mar 23, 2010 4:48 pm
Location: Gainesville, Florida

Re: Canvas/Bitmap Save function is very distorted

Postby FARRUKH ATTIQUE » Mon Sep 05, 2011 12:06 pm

i have the same problem and still no solution. i think when we draw on canvas . our running thread draw another canvas over the canvas on which we draw and when we save it looks like that some part of bitmap is missing....... realy need some solution.....please
FARRUKH ATTIQUE
Freshman
Freshman
 
Posts: 3
Joined: Wed Aug 24, 2011 6:11 am

Top

Re: Canvas/Bitmap Save function is very distorted

Postby FARRUKH ATTIQUE » Mon Sep 12, 2011 5:55 am

FARRUKH ATTIQUE wrote:i have the same problem and still no solution. i think when we draw on canvas . our running thread draw another canvas over the canvas on which we draw and when we save it looks like that some part of bitmap is missing....... realy need some solution.....please




i found the solution ............................. in ur surface view u have a method _run
to run the background thread to lock and unlock the canvas. you have an (if (mBitmap ==null)
{
create bitmap;
})
condition there
you have to remove this condition which will allow the program to create new bitmap every time this problem will be solved :D
:D :D :D :D :D :D :D :D :D :D :D :D
FARRUKH ATTIQUE
Freshman
Freshman
 
Posts: 3
Joined: Wed Aug 24, 2011 6:11 am

Top

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

Who is online

Users browsing this forum: No registered users and 5 guests