Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Canvas->Pixels[x][y] annoyance (C++) | New poll | | |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Smallhacker Super Koopa I AM A Group Of Officially Frustrated Younglings, G.O.O.F.Y. MEMBER |
| ||
(In case you wonder, I'm using Borland C++)
I've got a problem with TImages, or maybe more specific, TCanvas. When I've, for instance, loaded graphics from a ROM and want to draw it onto a TImage on the screen, I'm using ImageBlah->Canvas->Pixels[x][y]=omgcolor; for every pixel in the image. However, for some reason, Pixels[][] seems to be very slow when working with TImages, making real-time programs impossible. Is there a way to speed it up, or is there an even better way to draw stuff to a TImage? Maybe there's even better choices than TImages? Some help would be nice. |
|||
rubixcuber Mole Since: 09-08-06 From: St. Louis, MO Last post: 6410 days Last view: 6410 days |
| ||
Most methods for accessing the value of a single pixel are usually incredibly slow. What you want to do is a block transfer. I don't know if TImage has support for that or not. I would recommend just using HBITMAPs with DIB sections. That way you can create an array of all of the color values and then load it into the image. | |||
Dan Purple Leever Since: 11-18-05 Last post: 6310 days Last view: 6301 days |
| ||
I'm gonna assume you're using C++ Builder, as those sound like VCL classes to me. There should be a Scanline property in TCanvas, which is used for faster access.
Also, you could maybe try looking into the Graphics32 library, as it allows easy access via Pixels[x,y] and is reasonably fast. |
|||
Smallhacker Super Koopa I AM A Group Of Officially Frustrated Younglings, G.O.O.F.Y. MEMBER |
| ||
Hm... Thanks for the suggestions. |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Canvas->Pixels[x][y] annoyance (C++) | | |