suda Senior Java EE Develope specialises in Pdf forms , Fonts, application servers and Image manipulation, meditates in spare time.

PDF Gouraud shading (Free-Form) Color Interpolation

59 sec read

At IDR Solutions I spend a lot of time working with PDF as I’m involved in the development of our Java PDF Library and PDF to HTML5 Converter.

I thought that this article would be useful to illustrate the algorithm that is used to shade Free-form meshes in PDF files and how to find the color intensity at any given point in a triangular mesh.

Case Example : Find the color intensity of Point P.

pointP

This task can be accomplished by applying linear interpolation; In order to find this intensity, the cord points and colors of each vertex points needs to be known in advance. Coordinate points are defined in Bites Per Coordinate values and color vertex points  are defined in bits per component values. Please refer to Decode Array to find the number of components that is used to represent the coordination points mapping area and color mapping area; in Decode array these ranges are specified as follows…. [xmin xmax ymin ymax c1,min c1,max … cn,min cn,max]

once the coordinate points and colors of each vertex is known then a horizontal line need to be drawn across point “P”. This line is also referred as “Scan Line”. Coordination points where the scan line intersects in edges AC and AB has to be calculated (this can be accomplished by calculating the distance percentage of each cross section) in order to find the scan intersection point color values.

Once the intersection point colors are known then point “P” color can easily be calculated by calculating the distance of P across the line and mapping it with color deviation.

I Hope you find this information useful.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

suda Senior Java EE Develope specialises in Pdf forms , Fonts, application servers and Image manipulation, meditates in spare time.

Enabling SVG Gzip Compression on Apache and NGINX

Gzip compression is a widely supported method of reducing the size of the content sent from a web server in order to improve the...
Leon Atherton
47 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.