how to create punch effect on picture
Login to reply to this topic.
Sat, 2009-01-10 08:31
Joined: 2008-12-15
Forum posts: 1

hi everyone ...

i want to create some effect such as black and white , punch and swirl etc on my picture ............

i m using S 60 3 rd edition ..........

plz tell me which are the api supported ......


Fri, 2009-01-16 14:19
Joined: 2004-11-29
Forum posts: 1419

There is no functions available to do those particular image effects.
You'd have to write those yourself, or if you have or find some library that implement it, its probably easy to port.

You also need raw access to the image data. (the pixel buffer)

That you can easily do along this pattern:

void DoEffect(CFbsBitmap* aBmp)
{
         aBmp->LockHeap();
         TUint8* data = aBmp->DataAddress();
         TInt stride = aBmp->DataStride();
         TInt size = aBmp->SizeInPixels();

         for(TInt y = 0; y < size.iHeight; y++) {
            TUint32* scanline = (TUint32*)data;
            for(TInt x = 0; x < size.iWidth; x++) {
                 //Get pixel
                 TUint32 pixel = scanline[x]; 
                 //Get color channels
                 TUint8 a = (pixel>>24)&0xff;
                 TUint8 r = (pixel>>16)&0xff;
                 TUint8 g = (pixel>>8)&0xff;
                 TUint8 b = (pixel>>0)&0xff;
                  // Do effect
                  // ...
                 
                 //Write back pixel (if you changed it. some effects will need a 2nd destination bitmap you write in instead)
                 scanline[x] = pixel;
            }
            data += stride;
         }
        aBmp->UnlockHeap();
}

Above code is for EColor16MA 32 bit color format with alpha (per pixel transparency)
For other formats, the cast and extracting color channels will differ.


copyright 2003-2009 NewLC SARL