This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, December 2, 2005 11:36:04 AM(UTC)
Groups: Registered
Posts: 9
I'm having trouble understanding what is happening when I use set the UseDPI RasterPaintProperty to true.
I've attached a screenshot which shows the form output with the UseDPI setting false side by side with a print preview output with the setting set to True. When printing, however, I set this value to true to take advantage of the printer's higher resolution.
This results in the image being offset and scaled in ways that I don't understand.
Why does the image get altered with the setting enabled?
Here are the paint properties I'm using:
When printing:
props = RasterPaintProperties.Default;
props.UseDpi =
true;
When displaying in form:
props =
new RasterPaintProperties();
props.PaintEngine = RasterPaintEngine.GdiPlus;
Thanks for any advice,
Chad
#2
Posted
:
Tuesday, December 6, 2005 4:41:56 AM(UTC)
Groups: Registered
Posts: 7
With UseDPI = true, one pixel in the image may not correspond to one pixel on the display device (monitor or printer). The image is DPI-adjusted for display.
For example, a standard fax is 100 dpi by 200 dpi. If this image was displayed with UseDPI = false, the image would appear squished. To correct this distortion, each pixel in the image should actually be rendered on the display device as a "pixel" with height twice its width.
Another thing the UseDPI takes into consideration is the DPI setting of the display device, so that real measurements are preserved and that 1-inch in the image, is displayed as 1-inch on the device. If a 300 x 300 DPI image is printed to a printer that's 600 DPI, each pixel in the image would be printed as a square on the printer, 2 pixels by 2 pixels.
What is the DPI of the source image? If the x-dpi and y-dpi are not the same, this may explain some of the distortion you're seeing.
#3
Posted
:
Tuesday, December 6, 2005 4:46:52 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello Chad,
Please read the following from our LEADTOOLS .Net documentation:
" RasterPaintProperties.UseDpi
Property used to get or set a value that indicates whether LEAD's
automated scaling properties are used to account for the physical
resolution of the bitmap. The physical resolution of an image is
measured in dots per inch (DPI). When you load an image, the
XResolution and YResolution properties are updated with the DPI values
for the horizontal and vertical resolution. Some images have different
horizontal and vertical resolutions (for example: 300 by 600). In such
cases, the displayed images will appear elongated if you do not account
for the resolution.
If the values of the
XResolution property and the YResolution property are not equal, set
the RasterPaintProperties.UseDpi property to TRUE to have LEAD's
automated scaling properties account for the physical resolution of the
image".
In other words, when you use
set the UseDPI, the image view at 100% scaling is different than when
usedpi is not set. Having this property makes it easier to use some of
the automated scaling properties and the when the image is painted,
XResolution and YResolution properties will be taken in account.
Also, I can't find any attachments with your post.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#4
Posted
:
Tuesday, December 6, 2005 11:41:32 AM(UTC)
Groups: Registered
Posts: 9
Thanks for the replies. I don't know why the attachment didn't show up but it's not important it just showed some images that were being offset.
Can you tell me how the DPI settings are used when I make a call to IRasterImage::Paint that includes the source rectangle, clipping source rectangle, destination rectangle, and destination clip rectangle?
Do the source rectangles need to be updated to account for the image's DPI settings?
Also, the documentation mentions the destination Graphics object, not the image's DPI settings:
"Enables or disables using the DPI of the destination graphics object when displaying the image."
Do all cooridinates and sizes passed into the paint call (both source and destination) need to account for both the image DPI and the destination Graphics object's DPI settings?
Thanks,
Chad
#5
Posted
:
Monday, December 12, 2005 4:21:01 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
The
RasterPaintProperties.UseDpi property will effect how the image will be
painted when using the IRasterImage.Paint(Graphics g, Rectangle src,
Rectangle dest, RasterPaintProperties properties).
UseDpi Property gets or sets a
value that indicates whether LEAD's automated scaling properties are
used to account for the physical resolution of the bitmap.
The physical resolution of an
image is measured in dots per inch (DPI). When you load an image, the
XResolution and YResolution properties are updated with the DPI values
for the horizontal and vertical resolution. Some images have different
horizontal and vertical resolutions (for example: 300 by 600). In such
cases, the displayed images will appear elongated if you do not account
for the resolution.
If the values of the
XResolution property and the YResolution property are not equal, set
the RasterPaintProperties.UseDpi property to TRUE to have LEAD's
automated scaling properties account for the physical resolution of the
image.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.