image quality problem
- From: ex-neo-con@xxxxxxxxxx
- Date: Tue, 17 Jan 2006 17:58:26 -0800
I've been attempting to draw a simple equilateral
triangle with 10 tick marks on each side. I'm able
to draw one that looks fine on a monitor, but the same
triangle looks lousy when I print it. What am I missing?
Here's the code:
Bitmap bmp = new Bitmap(600, 600);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillRectangle(Brushes.White, 0.0f, 0.0f, 600.0f, 600.0f);
g.TranslateTransform(50.0f, 50.0f);
Pen p = new Pen(Color.Black, 3.0f);
float sideLength = 500.0f;
float cos60 = 0.5f;
float sin60 = (float) Math.Sin(60);
float height = (float) (sin60 * sideLength);
PointF p1 = new PointF(0.0f, 0.0f);
PointF p2 = new PointF((float)(sideLength * 0.5f), height);
PointF p3 = new PointF(sideLength, 0.0f);
g.DrawLine(p, p1, p2);
g.DrawLine(p, p2, p3);
g.DrawLine(p, p3, p1);
float hDivision = sideLength * 0.1f;
float vDivision = height * 0.1f;
float c = 5.0f;
for (float x = hDivision, y = vDivision;
x < sideLength; x += hDivision, y += vDivision) {
PointF top = new PointF(x, -c);
PointF bottom = new PointF(x, c);
g.DrawLine(p, top, bottom);
top = new PointF(0.5f * x - c * sin60, y + c * cos60);
bottom = new PointF(0.5f * x + c * sin60, y - c * cos60);
g.DrawLine(p, top, bottom);
top = new PointF(sideLength - (0.5f * x - c * sin60),
y + c * cos60);
bottom = new PointF(sideLength - (0.5f * x + c * sin60),
y - c * cos60);
g.DrawLine(p, top, bottom);
}
//Yes, I've tried all sorts of image formats...
bmp.Save("Triangle.wmf", System.Drawing.Imaging.ImageFormat.Wmf);
g.Dispose();
Incidentally, I've also tried drawing the lines using RotateTransform,
and the quality was even worse!
ex-neo-con
.
- Follow-Ups:
- Re: image quality problem
- From: Mike
- Re: image quality problem
- Prev by Date: Drawing on a MonthCalendar control
- Next by Date: Re: Does Image.FromFile alway produce a bitmap no mater the format of the file?
- Previous by thread: Drawing on a MonthCalendar control
- Next by thread: Re: image quality problem
- Index(es):
Relevant Pages
|