| Reply | « Previous Thread | Next Thread » |
|
hi...
Is there a way to get the rgb values from the following byte[]? byte[] pngImage = videoControl.getSnapshot("encoding=png&width=240&height=180"); I know, it's possible with MIDP 2.0 or the Nokia UI API. But is there a way to do this with the MIDP 1.0 and the MMAPI? Thanks for your help! (I'm using the Nokia 3650) |
|
* DirectGraphics.drawImage( pngImage );
* short[] argbValues = new short[size]; * DirectGraphics.getBytes( argbValues, blah... blah, DirectGraphics.TYPE_USHORT_4444_ARGB); Extract with: short sample = argbValues[index]; int alpha = (sample>>12); int red = ((sample>>8)&0x000F); int green = ((sample>>4)&0x000F); int blue = (sample&0x000F); |
|
That's the Nokia UI way.
MIDP 1.0 offers no method for this. shmoove |
|
Appearatly I didn't read the question well enough. You are right (ofcourse:).
gr, Danny |
|
Well, this isn't a solution to what you asked. Actually this is not a solution at all :)
I was wondering if the snapshot taken in BMP-format is uncompressed. If so, you could easily get the RGB-values from it. ? |
|
Yes... I think snapshot taken in BMP-format is uncompressed. But for getting the RGB-values, I need the exactly header-data length from this bmp format.
|
|
Then you have to look in to the PNG specs. You must implement the Z-lib functionality yourself.
BTW is that video capturing also a pure MIDP1.0 solution? Or is it Nokia specific? gr, Danny |
|
should be a pure MIDP 1.0 solution....
|
|
Would it be possible to implement z-lib? may also be usefull for creating (really) mutable MIDP1.0 Images... Advantage is indeed that it doesn't need to implement the compression algorithms.
PNG header stuff seams to be quite easy...
Last edited by dannyc4 : 2003-10-21 at 00:40.
|
|
Yes, it's technically possible to generate a non-compressed PNG. I wrote a function that generates a transparent PNG with x/y size specified by parameters.
The biggest problem with generating viewable PNGs is that you need to calculate the checksum, so you at least need to include the Adler32 CRC algorithm. Keep in mind that this method is going to be very memory-intensive, though. Wes |
|
Hi,
I'm trying to build a png out of a bmp. I need a fast and small zlib compression code (with compression 0). I already have all the other stuffs (crc32, header, filters...). Could someone help me / give me code :-) / tell me where to find a good documentation? Marc Belmont |
| marcbelmont |
| View Public Profile |
| Find all posts by marcbelmont |
|
Hi allypone,
You told its possible in MIDP2.0 to get rgb values from byte[] array. Can you please tell me how to do that? Thanks, Amritendu |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|