Home » U++ Library support » U++ Core » Handle a RGBA* with ImageBuffer
Handle a RGBA* with ImageBuffer [message #28930] |
Tue, 28 September 2010 08:25 |
|
koldo
Messages: 3361 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
I have got a RGBA * from SDL with the same structure than ImageBuffer.
Is it possible to set that RGBA * to ImageBuffer so that U++ drawing functions can be used over it?
Best regards
Iñaki
|
|
|
|
Re: Handle a RGBA* with ImageBuffer [message #28956 is a reply to message #28931] |
Wed, 29 September 2010 10:18 |
|
koldo
Messages: 3361 Registered: August 2008
|
Senior Veteran |
|
|
Hello Mirek
Well, no problem, as it seems the pixels are not formatted exactly the same.
Finally I have focused this way. This a sample:
player.WhenFrame = THISBACK(OnFrame); // OnFrame user function to be called every time there is a new video frame
...
void OnFrame(SDLSurface &surface) { // SDLSurface is a new class to handle SDL painting. surface includes the video frame bitmap
ImageDraw iw(100, 40); // Sample U++ paint
iw.DrawEllipse(0, 0, 100, 40, Green());
iw.DrawText(35, 10, "U++", Arial(18).Bold(), Black());
surface.Lock();
surface.DrawImage(iw, 20, 20, Black()); // Copy the drawn U++ to SDL
surface.DrawLine(0, 0, surface.GetWidth(), surface.GetHeight(), White()); // Directly draw other things
surface.Unlock();
}
Result:
-
Attachment: dib.PNG
(Size: 116.07KB, Downloaded 283 times)
Best regards
Iñaki
|
|
|
Goto Forum:
Current Time: Thu May 16 19:03:48 CEST 2024
Total time taken to generate the page: 0.01670 seconds
|