« Syntax Coloring Impro… | Home | Notes on Windows 8 »

DynaPDF and SetFillColor precision

You can set fill or stroke color in DynaPDF using the normal SetFillColor/SetStrokeColor function. You pass an integer with the color value. This integer may be a simple color value for gray color space or may use RGB or CMYK functions for those color spaces.
But what if the integer precision is not enough?
Like if you want to show a 50% gray value, you can't really pass 127.5. You normally get it rounded down to 127.
If you really want to have 127.5, you need to use an array of doubles. We have FillColor overloaded so you can pass an array of double values to it. Now with double values you can pass 0.5 and the PDF will actually contain this value!
With doubles, the values are normalized in an array with one value per channel and range from 0.0 to 1.0.
25 10 12 - 23:19