[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Determining pixel dimensions for bitmap

From: Marco Wertz
Subject: [ft] Determining pixel dimensions for bitmap
Date: Tue, 28 Oct 2014 14:46:31 +0100


when using FT_Outline_Get_BBox() to get the dimensions of the outline, the 
values are all in the 26.6 fixed point format. How do I determine the optimal 
pixel size for a bitmap to pass to FT_Outline_Get_Bitmap() so that the outline 
fits *exactly* into the bitmap dimensions?

The obvious approach would be something like this:

width = bbox.xMax - bbox.xMin;
height = bbox.yMax - bbox.yMin;

pixelwidth = width >> 6;
pixelheight = height >> 6;

if((width & 0x3f) > 31) pixelwidth++;
if((height & 0x3f) > 31) pixelheight++;

This will add another pixel in case the fractional part of the 26.6 fixed point 
value is >= 0.5. But I'm not sure if this is the right approach.... is there 
maybe an "official" way of determining the pixel allocation size for the bitmap 
passed to FT_Outline_Get_Bitmap() in order to get an *exact* fit?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]