Components for Developers
© 2000-2016, Two Pilots

PDF Library   Virtual Printer   Converters   Squirrel   HTML_QuickForm   Design Service

Two Pilots blog

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 Responses to “Rounding Effect”

  1. Surge Says:

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

  2. admin Says:

    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

Leave a Reply

PDF Library   Virtual Printer   Converters   Squirrel   HTML_QuickForm   Design Service


Support | Blog | Forum | Contacts | About | Site map

© 2000-2016, Two Pilots