×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Conversion of CFbaBitmap to QImage /QPixmap ????

    Hi

    I need to write a Qt adaptive layer over a S60 Engine which generates thumbnails od images present.I have few doubts related to that--

    1)Should I convert the CFbsBitmap to QImage or QPixmap ?
    2)How to Convert CFbsBitmap to QImage / QPixmap ?

    Thanks in Advance
    -K

  2. #2
    Registered User
    Join Date
    Dec 2007
    Location
    Oslo
    Posts
    12

    Re: Conversion of CFbaBitmap to QImage /QPixmap ????

    The Qt/S60 port is currently using Qt's raster graphics system which means that in this case QPixmap is using a QImage internally to store the rasterized data. So basically the performance difference here is neglible.

    QImage is the class that gives you a pointer to the internal data though and let's you write pixels directly whereas QPixmap does not have this functionality because the idea is that the data could potentially be owned by a window manager on the various platforms and potentially stored in graphics memory. So QImage is the class you want to use (you can use QPixmap::fromImage() after if you really want a QPixmap).

    Basically it does something like this (I didn't test this, but should work):

    Code:
    cfbsBitmap->LockHeap(); 
    
    TDisplayMode mode  = cfbsBitmap->DisplayMode();
    // Add a switch case here to map a TDisplayMode -> QImage::Format
    QImage::Format format = ...;
    TSize bitmapSize = cfbsBitmap->SizeInPixels();
    
    // This is the QImage that will hold the CFbsBitmap
    // Next line will malloc (width) X (height) X (depth) bytes.
    QImage image(bitmapSize.iWidth, bitmapSize.iHeight, format);
    
    if (!image.isNull()) {
        // Copy the data from 'src' to 'dest'
        const uchar *src = (const uchar*)cfbsBitmap->DataAddress();
        uchar *dest = image.bits();
        Mem::Copy(dest, sptr, image.numBytes());
    } else {
        // Didn't get memory, deal with it.
    }
    
    cfbsBitmap->UnlockHeap();
    Depending on the use case, you might be able to get away with not copying the data, but leaving the FBSERV in the locked state for an extended period of time is a bad idea.

Similar Threads

  1. Image conversion utility in Series 60 3rd Edition SDK Beta
    By waelali in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-03-03, 17:23
  2. descriptor conversion problem?
    By ipis in forum Symbian
    Replies: 1
    Last Post: 2005-10-19, 10:58
  3. PCM to AMR conversion problem
    By kavijohn in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-02-17, 06:22
  4. CIMD2 Character conversion
    By aftabahmed in forum General Messaging
    Replies: 1
    Last Post: 2004-01-14, 11:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×