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 / C# / September 2007

Tip: Looking for answers? Try searching our database.

Show Me The Pixel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martijn Mulder - 17 Sep 2007 12:25 GMT
When I zoom in on an image, GDI+ automatically smoothens the edges
between the pixels. I am looking for a way to see the individual pixels
as squares in the enlarged image, like in MSPaint. I searched in vain in
the enumerations System.Drawing.Drawing2D.SmoothingMode and
System.Drawing.Drawing2D.InterpolationMode to find the constant that
does just that. How?
Martijn Mulder - 17 Sep 2007 14:23 GMT
Martijn Mulder schreef:
> When I zoom in on an image, GDI+ automatically smoothens the edges
> between the pixels. I am looking for a way to see the individual pixels
> as squares in the enlarged image, like in MSPaint. I searched in vain in
> the enumerations System.Drawing.Drawing2D.SmoothingMode and
> System.Drawing.Drawing2D.InterpolationMode to find the constant that
> does just that. How?

Some code to illustrate the problem:

using System.Drawing;
using System.Windows.Forms;
class MyForm:Form
{
 override protected void OnPaint(PaintEventArgs a)
 {
  Bitmap bitmap=new Bitmap(2,2);
  Graphics graphics=Graphics.FromImage(bitmap);
  graphics.Clear(Color.Green);
  graphics.DrawLine(Pens.Red,1,1,2,2);
  graphics.Dispose();
  a.Graphics.DrawImage
  (
   bitmap,
   new Rectangle(0,0,200,200),
   new Rectangle(0,0,2,2),
   GraphicsUnit.Pixel
  );
 }
 [System.STAThread]
 static void Main()
 {
  Application.Run(new MyForm());
 }
}
Peter Duniho - 17 Sep 2007 18:44 GMT
> When I zoom in on an image, GDI+ automatically smoothens the edges
> between the pixels. I am looking for a way to see the individual pixels
> as squares in the enlarged image, like in MSPaint. I searched in vain in
> the enumerations System.Drawing.Drawing2D.SmoothingMode and
> System.Drawing.Drawing2D.InterpolationMode to find the constant that
> does just that. How?

I don't understand the statement "searched in vain".  How did you
search?  When I type in "InterpolationMode" into the MSDN web site
search box, this is the first page that is listed in the search results:

http://msdn2.microsoft.com/en-us/library/system.drawing.drawing2d.interpolationm
ode.aspx


I don't know for sure that any mode will do exactly what you want.  But
you might want to try InterpolationMode.NearestNeighbor.  That might do it.

Pete

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.