(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-21-24 05:07 AM
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








Since: 11-17-05
From: Söderhamn, Sweden

Last post: 6303 days
Last view: 6301 days
Skype
Posted on 10-28-06 08:30 PM Link | Quote
(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
Posted on 10-31-06 12:08 PM Link | Quote
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
Posted on 10-31-06 06:31 PM Link | Quote
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








Since: 11-17-05
From: Söderhamn, Sweden

Last post: 6303 days
Last view: 6301 days
Skype
Posted on 11-01-06 02:35 AM Link | Quote
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++) |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.019 seconds; used 360.46 kB (max 428.81 kB)