support for clipped direct rendering

updated INSTALL file for Win32 case
This commit is contained in:
David Turner 2000-12-14 18:50:40 +00:00
parent 63408a1299
commit 859a18a358
5 changed files with 115 additions and 60 deletions

View File

@ -1,3 +1,13 @@
2000-12-15 David Turner <david.turner@freetype.org>
* include/freetype/ftimage.h, include/freetype/fttypes.h,
src/smooth/ftgrays.c: added support for clipped direct rendering in
the smooth renderer. This should not break binary compatibility of
existing applications..
* INSTALL: updated installation instructions on Win32, listing the
new "make setup list" target used to list supported compilers/targets
2000-12-13 David Turner <david.turner@freetype.org>
* include/freetype/config/ft2build.h,

36
INSTALL
View File

@ -9,7 +9,7 @@ I. From the command line:
- Go to the `freetype2' directory.
- On Unix (any C compiler should work):
- On Unix or (any C compiler should work):
- make setup (don't worry, this will invoke a configure script)
- make
@ -27,25 +27,29 @@ I. From the command line:
We provide a version of GNU Make for Win32 on the FreeType site.
See http://www.freetype.org/download.html for details.
If you are using gcc:
- if you're using gcc (Mingw, _not_ CygWin):
- make setup
- make
- make setup
- make
If you are using Visual C++:
- if you're using Visual C++
- make setup visualc
- make
If you are using Win32-lCC:
- make setup visualc
- make
- if you're using another compiler:
- make setup lcc
- make
If you are using the Borland C++ Builder compiler:
- make setup bcc32
- make
- make setup xxxx
- make
where "xxxx" is a special target corresponding to your compiler.
To see a list of supported compilers in this release, type:
make setup list
II. In your own environment (IDE):

View File

@ -607,6 +607,33 @@ FT_BEGIN_HEADER
typedef struct FT_RasterRec_* FT_Raster;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_BBox */
/* */
/* <Description> */
/* A structure used to hold an outline's bounding box, i.e., the */
/* coordinates of its extrema in the horizontal and vertical */
/* directions. */
/* */
/* <Fields> */
/* xMin :: The horizontal minimum (left-most). */
/* */
/* yMin :: The vertical minimum (bottom-most). */
/* */
/* xMax :: The horizontal maximum (right-most). */
/* */
/* yMax :: The vertical maximum (top-most). */
/* */
typedef struct FT_BBox_
{
FT_Pos xMin, yMin;
FT_Pos xMax, yMax;
} FT_BBox;
/*************************************************************************/
/* */
/* <Struct> */
@ -747,23 +774,35 @@ FT_BEGIN_HEADER
/* <Fields> */
/* ft_raster_flag_default :: This value is 0. */
/* */
/* ft_raster_flag_aa :: Requests the rendering of an */
/* anti-aliased glyph bitmap. If unset, a */
/* monchrome bitmap will be rendered. */
/* ft_raster_flag_aa :: */
/* this flag is set to indicate that a anti-aliased glyph image */
/* should be generated. Otherwise, it will be monochrome (1-bit) */
/* */
/* ft_raster_flag_direct :: Requests direct rendering over the */
/* target bitmap. Direct rendering uses */
/* user-provided callbacks in order to */
/* perform direct drawing or composition */
/* over an existing bitmap. If this bit is */
/* unset, the content of the target bitmap */
/* *must be zeroed*! */
/* ft_raster_flag_direct :: */
/* this flag is set to indicate direct rendering. In this mode, */
/* client applications must provide their own span callback. */
/* this let them direct drawing or composition over an existing */
/* bitmap. If this bit is not set, the target pixmap's buffer */
/* _must_ be zeroed before rendering. */
/* */
/* note that for now, direct rendering is only possible with */
/* anti-aliased glyphs only.. */
/* */
/* ft_raster_flag_clip :: */
/* this flag is only used in direct rendering mode. When set, */
/* the output will be clipped to a box specified in the "clip_box" */
/* field of the FT_Raster_Params structure. */
/* */
/* note that by default, the glyph bitmap is clipped to the */
/* target pixmap, except in direct rendering mode where all */
/* spans are generated if no clipping box is set. */
/* */
typedef enum
{
ft_raster_flag_default = 0,
ft_raster_flag_aa = 1,
ft_raster_flag_direct = 2
ft_raster_flag_direct = 2,
ft_raster_flag_clip = 4
} FT_Raster_Flag;
@ -796,6 +835,9 @@ FT_BEGIN_HEADER
/* user :: User-supplied data that is passed to each drawing */
/* callback. */
/* */
/* clip_box :: an optional clipping box. It is only used in */
/* direct rendering mode */
/* */
/* <Note> */
/* An anti-aliased glyph bitmap is drawn if the ft_raster_flag_aa bit */
/* flag is set in the `flags' field, otherwise a monochrome bitmap */
@ -823,6 +865,7 @@ FT_BEGIN_HEADER
FT_Raster_BitTest_Func bit_test;
FT_Raster_BitSet_Func bit_set;
void* user;
FT_BBox clip_box;
} FT_Raster_Params;

View File

@ -275,33 +275,6 @@ FT_BEGIN_HEADER
} FT_Matrix;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_BBox */
/* */
/* <Description> */
/* A structure used to hold an outline's bounding box, i.e., the */
/* coordinates of its extrema in the horizontal and vertical */
/* directions. */
/* */
/* <Fields> */
/* xMin :: The horizontal minimum (left-most). */
/* */
/* yMin :: The vertical minimum (bottom-most). */
/* */
/* xMax :: The horizontal maximum (right-most). */
/* */
/* yMax :: The vertical maximum (top-most). */
/* */
typedef struct FT_BBox_
{
FT_Pos xMin, yMin;
FT_Pos xMax, yMax;
} FT_BBox;
/*************************************************************************/
/* */
/* <Macro> */

View File

@ -252,6 +252,7 @@
FT_Outline outline;
FT_Bitmap target;
FT_BBox clip_box;
FT_Span gray_spans[FT_MAX_GRAY_SPANS];
int num_gray_spans;
@ -1702,21 +1703,24 @@
TBand bands[40], *band;
int n, num_bands;
TPos min, max, max_y;
FT_BBox* clip;
/* Set up state in the raster object */
compute_cbox( RAS_VAR_ outline );
/* clip to target bitmap, exit if nothing to do */
if ( ras.max_ex <= 0 || ras.min_ex >= ras.target.width ||
ras.max_ey <= 0 || ras.min_ey >= ras.target.rows )
clip = &ras.clip_box;
if ( ras.max_ex <= clip->xMin || ras.min_ex >= clip->xMax ||
ras.max_ey <= clip->yMin || ras.min_ey >= clip->yMax )
return 0;
if ( ras.min_ex < 0 ) ras.min_ex = 0;
if ( ras.min_ey < 0 ) ras.min_ey = 0;
if ( ras.min_ex < clip->xMin ) ras.min_ex = clip->xMin;
if ( ras.min_ey < clip->yMin ) ras.min_ey = clip->yMin;
if ( ras.max_ex > ras.target.width ) ras.max_ex = ras.target.width;
if ( ras.max_ey > ras.target.rows ) ras.max_ey = ras.target.rows;
if ( ras.max_ex > clip->xMax ) ras.max_ex = clip->xMax;
if ( ras.max_ey > clip->yMax ) ras.max_ey = clip->yMax;
/* simple heuristic used to speed-up the bezier decomposition -- see */
/* the code in render_conic() and render_cubic() for more details */
@ -1852,6 +1856,27 @@
if ( !( params->flags & ft_raster_flag_aa ) )
return ErrRaster_Invalid_Mode;
/* compute clipping box */
if ( (params->flags & ft_raster_flag_direct) == 0 )
{
/* compute clip box from target pixmap */
ras.clip_box.xMin = 0;
ras.clip_box.yMin = 0;
ras.clip_box.xMax = target_map->width;
ras.clip_box.yMax = target_map->rows;
}
else if ( params->flags & ft_raster_flag_clip )
{
ras.clip_box = params->clip_box;
}
else
{
ras.clip_box.xMin = -32768;
ras.clip_box.yMin = -32768;
ras.clip_box.xMax = 32767;
ras.clip_box.yMax = 32767;
}
ras.outline = *outline;
ras.num_cells = 0;
ras.invalid = 1;