zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ftraster.c File Reference
#include <ft2build.h>
#include "ftraster.h"
#include <FT_INTERNAL_CALC_H>
#include "rastpic.h"
#include <FT_INTERNAL_OBJECTS_H>
#include <FT_INTERNAL_DEBUG_H>
#include "rasterrs.h"

Go to the source code of this file.

Macros

#define AlignProfileSize   ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )
 
#define CEILING(x)   ( ( (x) + ras.precision - 1 ) & -ras.precision )
 
#define FAILURE   1
 
#define FALSE   0
 
#define FLOOR(x)   ( (x) & -ras.precision )
 
#define Flow_Up   0x8
 
#define FMulDiv(a, b, c)   ( (a) * (b) / (c) )
 
#define FRAC(x)   ( (x) & ( ras.precision - 1 ) )
 
#define FT_COMPONENT   trace_raster
 
#define FT_MEM_SET(d, s, c)   ft_memset( d, s, c )
 
#define FT_MEM_ZERO(dest, count)   FT_MEM_SET( dest, 0, count )
 
#define FT_UNUSED_RASTER   FT_UNUSED( worker )
 
#define IS_BOTTOM_OVERSHOOT(x)   ( CEILING( x ) - x >= ras.precision_half )
 
#define IS_TOP_OVERSHOOT(x)   ( x - FLOOR( x ) >= ras.precision_half )
 
#define MaxBezier   32 /* The maximum number of stacked Bezier curves. */
 
#define NULL   (void*)0
 
#define Overshoot_Bottom   0x20
 
#define Overshoot_Top   0x10
 
#define Pixel_Bits   6 /* fractional bits of *input* coordinates */
 
#define ras   (*worker)
 
#define RAS_ARG   black_PWorker worker
 
#define RAS_ARGS   black_PWorker worker,
 
#define RAS_VAR   worker
 
#define RAS_VARS   worker,
 
#define Raster_Err_Invalid   Raster_Err_Invalid_Outline
 
#define Raster_Err_Neg_Height   Raster_Err_Raster_Negative_Height
 
#define Raster_Err_None   Raster_Err_Ok
 
#define Raster_Err_Not_Ini   Raster_Err_Raster_Uninitialized
 
#define Raster_Err_Overflow   Raster_Err_Raster_Overflow
 
#define Raster_Err_Unsupported   Raster_Err_Cannot_Render_Glyph
 
#define RASTER_GRAY_LINES   2048
 
#define SCALED(x)   ( ( (x) << ras.scale_shift ) - ras.precision_half )
 
#define SMulDiv   FT_MulDiv
 
#define SUCCESS   0
 
#define SWAP_(x, y)
 
#define TRUE   1
 
#define TRUNC(x)   ( (signed long)(x) >> ras.precision_bits )
 

Typedefs

typedef union Alignment_ Alignment
 
typedef struct black_TRaster_ * black_PRaster
 
typedef struct black_TWorker_ * black_PWorker
 
typedef struct black_TBand_ black_TBand
 
typedef struct black_TRaster_ black_TRaster
 
typedef struct black_TWorker_ black_TWorker
 
typedef char Bool
 
typedef unsigned char Byte
 
typedef void Function_Sweep_Init (RAS_ARGS Short *min, Short *max)
 
typedef void Function_Sweep_Span (RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
 
typedef void Function_Sweep_Step (RAS_ARG)
 
typedef int Int
 
typedef long Long
 
typedef union Alignment_ * PAlignment
 
typedef unsigned char * PByte
 
typedef long * PLong
 
typedef TProfilePProfile
 
typedef PProfilePProfileList
 
typedef unsigned short * PUShort
 
typedef short Short
 
typedef struct TPoint_ TPoint
 
typedef struct TProfile_ TProfile
 
typedef PProfile TProfileList
 
typedef void(* TSplitter )(TPoint *base)
 
typedef enum TStates_ TStates
 
typedef unsigned int UInt
 
typedef unsigned short UShort
 

Enumerations

enum  TStates_ { Unknown_State, Ascending_State, Descending_State, Flat_State }
 

Functions

static Bool Bezier_Down (RAS_ARGS Int degree, TSplitter splitter, Long miny, Long maxy)
 
static Bool Bezier_Up (RAS_ARGS Int degree, TSplitter splitter, Long miny, Long maxy)
 
static Bool Conic_To (RAS_ARGS Long cx, Long cy, Long x, Long y)
 
static Bool Convert_Glyph (RAS_ARGS int flipped)
 
static Bool Cubic_To (RAS_ARGS Long cx1, Long cy1, Long cx2, Long cy2, Long x, Long y)
 
static Bool Decompose_Curve (RAS_ARGS UShort first, UShort last, int flipped)
 
static void DelOld (PProfileList list, PProfile profile)
 
static Bool Draw_Sweep (RAS_ARG)
 
static Bool End_Profile (RAS_ARGS Bool overshoot)
 
static Bool Finalize_Profile_Table (RAS_ARG)
 
static void ft_black_done (black_PRaster raster)
 
static void ft_black_init (black_PRaster raster)
 
static int ft_black_new (FT_Memory memory, black_PRaster *araster)
 
static int ft_black_render (black_PRaster raster, const FT_Raster_Params *params)
 
static void ft_black_reset (black_PRaster raster, char *pool_base, long pool_size)
 
static void ft_black_set_mode (black_PRaster raster, unsigned long mode, const char *palette)
 
static void Horizontal_Sweep_Drop (RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
 
static void Horizontal_Sweep_Init (RAS_ARGS Short *min, Short *max)
 
static void Horizontal_Sweep_Span (RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
 
static void Horizontal_Sweep_Step (RAS_ARG)
 
static void Init_Linked (TProfileList *l)
 
static Bool Insert_Y_Turn (RAS_ARGS Int y)
 
static void InsNew (PProfileList list, PProfile profile)
 
static Bool Line_Down (RAS_ARGS Long x1, Long y1, Long x2, Long y2, Long miny, Long maxy)
 
static Bool Line_To (RAS_ARGS Long x, Long y)
 
static Bool Line_Up (RAS_ARGS Long x1, Long y1, Long x2, Long y2, Long miny, Long maxy)
 
static Bool New_Profile (RAS_ARGS TStates aState, Bool overshoot)
 
 Render_Glyph (RAS_ARG)
 
 Render_Gray_Glyph (RAS_ARG)
 
static int Render_Single_Pass (RAS_ARGS Bool flipped)
 
static void Set_High_Precision (RAS_ARGS Int High)
 
static void Sort (PProfileList list)
 
static void Split_Conic (TPoint *base)
 
static void Split_Cubic (TPoint *base)
 
static void Vertical_Sweep_Drop (RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
 
static void Vertical_Sweep_Init (RAS_ARGS Short *min, Short *max)
 
static void Vertical_Sweep_Span (RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
 
static void Vertical_Sweep_Step (RAS_ARG)
 

Macro Definition Documentation

#define AlignProfileSize   ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )

Definition at line 380 of file ftraster.c.

Referenced by Convert_Glyph(), End_Profile(), and New_Profile().

#define CEILING (   x)    ( ( (x) + ras.precision - 1 ) & -ras.precision )
#define FALSE   0

Definition at line 269 of file ftraster.c.

Referenced by Bezier_Up(), Convert_Glyph(), End_Profile(), Line_Up(), and New_Profile().

#define FLOOR (   x)    ( (x) & -ras.precision )
#define Flow_Up   0x8
#define FMulDiv (   a,
  b,
  c 
)    ( (a) * (b) / (c) )

Definition at line 253 of file ftraster.c.

Referenced by Bezier_Up().

#define FRAC (   x)    ( (x) & ( ras.precision - 1 ) )

Definition at line 444 of file ftraster.c.

Referenced by Bezier_Up(), Convert_Glyph(), and Line_Up().

#define FT_COMPONENT   trace_raster

OTHER MACROS (do not change)

Definition at line 177 of file ftraster.c.

#define FT_MEM_SET (   d,
  s,
  c 
)    ft_memset( d, s, c )

Definition at line 243 of file ftraster.c.

#define FT_MEM_ZERO (   dest,
  count 
)    FT_MEM_SET( dest, 0, count )

Definition at line 247 of file ftraster.c.

Referenced by ft_black_render().

#define FT_UNUSED_RASTER   FT_UNUSED( worker )

Definition at line 410 of file ftraster.c.

Referenced by Horizontal_Sweep_Init(), Horizontal_Sweep_Step(), and Render_Gray_Glyph().

#define IS_BOTTOM_OVERSHOOT (   x)    ( CEILING( x ) - x >= ras.precision_half )

Definition at line 447 of file ftraster.c.

Referenced by Conic_To(), Convert_Glyph(), Cubic_To(), and Line_To().

#define IS_TOP_OVERSHOOT (   x)    ( x - FLOOR( x ) >= ras.precision_half )

Definition at line 448 of file ftraster.c.

Referenced by Conic_To(), Convert_Glyph(), Cubic_To(), and Line_To().

#define MaxBezier   32 /* The maximum number of stacked Bezier curves. */

Definition at line 285 of file ftraster.c.

#define NULL   (void*)0
#define Overshoot_Bottom   0x20

Definition at line 330 of file ftraster.c.

Referenced by End_Profile(), Horizontal_Sweep_Drop(), New_Profile(), and Vertical_Sweep_Drop().

#define Overshoot_Top   0x10

Definition at line 329 of file ftraster.c.

Referenced by End_Profile(), Horizontal_Sweep_Drop(), New_Profile(), and Vertical_Sweep_Drop().

#define Pixel_Bits   6 /* fractional bits of *input* coordinates */

Definition at line 289 of file ftraster.c.

Referenced by Set_High_Precision().

#define RAS_ARG   black_PWorker worker

Definition at line 405 of file ftraster.c.

#define RAS_ARGS   black_PWorker worker,

Definition at line 404 of file ftraster.c.

#define RAS_VAR   worker

Definition at line 408 of file ftraster.c.

Referenced by Convert_Glyph(), Draw_Sweep(), ft_black_render(), and Render_Single_Pass().

#define Raster_Err_Invalid   Raster_Err_Invalid_Outline
#define Raster_Err_Neg_Height   Raster_Err_Raster_Negative_Height

Definition at line 234 of file ftraster.c.

Referenced by End_Profile().

#define Raster_Err_None   Raster_Err_Ok

Definition at line 231 of file ftraster.c.

Referenced by ft_black_render(), Render_Glyph(), and Render_Single_Pass().

#define Raster_Err_Not_Ini   Raster_Err_Raster_Uninitialized

Definition at line 232 of file ftraster.c.

Referenced by ft_black_render().

#define Raster_Err_Overflow   Raster_Err_Raster_Overflow
#define Raster_Err_Unsupported   Raster_Err_Cannot_Render_Glyph

Definition at line 236 of file ftraster.c.

Referenced by ft_black_render(), and Render_Gray_Glyph().

#define RASTER_GRAY_LINES   2048

CONFIGURATION MACROS

Definition at line 159 of file ftraster.c.

Referenced by ft_black_init().

#define SCALED (   x)    ( ( (x) << ras.scale_shift ) - ras.precision_half )

Definition at line 445 of file ftraster.c.

Referenced by Decompose_Curve().

#define SMulDiv   FT_MulDiv

Definition at line 258 of file ftraster.c.

Referenced by Line_Up().

#define SWAP_ (   x,
  y 
)
Value:
do \
{ \
Long swap = x; \
\
\
x = y; \
y = swap; \
} while ( 0 )
EGLSurface EGLint x
Definition: eglext.h:293
long Long
Definition: ftraster.c:304
EGLSurface EGLint EGLint y
Definition: eglext.h:293
void swap(Zeni::String &lhs, Zeni::String &rhs)
Definition: String.cpp:578

Definition at line 1765 of file ftraster.c.

Referenced by Decompose_Curve().

#define TRUE   1

Definition at line 265 of file ftraster.c.

Referenced by Bezier_Up(), and New_Profile().

#define TRUNC (   x)    ( (signed long)(x) >> ras.precision_bits )

Typedef Documentation

typedef union Alignment_ Alignment
typedef struct black_TRaster_ * black_PRaster
typedef struct black_TWorker_ * black_PWorker

Definition at line 416 of file ftraster.c.

typedef struct black_TBand_ black_TBand
typedef struct black_TRaster_ black_TRaster
typedef struct black_TWorker_ black_TWorker

Definition at line 416 of file ftraster.c.

return Display return Display Bool Bool int int int return Display XEvent Bool(*) k XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent return Display Drawable GC XImage int int int int unsigned int unsigned int return Display Window Window Window int int int int unsigned int return Display Window Window int int return Display Window unsigned int unsigned int return Display Window Bool long XEvent return Display GC unsigned long return Display Window int Time return Display Window Window return Display Window unsigned long return Display Window XSizeHints Display Colormap XColor int return char int XTextProperty return XFontStruct _Xconst char int int int int XCharStruct return Display Window return Display Time return Display Colormap return Display Window Window int int unsigned int unsigned int int int return Display Window int return XExtensionInfo Display char XExtensionHooks int XPointer return XExtensionInfo XExtensionInfo Display return Display return Display unsigned long Display GC Display char long Display xReply int Bool return Display Bool return Display int SDL_X11_XESetEventToWireRetType return Display XShmSegmentInfo return Display Drawable GC XImage int int int int unsigned int unsigned int Bool

Definition at line 307 of file ftraster.c.

typedef unsigned char Byte

Definition at line 306 of file ftraster.c.

typedef void Function_Sweep_Init(RAS_ARGS Short *min, Short *max)

Definition at line 421 of file ftraster.c.

typedef void Function_Sweep_Span(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)

Definition at line 425 of file ftraster.c.

typedef void Function_Sweep_Step(RAS_ARG)

Definition at line 432 of file ftraster.c.

typedef int Int

SIMPLE TYPE DECLARATIONS

Definition at line 300 of file ftraster.c.

typedef long Long

Definition at line 304 of file ftraster.c.

typedef union Alignment_ * PAlignment
typedef unsigned char * PByte

Definition at line 306 of file ftraster.c.

typedef long * PLong

Definition at line 304 of file ftraster.c.

typedef TProfile* PProfile

Definition at line 345 of file ftraster.c.

Definition at line 367 of file ftraster.c.

typedef unsigned short * PUShort

Definition at line 303 of file ftraster.c.

typedef short Short

Definition at line 302 of file ftraster.c.

typedef struct TPoint_ TPoint
typedef struct TProfile_ TProfile

Definition at line 344 of file ftraster.c.

Definition at line 366 of file ftraster.c.

typedef void(* TSplitter)(TPoint *base)

Definition at line 1234 of file ftraster.c.

typedef enum TStates_ TStates
typedef unsigned int UInt

Definition at line 301 of file ftraster.c.

typedef unsigned short UShort

Definition at line 303 of file ftraster.c.

Enumeration Type Documentation

enum TStates_
Enumerator
Unknown_State 
Ascending_State 
Descending_State 
Flat_State 

Definition at line 334 of file ftraster.c.

Function Documentation

static Bool Bezier_Down ( RAS_ARGS Int  degree,
TSplitter  splitter,
Long  miny,
Long  maxy 
)
static

Definition at line 1392 of file ftraster.c.

References Bezier_Up(), ras, and RAS_VARS.

Referenced by Conic_To(), and Cubic_To().

static Bool Bezier_Up ( RAS_ARGS Int  degree,
TSplitter  splitter,
Long  miny,
Long  maxy 
)
static

Definition at line 1259 of file ftraster.c.

References CEILING, e, e0, FAILURE, FALSE, FLOOR, FMulDiv, FRAC, ras, Raster_Err_Overflow, SUCCESS, TRUE, and TRUNC.

Referenced by Bezier_Down(), Conic_To(), and Cubic_To().

static Bool Cubic_To ( RAS_ARGS Long  cx1,
Long  cy1,
Long  cx2,
Long  cy2,
Long  x,
Long  y 
)
static
static void DelOld ( PProfileList  list,
PProfile  profile 
)
static

Definition at line 2149 of file ftraster.c.

Referenced by Draw_Sweep().

static Bool Draw_Sweep ( RAS_ARG  )
static
static Bool End_Profile ( RAS_ARGS Bool  overshoot)
static
static Bool Finalize_Profile_Table ( RAS_ARG  )
static

Definition at line 919 of file ftraster.c.

References FAILURE, Flow_Up, Insert_Y_Turn(), NULL, ras, RAS_VARS, and SUCCESS.

Referenced by Convert_Glyph().

static void ft_black_done ( black_PRaster  raster)
static

Definition at line 3476 of file ftraster.c.

References FT_FREE.

static void ft_black_init ( black_PRaster  raster)
static

Definition at line 3403 of file ftraster.c.

References FT_UNUSED, and RASTER_GRAY_LINES.

Referenced by ft_black_new().

static int ft_black_new ( FT_Memory  memory,
black_PRaster araster 
)
static

Definition at line 3455 of file ftraster.c.

References error, ft_black_init(), FT_NEW, and NULL.

static void ft_black_reset ( black_PRaster  raster,
char *  pool_base,
long  pool_size 
)
static

Definition at line 3489 of file ftraster.c.

References NULL.

static void ft_black_set_mode ( black_PRaster  raster,
unsigned long  mode,
const char *  palette 
)
static

Definition at line 3515 of file ftraster.c.

References FT_MAKE_TAG, and FT_UNUSED.

static void Horizontal_Sweep_Drop ( RAS_ARGS Short  y,
FT_F26Dot6  x1,
FT_F26Dot6  x2,
PProfile  left,
PProfile  right 
)
static

Definition at line 2549 of file ftraster.c.

References bits, CEILING, FLOOR, if(), Overshoot_Bottom, Overshoot_Top, ras, and TRUNC.

Referenced by Render_Glyph().

static void Horizontal_Sweep_Init ( RAS_ARGS Short min,
Short max 
)
static

Definition at line 2495 of file ftraster.c.

References FT_UNUSED, and FT_UNUSED_RASTER.

Referenced by Render_Glyph().

static void Horizontal_Sweep_Span ( RAS_ARGS Short  y,
FT_F26Dot6  x1,
FT_F26Dot6  x2,
PProfile  left,
PProfile  right 
)
static

Definition at line 2506 of file ftraster.c.

References bits, CEILING, FLOOR, FT_UNUSED, ras, and TRUNC.

Referenced by Render_Glyph().

static void Horizontal_Sweep_Step ( RAS_ARG  )
static

Definition at line 2667 of file ftraster.c.

References FT_UNUSED_RASTER.

Referenced by Render_Glyph().

static void Init_Linked ( TProfileList l)
static

SCAN-LINE SWEEPS AND DRAWING

Definition at line 2105 of file ftraster.c.

References NULL.

Referenced by Draw_Sweep().

static Bool Insert_Y_Turn ( RAS_ARGS Int  y)
static

Definition at line 868 of file ftraster.c.

References FAILURE, ras, Raster_Err_Overflow, and SUCCESS.

Referenced by Finalize_Profile_Table().

static void InsNew ( PProfileList  list,
PProfile  profile 
)
static

Definition at line 2118 of file ftraster.c.

References profile.

Referenced by Draw_Sweep().

static Bool Line_Down ( RAS_ARGS Long  x1,
Long  y1,
Long  x2,
Long  y2,
Long  miny,
Long  maxy 
)
static

Definition at line 1212 of file ftraster.c.

References Line_Up(), ras, and RAS_VARS.

Referenced by Line_To().

static Bool Line_Up ( RAS_ARGS Long  x1,
Long  y1,
Long  x2,
Long  y2,
Long  miny,
Long  maxy 
)
static

Definition at line 1073 of file ftraster.c.

References FAILURE, FALSE, FRAC, ras, Raster_Err_Overflow, SMulDiv, SUCCESS, and TRUNC.

Referenced by Line_Down(), and Line_To().

static Bool New_Profile ( RAS_ARGS TStates  aState,
Bool  overshoot 
)
static
Render_Gray_Glyph ( RAS_ARG  )

Definition at line 3392 of file ftraster.c.

References FT_UNUSED_RASTER, and Raster_Err_Unsupported.

Referenced by ft_black_render().

static int Render_Single_Pass ( RAS_ARGS Bool  flipped)
static
static void Set_High_Precision ( RAS_ARGS Int  High)
static

PROFILES COMPUTATION

Definition at line 661 of file ftraster.c.

References FT_TRACE6, Pixel_Bits, and ras.

Referenced by Render_Glyph().

static void Sort ( PProfileList  list)
static

Definition at line 2184 of file ftraster.c.

References Flow_Up.

Referenced by Draw_Sweep().

static void Split_Conic ( TPoint base)
static

Definition at line 983 of file ftraster.c.

Referenced by Conic_To().

static void Split_Cubic ( TPoint base)
static

Definition at line 1020 of file ftraster.c.

References d.

Referenced by Cubic_To().

static void Vertical_Sweep_Drop ( RAS_ARGS Short  y,
FT_F26Dot6  x1,
FT_F26Dot6  x2,
PProfile  left,
PProfile  right 
)
static

Definition at line 2330 of file ftraster.c.

References CEILING, FLOOR, Overshoot_Bottom, Overshoot_Top, ras, and TRUNC.

Referenced by Render_Glyph().

static void Vertical_Sweep_Init ( RAS_ARGS Short min,
Short max 
)
static

Definition at line 2243 of file ftraster.c.

References FT_UNUSED, and ras.

Referenced by Render_Glyph().

static void Vertical_Sweep_Span ( RAS_ARGS Short  y,
FT_F26Dot6  x1,
FT_F26Dot6  x2,
PProfile  left,
PProfile  right 
)
static

Definition at line 2262 of file ftraster.c.

References CEILING, FLOOR, FT_UNUSED, ras, and TRUNC.

Referenced by Render_Glyph().

static void Vertical_Sweep_Step ( RAS_ARG  )
static

Definition at line 2479 of file ftraster.c.

References ras.

Referenced by Render_Glyph().