next up previous contents index
Next: Smart Antialiasing Up: Antialiasing Previous: General Description   Contents   Index

Setting Operating Parameters

Applications can use both $2\times$ and $4\times$ antialiasing arbitrary mixed. Switching between the two modes is achieved using

 int T1_AASetLevel( int level)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} The argument level should be either T1_AA_LOW ($=2$) or T1_AA_HIGH ($=4$). Any other values are ignored and T1_errno is set appropriately. This function is to be called after initialization. The default value after initialization is T1_AA_LOW. The current value can also be queried by issuing a call to

 int T1_AAGetLevel( void)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} The returned value is current level. Switching between the two antialiasing modes should be quite fast since apart from a little error checking essentially only one simple variable is set.

There is one more value that may be specified for level, namely T1_AA_NONE. T1_AA_NONE is identical to 1 which means that no subsampling at all is done. But the resulting glyph, having only fore- and background colors is returned as a bytemap instead of as a bitmap. This is intended for situtations where an antialiased glyph should be concatenated with a (possibly large) non-antialiased glyph using the function T1_ConcatGlyphs(). In that case, the depths of the two glyphs have to be identical. There is probably not much more sense in setting level to T1_AA_NONE.

As described before, the result of the T1_AASet..() functions is strictly spoken no longer a bitmap since more than one bit is used to represent one pixel. The function

 int T1_AASetBitsPerPixel( int bpp)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} allows the user to specify how many bits should be used to represent one pixel. Allowed values for bpp are 8, 16, 24 and 32. However, if 24 is specified, internally 32 will be used since the pixel are then addressed as objects of type long. Antialiased glyphs may grow quite large, especially when using bpp = 32. The value of bpp is written into the member bpp of the glyph-structure (see [*] on page [*]). That way a user can check whether a glyph is antialiased or not. It is possible to work with antialiased and non-antialiased glyphs at the same time. It is also possible to directly query the value of bits per pixel by using

 int T1_AAGetBitsPerPixel( void)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} The value returned is the number of bits per pixel used.

In order to make the handling of antialiased glyphs as flexible as possible, the values to be written into the pixels for different gray values may (and must) be explicitly specified. For low level antialiasing this is done by calling the function

 int T1_AASetGrayValues( unsigned long white,
                         unsigned long gray75,
                         unsigned long gray50,
                         unsigned long gray25,
                         unsigned long black)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} For lower bpp values only the lower bits are used. For high level antialiasing this kind of graylevel specification is not economical since 17 arguments would have to be specified. Instead, another function is used which expects a pointer an array of unsigned long's:

 int T1_AAHSetGrayValues( unsigned long *grayvals)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} The array grayvals points to must contain 17 entries. Element 0 is expected to specify the background color's pixel value and element 16 represents the foreground color. Calling one of these two functions involves also a new setup of the lookup tables. It should thus only be done if some color value really has changed.

In case the antialiasing level is set to T1_AA_NONE as described above, the function

 int T1_AANSetGrayValues( unsigned long bg, unsigned long fg)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} must be used to set foreground and background color. In conclusion, it turns out that each antialiasing level has its own lookup tables which have to be initialized as soon as either foreground color, background color or both have changed.

Each of the three graylevel sets described above can also be queried by the user. This is done using one of the functions

 int T1_AAGetGrayValues( long *pgrayvals)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$}

 int T1_AAHGetGrayValues( long *pgrayvals)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$}

 int T1_AANGetGrayValues( long *pgrayvals)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} Here, pgrayvals is the start address of an array of long-values to which the respective grayvalues are written. This memory must thus be supplied by the user. These functions will write 5 (T1_AAGetGrayValues), 17 (T1_AAHGetGrayValues) and 2 (T1_AANGetGrayValues) respectively to the location given by pgrayvals. These functions are to be called after initialization. If something goes wrong -1 is returned and T1_errno will be set accordingly. Otherwise 0 is returned.


next up previous contents index
Next: Smart Antialiasing Up: Antialiasing Previous: General Description   Contents   Index
2004-10-04