Create Image from Drawing
Moderators: SDS, support, admin
Create Image from Drawing
Hello,
is there a possibility to set the DPI for the CADImage.Draw(graphics, rectangleF) method. I'd like to export a given CADImage to an in memory BMP and use it for a custom printing system. At the moment i just can print in low / screen resolution.
My Code:
using
bmp.SetResolution(dpi, dpi);
doesn't work because the image DPI are changed, but the real size also changes. I can fix this by changing the bmp image, but the CADIMAGE seems to be drawn in ~96DPI.
Thank you for your help,
Roman
is there a possibility to set the DPI for the CADImage.Draw(graphics, rectangleF) method. I'd like to export a given CADImage to an in memory BMP and use it for a custom printing system. At the moment i just can print in low / screen resolution.
My Code:
Code: Select all
RectangleF imageRect = cadEditorControl1.ImageRectangleF;
Bitmap bmp = new Bitmap(cadEditorControl1.PictureBox.Size.Width, cadEditorControl1.Size.Height);
Graphics g = Graphics.FromImage(bmp);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.SmoothingMode = SmoothingMode.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
cadEditorControl.Image.Draw(g, imageRect);
//=> my printing system:
CadPrinter p = new CadPrinter(bmp);
bmp.SetResolution(dpi, dpi);
doesn't work because the image DPI are changed, but the real size also changes. I can fix this by changing the bmp image, but the CADIMAGE seems to be drawn in ~96DPI.
Thank you for your help,
Roman
Re: Create Image from Drawing
Hello roman.
Sorry, we're not sure that is the problem with printing. CADImage.Draw outputs the image with sizes in pixels, but DPI for Graphics object have specified values still. The physical sizes for printing can be calculated based on sizes in pixels and DPI.
Alexander.
Sorry, we're not sure that is the problem with printing. CADImage.Draw outputs the image with sizes in pixels, but DPI for Graphics object have specified values still. The physical sizes for printing can be calculated based on sizes in pixels and DPI.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support