support for clipped direct rendering updated INSTALL file for Win32 case
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
diff --git a/ChangeLog b/ChangeLog
index f7afdb6..4e5a01f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/INSTALL b/INSTALL
index 777fb4e..71df728 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++:
-
- - make setup visualc
- - make
-
- If you are using Win32-lCC:
+ - if you're using Visual C++
- - make setup lcc
- - make
-
- If you are using the Borland C++ Builder compiler:
+ - make setup visualc
+ - make
+
+
+ - if you're using another 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 5d2d029..660848e 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -610,6 +610,33 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <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> */
/* FT_Span */
/* */
/* <Description> */
@@ -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;
diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h
index 1e6f9dd..83ddbc2 100644
--- a/include/freetype/fttypes.h
+++ b/include/freetype/fttypes.h
@@ -277,33 +277,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* <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> */
/* FT_MAKE_TAG */
/* */
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 0a9c849..f90a698 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;