diff --git a/ChangeLog b/ChangeLog index f7afdb60b..4e5a01f63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-12-15 David Turner + + * 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 * include/freetype/config/ft2build.h, diff --git a/INSTALL b/INSTALL index 777fb4e1a..71df728e9 100644 --- a/INSTALL +++ b/INSTALL @@ -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): diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 5d2d029a8..660848e66 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -607,6 +607,33 @@ FT_BEGIN_HEADER typedef struct FT_RasterRec_* FT_Raster; + /*************************************************************************/ + /* */ + /* */ + /* FT_BBox */ + /* */ + /* */ + /* A structure used to hold an outline's bounding box, i.e., the */ + /* coordinates of its extrema in the horizontal and vertical */ + /* directions. */ + /* */ + /* */ + /* 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; + + /*************************************************************************/ /* */ /* */ @@ -747,23 +774,35 @@ FT_BEGIN_HEADER /* */ /* 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 */ + /* */ /* */ /* 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; diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index 1e6f9dd16..83ddbc2c6 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -275,33 +275,6 @@ FT_BEGIN_HEADER } FT_Matrix; - /*************************************************************************/ - /* */ - /* */ - /* FT_BBox */ - /* */ - /* */ - /* A structure used to hold an outline's bounding box, i.e., the */ - /* coordinates of its extrema in the horizontal and vertical */ - /* directions. */ - /* */ - /* */ - /* 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; - - /*************************************************************************/ /* */ /* */ diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 0a9c8497d..f90a698f1 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -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;