|
|
User login
Feeds |
Paint on the screen a bitmap generated dinamically
|
|||||
| Thu, 2005-01-20 22:34 | |
|
Hello everybody
![]() I have to port a Win32 C++ application that creates bitmaps dinamically and then paints this bitmaps on the screen. The application uses a timer to refresh the screen with the bitmap generated dinamically. The bitmap is stored in a buffer in memory pointed by a char *. The application paints the bitmap on the screen using a Win32 API: int StretchDIBits( HDC hdc, // handle to DC int XDest, // x-coord of destination upper-left corner int YDest, // y-coord of destination upper-left corner int nDestWidth, // width of destination rectangle int nDestHeight, // height of destination rectangle int XSrc, // x-coord of source upper-left corner int YSrc, // y-coord of source upper-left corner int nSrcWidth, // width of source rectangle int nSrcHeight, // height of source rectangle /////////////////////////////////////////////////////////// // This is the buffer that stores the bitmap ///////////////////////////////////////////////////////// CONST VOID *lpBits, // bitmap bits CONST BITMAPINFO *lpBitsInfo, // bitmap data UINT iUsage, // usage options DWORD dwRop // raster operation code ); I studied one possibility: Convert the buffer to a CFbsBitmap with the Image Conversion Library and then paint the bitmap using Symbian Graphics API. But I think that there is a problem: The conversion is asyncronous. Do you think that I will have performance problems?? The callback timer function will have to: 1. Generate the bitmap (Existing task) 2. Convert it (New and asyncronous Task) 3. Paint the bitmap (Existing Task) What do you recomend me??? Please, help me ![]() |
|
Forum posts: 25
I only want to clarify that I'm totally new to graphics programming.
All your help will be very appreciated.
Forum posts: 26
Ok - I have little experiance of Symbian C++ also, but I thought - why don't you modify your bitmap creation routine to make a CFbsBitmap in the first place, rather than write it in one format then convert it to CFbsBitmap afterwards?
You could use CFbsBitmap.SetScanLine(), or CFbsBitmap.DataAddress() then fill in the data.
As for the async performance - that depends on how frequently you wish to be able to perform this operation. For non-game code it should be fine I'd think.
I'm sure someone with more Graphics knowledge could help...
Scarfman007
Forum posts: 25
Ok - I have little experiance of Symbian C++ also, but I thought - why don't you modify your bitmap creation routine to make a CFbsBitmap in the first place, rather than write it in one format then convert it to CFbsBitmap afterwards?
You could use CFbsBitmap.SetScanLine(), or CFbsBitmap.DataAddress() then fill in the data.
As for the async performance - that depends on how frequently you wish to be able to perform this operation. For non-game code it should be fine I'd think.
I'm sure someone with more Graphics knowledge could help...
Scarfman007
Hello!!!
I have tried drawing the bitmap directly to the frame buffer of the video hardware and I have got good results, but I prefer to use CFbsBitmap because I will need some Symbian graphics API to scale the bitmap.
I think that using CFbsBitmap.DataAddress() is the best choice ... but the problem is that I don`t know the internal format of a CFbsBitmap that uses EGray256 display mode.
The application uses bitmaps with 256 grayscale (a bitmap is an array of bytes, in which each byte represents a pixel). How can I write pixels to a CFbsBitmap using DataAddress()??
Thank you very much!