Groups | Blog | Home
all groups > dotnet drawing api > june 2005 >

dotnet drawing api : getting around DrawImageUnscaled problem



Rachel Suddeth
6/8/2005 11:33:22 AM
Earlier I had an issue where I tried to use DrawImageUnscaled, but it didn't
work because apparently .NET does not understand the resolution of my
images. So I got around this by always calling DrawImage with Source and
Destination rectangles, and specifiying GraphicsUnit.Pixel.

Now I've got a new job that has a lot of requirements will be just plain
easier to do if I can use the matrix/transformation stuff. But it seems
these are meant to go with DrawImageUnscaled. Do I have that right? Because
I'll be asking the graphics library to handle scaling (and rotating and
translating.)

So I'm thinking if I read the image, and use DrawImage (specifiying
GraphicsUnit.Pixel) to draw a copy of it in memory, using the original size
of the bitmap as the size for the destination rectangle. Then, I think the
library should understand the resolution of the copy (after all, it drew the
copy.) And after that, I can use transformations to do whatever I want and
DrawImageUnscaled will draw with the correct size.

Does that sound like it will work? Or do I have a bad assumption here
somewhere?

-Rachel

Rachel Suddeth
6/8/2005 1:59:34 PM
[quoted text, click to view]

Is there a way to use DrawImage to specify GraphicsUnit without having to
give source and destination information? Because if I have to calculate
source and destination, I've gained little by using the transformation.
Besides, I'm not even sure what to give for them if I apply a
transformation.

-Rachel

Chris Taylor
6/8/2005 9:33:17 PM
The transformation matrix work just fine with DrawImage.

--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor


[quoted text, click to view]

Bob Powell [MVP]
6/8/2005 10:30:46 PM
No, You'll have to specify source, destination and graphics unit.

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

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