Board index » delphi » Painting a bitmap pixel by pixel

Painting a bitmap pixel by pixel

Hi,

I generate images from microscope digital pictures and want to display them
in Delphi forms. I can calculate quickly enough the color of each individual
pixel of the image to show. The problem is that if I transfer that, pixel by
pixel, into the Pixels table of a Canvas that takes forever. As a result my
new Windows 95 / Delphi version is considerably slower than my old DOS /
TP6.0 one.

Any idea ?

Thank you

JB
jban...@infonie.fr

 

Re:Painting a bitmap pixel by pixel


Quote
Jacques Barbet wrote:
> I generate images from microscope digital pictures and want to display them
> in Delphi forms. I can calculate quickly enough the color of each individual
> pixel of the image to show. The problem is that if I transfer that, pixel by
> pixel, into the Pixels table of a Canvas that takes forever. As a result my
> new Windows 95 / Delphi version is considerably slower than my old DOS /
> TP6.0 one.

You can use the Canvas.CopyRect method, or from the Windows API the
BitBlt function.

Re:Painting a bitmap pixel by pixel


Quote
> Jacques Barbet wrote:
> > I generate images from microscope digital pictures and want to display them
> > in Delphi forms. I can calculate quickly enough the color of each individual
> > pixel of the image to show. The problem is that if I transfer that, pixel by
> > pixel, into the Pixels table of a Canvas that takes forever. As a result my
> > new Windows 95 / Delphi version is considerably slower than my old DOS /
> > TP6.0 one.

> You can use the Canvas.CopyRect method, or from the Windows API the
> BitBlt function.

I'm sorry, this was probably not a very useful hint. You'd still have to
fill an invisible bitmap in memory pixel by pixel. That will take just
as long... I can't think of a fast way at the moment, sorry.

Re:Painting a bitmap pixel by pixel


Quote
Jacques Barbet wrote in message <909175791.92131@si2-paris>...
>I generate images from microscope digital pictures and want to display them
>in Delphi forms. I can calculate quickly enough the color of each individual
>pixel of the image to show. The problem is that if I transfer that, pixel by
>pixel, into the Pixels table of a Canvas that takes forever. As a result my
>new Windows 95 / Delphi version is considerably slower than my old DOS /
>TP6.0 one.

Assuming you have Delphi 3 or 4, you can use the Scanline property of a
bitmap for quick access to pixel data.  The format of a Scanline is defined
by the PixelFormat property.

For a list of examples of Scanline for each PixelFormat, look for "Scanline"
under "TBitmap" at
www.infomaster.net/external/efg/Library/Delphi/Graphics/VCLRTL.htm

There is a draft update of a article I wrote about Scanline at:
http://www.infomaster.net/external/efg/ImageProcessing/Scanline.htm
I hope to finish updating this article this weekend.

efg
_________________________________________
efg's Computer Lab:  http://infomaster.net/external/efg

Earl F. Glynn                 E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

Other Threads