Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Draw image on top of other image

Draw image on top of other image

All your problems with Audio, Video and Images.

Draw image on top of other image

Postby DaggieBe » Sun Oct 03, 2010 8:00 pm

Hello,

In my application, I download an image from a websever, with:

Code: Select all
            InputStream is = (InputStream) AndroidUtils.fetch(url);

            Bitmap image = BitmapFactory.decodeStream(is);


Now, on that Bitmap I want to draw another image from my local resources. Anyone knows how to do that? I haven't found a createBitmap method that takes 2 sources ..
DaggieBe
Freshman
Freshman
 
Posts: 5
Joined: Tue May 04, 2010 7:46 am

Top

Re: Draw image on top of other image

Postby jonbonazza » Mon Oct 04, 2010 12:31 am

Are you useing ImageViews or Canvas?
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Re: Draw image on top of other image

Postby DaggieBe » Mon Oct 04, 2010 7:20 am

I assume you ask that, because it would be possible to set my downloaded Bitmap as a Drawable to the background on an ImageView and then put the picture I want on top of the downloaded Bitmap?

It would be a (valid) workaround, but I want to actually make a Bitmap that is built from both source images. That way I can send the new Bitmap to mail/twitter/facebook/FTP/...
DaggieBe
Freshman
Freshman
 
Posts: 5
Joined: Tue May 04, 2010 7:46 am

Re: Draw image on top of other image

Postby jonbonazza » Mon Oct 04, 2010 6:29 pm

I asked that because if you were using an ImageView, you could use a FrameLayout with two ImageViews inside of it, then set each ImageView's src property to the downloaded images.

With that said, I am not sure how to 'merge' 2 images programatically...

This is more of a challenge of image manipulation and less of a programming problem.

If you can find the algorithem for merging two images, I am sure you can implement it in your app. Would actually make a very nice Component that you could distribute.
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Re: Draw image on top of other image

Postby tim.choi » Tue Oct 19, 2010 6:01 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Bitmap image1 = BitmapFactory.decodeStream(is1);
  2. Bitmap image2 = BitmapFactory.decodeStream(is2);
  3.  
  4. Bitmap composedImage = Bitmap.creaeBitmap(w,h,Config.ARGB_8888);
  5. Canvas cv=new Canvas(composedImage);
  6. cv.drawBitmap(image1,0,0,null);image1.recycle();
  7. cv.drawBitmap(image2,0,0,null);image2.recycle();
  8.  
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


Then, after those codes, the "composedImage" will contain the image of "image1+image2".
tim.choi
Developer
Developer
 
Posts: 25
Joined: Fri Feb 19, 2010 4:30 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 9 guests