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
[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 - Alpha-Channel Manipulation

Alpha-Channel Manipulation

All your problems with Audio, Video and Images.

Alpha-Channel Manipulation

Postby lue » Wed Jun 16, 2010 4:50 pm

Hey!

I'd like to create a Bitmap out of 2 different .jpgs: One with the actual image and one with the alpha information in it. I already wrote something that works but it's a bit slow (500ms for a 169x127 picture). Here's the code:

Code: Select all
public void AddBitmap(Bitmap b, Bitmap alpha) {
      int w = b.getWidth();
      int h = b.getHeight();
      Bitmap bc = b.copy(Config.ARGB_8888, true);
      
      long tick = SystemClock.uptimeMillis();
      
      for (int x = 0; x < w; x++) {
         for (int y = 0; y < h; y++) {
            int a = 255 - (int)(((float)alpha.getPixel(x, y) / (float)-16777216) * (255));
            bc.setPixel(
                  x,
                  y,
                  Color.argb(
                        a,
                        Color.red(b.getPixel(x, y)),
                        Color.green(b.getPixel(x, y)),
                        Color.blue(b.getPixel(x, y))
                        )
                     );
            
         }
      }
      
      GameTime.Time = SystemClock.uptimeMillis() - tick;
      
      Bitmap bnew = bc.copy(Config.ARGB_8888, false);
  _bitmaps.add(bnew);
}


Is there a faster way to do this?

Cheers, lue!
lue
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Jun 16, 2010 4:42 pm

Top

Return to Multimedia Problems

Who is online

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