RGB from bitmap

by Andareena Vootog » Tue, 03 Nov 2009 06:05:20 GMT


Sponsored Links
 hi
        if you are using bitmap, use an integer array to store the bitmap.
use bitmap.getPixel() to get the corresponding bitmap in integer array. By
using bitwise rotation operation, we will get RGB values. (Also byte array
can be used). See the code below.

             int[] pix = new int[picw * pich];
            bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

            int R, G, B,Y;

            for (int y = 0; y < pich; y++)
            for (int x = 0; x < picw; x++)
                {
                int index = y * picw + x;
                int R = (pix[index] >> 16) & 0xff;     //bitwise shifting
                int G = (pix[index] >> 8) & 0xff;
                int B = pix[index] & 0xff;

                //R,G.B - Red, Green, Blue
                 //to restore the values after RGB modification, use //next
statement
                pix[index] = 0xff000000 | (R << 16) | (G << 8) | B;
                }



Thanks and Regards,

Andarena Vootog
Vootog Information Systems < http://www.vootog.com > Pvt Ltd.

--



RGB from bitmap

by Jeffrey Blattman » Tue, 03 Nov 2009 06:07:42 GMT


Other Threads

1. Is wav frequency adjustable?

Is there a programmatic way to speedup and slowdown a looping wav file
like there is in directsound? I'm going bling chasing thru the class
references. Thanks.

-- 

2. Looking for Help/Wizard framework or lib

Hi all,

some apps (e.g. Barcode Scanner) have very nice HTML-based help subsystem.
It is basically a scrollable (HTML) container and buttons "Back",
"Forward" and "Done" in the bottom of the screen, which are always
visible.

Is there a public API for that or one has to program such things from scratch?

Thanks
Ilya

-- 

3. Penipu Ulung

4. Images being squashed...

5. How to get Application Label in different languages

6. Help! Milestone saya tidak bereaksi ketika dicolok ke PC

7. 2.0+ emulator doesn't work properly