Rounding Effect

Look at the picture of the line before inexact rounding of floating points, and at the
picture after rounding:

The problem arose while converting an EMF into a PDF or while drawing an HDC-context taken from a PDF. The problem was connected to the Polyline(To) function. The function transformed an array of points with close value coordinates. Then, to draw a set of lines in a PDF, transformation of the coordinates from HDC to PDF coordinates was necessary. For this transformation the LPtoDP function was used. But LPtoDP returns integer values. For example, this function transforms the (160, 74) and (159, 60) coordinates from EMF to (1, 1) and (1, 2) for a PDF. So a set of lines was generated as shown in the left picture. To improve the results, we have stopped using the LPtoDP function. Now Polyline(To) function gives the correct results.

Artem Golubnichenko

2 comments

    • Surge on December 3, 2010 at 12:43 pm

    Thanks for the direction. can you double the amount of sections?

    • admin on January 11, 2011 at 10:29 am

    Surge, thank you for your proposal. Our converter emf2pdf only draws EMF records step by step. We try represent content of EMF file in PDF file exactly. For example, if Polyline function has 10 points we need put down in PDF file only 10 points.

    Best regards,
    Artem Golubnichenko

    Two Pilots
    http://www.colorpilot.com

Comments have been disabled.