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
[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 - Scramble a bitmap image

Scramble a bitmap image

All your problems with Audio, Video and Images.

Scramble a bitmap image

Postby jtwoods4 » Sun May 09, 2010 7:26 am

I am new to android development. I have been asked to write an function to scramble a bitmap image. A user can then enter a password and the image will unscramble.

I have managed to write the following code that works but takes way to long to execute due to the setPixels call.

I was thinking of an alternate solution of just drawing the original unscrambled image and then making some sort of transparent overlay bitmap with some sort of distortion effect. When the user enters the correct password the overlay fades away.

Please help!

@Override
protected void onDraw(Canvas canvas)
{
//Some of the variables are global but I left out that code. This successfully runs.

int w = bitmap.getWidth();
int h = bitmap.getHeight();

Bitmap scrambled = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
int[]pixels = new int[w*h];

bitmap.getPixels(pixels, 0, w, 0, 0, w, h);

int color = 0;
Random random = new Random();

Paint paint = new Paint();

for (int i = 0; i < pixels.length; i++)
{
pixels[i] = pixels[random.nextInt(pixels.length - 1)];
}

scrambled.setPixels(pixels, 0, w, 0, 0, w, h);
canvas.drawBitmap(scrambled, 0, 0, paint);
}
jtwoods4
Once Poster
Once Poster
 
Posts: 1
Joined: Fri May 07, 2010 4:11 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 6 guests