Groups | Blog | Home
all groups > dotnet drawing api > may 2006 >

dotnet drawing api : Capture and restore a rectangle of pixels FASTEST way


sandrapacino NO[at]SPAM libero.it
5/11/2006 3:40:01 PM
I have a BITMAP, say it's w=200 x h=100 pixels.

I have a rectangle *which has a border* of 3 pixels. (It is not
necessarily all contained in the bitmap. Let say the rectangle is x=
-1, y=50, w=100, h=100 (with a border=3)

I want :
1. to store in memory all the pixels that are covered by the rectangle
(border included).
2. restore to the bitmap all the pixels previously stored in memory

I have tried with get/set pixels, but takes ages.
Could you please show me the FASTEST way to do that.

Thank you very much

-sandra
sandrapacino NO[at]SPAM libero.it
5/11/2006 3:47:30 PM
To be more precise in the statement of my problem, let me add that I am
only interested on the outline pixels.
The pixels internal to the rectangle are of no interest.

Thanks for any help.

-s
Bob Powell [MVP]
5/12/2006 12:00:00 AM
Google for LockBits.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



[quoted text, click to view]

AddThis Social Bookmark Button