Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

Scaling Bitmaps

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Oliphant - 01 Oct 2007 19:48 GMT
I'm using the Bitmap class which has built in scaling for images been drawn
not at their original size. And it works amazing well, and I'm VERY
impressed!

However. Is there perchance more than one method this uses that can be
selectable? The one it uses is GREAT for photos, it kind of 'blurs' stuff
together so it never pixelates.

But I also have an image for which I wish it would just make the pixels
'larger'. That is, its an image with only black and white pixels, so when I
scale it to twice its size on each axis, I'd prefer in THIS case for it to
just reproduce the original image with each pixel now being 2x2 instead of
1x1.

I can easily write such a conversion, but was wondering if it too might be
built in as an option on HOW (the method used for) scaling is done. That is,
if it exists, I might as well not reinvent the wheel!

Are their such scaliing options built in?

Thanks for responses in advance!

[==P==]

PS - I'm using MS VC++ 2005 Express (an amazing language for FREE!!!!)
creating /clr managed code...
Carl Daniel [VC++ MVP] - 02 Oct 2007 01:46 GMT
> I'm using the Bitmap class which has built in scaling for images been
> drawn not at their original size. And it works amazing well, and I'm
[quoted text clipped - 22 lines]
> PS - I'm using MS VC++ 2005 Express (an amazing language for FREE!!!!)
> creating /clr managed code...

The .NET Bitmap class used GDI+ under the covers to do all of the heavy
lifting.  Most of the raw interface ot GDI+ is exposed through the
System.Drawing.Graphics class.  You can use the CompositingQuality property
of the Graphics class to choose between several different modes, one of
which is "HighSpeed", which should do no smoothing.

You need to make sure that when you say 2X you really mean 2X, but if your
target image size is exactly 2X in each dimension, and you've specified
CompositingQuality.HighSpeed, I would expect that you'll get simple pixel
doubling.  I'm not sure that GDI+ guarantees that, however, so you'll have
to experiment to see if it'll do what you want.

Hope that helps - Since you didn't say exactly what you're doing to cause
the image to be scaled, I may be leading you down the wrong path!

-cd
Peter Oliphant - 02 Oct 2007 18:22 GMT
Hi Carl!

Not to worry, you steered me down the absolutely CORRECT path! That was
EXACTLY what I was looking for! Thanx!  : )

[==P==]

>> I'm using the Bitmap class which has built in scaling for images been
>> drawn not at their original size. And it works amazing well, and I'm
[quoted text clipped - 39 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.