still working on that damn rasterizer bug !! ;-)

This commit is contained in:
David Turner 2000-05-03 18:15:40 +00:00
parent 112be4c609
commit 4fce93e0cb
5 changed files with 4089 additions and 4 deletions

View File

@ -190,6 +190,9 @@ else
$(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c
$(COMPILE) $T$@ $<
$(OBJ_)ftrast2.$O: $(SRC_DIR_)ftrast2.c
$(COMPILE) $T$@ $<
$(OBJ_)fttry.$O: $(SRC_DIR_)fttry.c
$(COMPILE) $T$@ $<
@ -264,8 +267,8 @@ else
$(LINK)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast.$O
$(GRAPH_LINK)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O
$(GRAPH_LINK) $(OBJ_)ftrast2.$O
$(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)

View File

@ -23,6 +23,75 @@
#include "ftrast.h"
#include <ftcalc.h> /* for FT_MulDiv only */
/*************************************************************************/
/* */
/* A simple technical note on how the raster works: */
/* */
/* Converting an outline into a bitmap is achieved in several steps */
/* which are: */
/* */
/* 1 - Decomposing the outline into successive `profiles'. Each */
/* profile is simply an array of scanline intersections on a given */
/* dimension. A profile's main attributes are */
/* */
/* o its scanline position boundaries, i.e. `Ymin' and `Ymax'. */
/* */
/* o an array of intersection coordinates for each scanline */
/* between `Ymin' and `Ymax'. */
/* */
/* o a direction, indicating wether is was built going `up' or */
/* `down', as this is very important for filling rules. */
/* */
/* 2 - Sweeping the target map's scanlines in order to compute segment */
/* `spans' which are then filled. Additionaly, this pass performs */
/* drop-out control. */
/* */
/* The outline data is parsed during step 1 only. The profiles are */
/* built from the bottom of the render pool, used as a stack. The */
/* following graphics shows the profile list under construction: */
/* */
/* ____________________________________________________________ _ _ */
/* | | | | | */
/* | profile | coordinates for | profile | coordinates for |--> */
/* | 1 | profile 1 | 2 | profile 2 |--> */
/* |_________|___________________|_________|_________________|__ _ _ */
/* */
/* ^ ^ */
/* | | */
/* start of render pool top */
/* */
/* The top of the profile stack is kept in the `top' variable. */
/* */
/* As you can see, a profile record is pushed on top of the render */
/* pool, which is then followed by its coordinates/intersections. If */
/* a change of direction is detected in the outline, a new profile is */
/* generated until the end of the outline. */
/* */
/* Note that when all profiles have been generated, the function */
/* Finalize_Profile_Table() is used to record, for each profile, its */
/* bottom-most scanline as well as the scanline above its upmost */
/* boundary. These positions are called `y-turns' because they (sort */
/* of) correspond to local extrema. They are stored in a sorted list */
/* built from the top of the render pool as a downwards stack: */
/* */
/* _ _ _______________________________________ */
/* | | */
/* <--| sorted list of | */
/* <--| extrema scanlines | */
/* _ _ __________________|____________________| */
/* */
/* ^ ^ */
/* | | */
/* maxBuff sizeBuff = end of pool */
/* */
/* This list is later used during the sweep phase in order to */
/* optimize performance (see technical note on the sweep below). */
/* */
/* Of course, the raster detects whether the two stacks collide and */
/* handles the situation propertly. */
/* */
/*************************************************************************/
/****************************************************************/
/****************************************************************/
/** **/

3971
demos/src/ftrast2.c Normal file

File diff suppressed because it is too large Load Diff

42
demos/src/ftrast2.h Normal file
View File

@ -0,0 +1,42 @@
/*******************************************************************
*
* ftraster.h v 2.0
*
* The FreeType glyph scan-line converter (interface)
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*
******************************************************************/
#ifndef FTRAST2_H
#define FTRAST2_H
#include <ftimage.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef EXPORT_DEF
#define EXPORT_DEF /* nothing */
#endif
EXPORT_DEF
FT_Raster_Funcs ft_black2_raster;
#ifdef __cplusplus
}
#endif
#endif /* FTRAST2_H */
/* END */

View File

@ -28,7 +28,7 @@
#include "grfont.h"
#include "ftgrays.h"
#include "ftrast.h"
#include "ftrast2.h"
#define DIM_X 500
#define DIM_Y 400
@ -425,7 +425,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
error = 1;
if ( !antialias)
error = FT_Set_Raster( library, &ft_black_raster );
error = FT_Set_Raster( library, &ft_black2_raster );
else if ( use_grays && antialias )
error = FT_Set_Raster( library, &ft_grays_raster );