⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftraster.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
/***************************************************************************//*                                                                         *//*  ftraster.c                                                             *//*                                                                         *//*    The FreeType glyph rasterizer (body).                                *//*                                                                         *//*  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.                                        *//*                                                                         *//***************************************************************************/  /*************************************************************************/  /*                                                                       */  /* The `raster' component implements FreeType's scan-line converter, the */  /* one used to generate bitmaps and pixmaps from vectorial outline       */  /* descriptions.                                                         */  /*                                                                       */  /* It has been rewritten entirely for FreeType 2.0, in order to become   */  /* completely independent of the rest of the library.  It should now be  */  /* possible to include it more easily in all kinds of libraries and      */  /* applications, which do not necessarily need the font engines and API. */  /*                                                                       */  /* This version contains the following features:                         */  /*                                                                       */  /* - Support for third-order Bezier arcs.                                */  /*                                                                       */  /* - Improved performance of the 5-levels anti-aliasing algorithm.       */  /*                                                                       */  /* - 17-levels anti-aliasing for smoother curves, though the difference  */  /*   isn't always noticeable, depending on your palette.                 */  /*                                                                       */  /* - An API to decompose a raster outline into a path (i.e., into a      */  /*   a series of segments and arcs).                                     */  /*                                                                       */  /* Planned additions:                                                    */  /*                                                                       */  /* - Getting rid of the second pass for horizontal drop-out detection.   */  /*   I've got a few ideas, but I'll have to experiment in Pascal with    */  /*   them.  to avoid damaging of the rendering of glyphs at small sizes. */  /*                                                                       */  /* - Adding a `composition' callback, which should be invoked during     */  /*   anti-aliased rendering.  In short, it will allow line-by-line       */  /*   composition (i.e., transparencies, etc.) of the output in a fairly  */  /*   portable way.  Of course, a single sweep is required there.         */  /*                                                                       */  /*************************************************************************/#include <ftraster.h>#ifndef _STANDALONE_#include <ftconfig.h>#endif#ifndef EXPORT_FUNC#define EXPORT_FUNC  /* nothing */#endif#undef  FT_COMPONENT#define FT_COMPONENT  trace_raster#ifdef _STANDALONE_  /*************************************************************************/  /*                                                                       */  /* The following defines are used when the raster is compiled as a       */  /* stand-alone object.  Each of them is commented, and you're free to    */  /* toggle them to suit your needs.                                       */  /*                                                                       */  /*************************************************************************/  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_INT_IS_32                                                   */  /*                                                                       */  /*   Set this configuration macro to the unsigned type which has 32      */  /*   bits.                                                               */  /*                                                                       */#define FT_RASTER_INT_IS_32  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_OPTION_ANTI_ALIAS                                           */  /*                                                                       */  /*   Define this configuration macro if you want to support              */  /*   anti-aliasing.                                                      */  /*                                                                       */#define FT_RASTER_OPTION_ANTI_ALIAS  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_OPTION_CONIC_BEZIERS                                        */  /*                                                                       */  /*   Define this configuration macro if your source outlines contain     */  /*   second-order Bezier arcs.  Typically, these are TrueType outlines.  */  /*                                                                       */#define FT_RASTER_CONIC_BEZIERS  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_OPTION_CUBIC_BEZIERS                                        */  /*                                                                       */  /*   Define this configuration macro if your source outlines contain     */  /*   third-order Bezier arcs.  Typically, these are Type1 outlines.      */  /*                                                                       */#define FT_RASTER_CUBIC_BEZIERS  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_ANTI_ALIAS_5                                                */  /*                                                                       */  /*   Define this configuration macro if you want to enable the 5-grays   */  /*   anti-aliasing mode.  Ignored if FT_RASTER_OPTION_ANTI_ALIAS isn't   */  /*   defined.                                                            */  /*                                                                       */#define FT_RASTER_ANTI_ALIAS_5  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_ANTI_ALIAS_17                                               */  /*                                                                       */  /*   Define this configuration macro if you want to enable the 17-grays  */  /*   anti-aliasing mode.  Ignored if FT_RASTER_OPTION_ANTI_ALIAS isn't   */  /*   defined.                                                            */  /*                                                                       *//* #define FT_RASTER_ANTI_ALIAS_17 */  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_LITTLE_ENDIAN                                               */  /* FT_RASTER_BIG_ENDIAN                                                  */  /*                                                                       */  /*   The default anti-alias routines are processor-independent, but      */  /*   slow.  Define one of these macros to suit your own system, and      */  /*   enjoy greatly improved rendering speed.                             */  /*                                                                       *//* #define FT_RASTER_LITTLE_ENDIAN *//* #define FT_RASTER_BIG_ENDIAN    */  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_CONSTANT_PRECISION                                          */  /*                                                                       */  /*   Define this configuration macro if you want to use a constant       */  /*   precision for the internal sub-pixel coordinates. Otherwise, the    */  /*   precision is either 64 or 1024 units per pixel, depending on the    */  /*   outline's "high_precision" flag..                                   */  /*                                                                       */  /*   This results in a speed boost, but the macro can be undefined if    */  /*   it results in rendering errors (mainly changed drop-outs)..         */  /*                                                                       */#define FT_RASTER_CONSTANT_PRECISION  /*************************************************************************/  /*                                                                       */  /* FT_PRECISION_BITS                                                     */  /*                                                                       */  /*   When the macro FT_RASTER_CONSTANT_PRECISION is defined, this        */  /*   constant holds the number of bits used for the internal sub-pixels  */  /*                                                                       */  /*   This number should be at least 6, but use at least 8 if you         */  /*   intend to generate small glyph images (use 6 for a printer, for     */  /*   example..)                                                          */  /*                                                                       */#define FT_PRECISION_BITS 8  /*************************************************************************/  /*                                                                       */  /* FT_DYNAMIC_BEZIER_STEPS                                               */  /*                                                                       */  /*   Set this macro to enable the bezier decomposition to be             */  /*   dynamically computed. This is interesting when the precision is     */  /*   constant, as it speeds things a bit while keeping a very good       */  /*   accuracy on the bezier intersections..                              */  /*                                                                       */#define FT_DYNAMIC_BEZIER_STEPS#else /* _STANDALONE_ */#include <freetype.h>#include <ftconfig.h>  /*************************************************************************/  /*                                                                       */  /* The following defines are used when the raster is compiled within the */  /* FreeType base layer.  Don't change these unless you really know what  */  /* you're doing.                                                         */  /*                                                                       */  /*************************************************************************/#ifdef FT_CONFIG_OPTION_ANTI_ALIAS#define FT_RASTER_OPTION_ANTI_ALIAS#endif#define FT_RASTER_CONIC_BEZIERS#define FT_RASTER_CUBIC_BEZIERS#define FT_RASTER_ANTI_ALIAS_5/* #define  FT_RASTER_ANTI_ALIAS_17 */#ifdef FT_CONFIG_OPTION_LITTLE_ENDIAN#define FT_RASTER_LITTLE_ENDIAN#endif#ifdef FT_CONFIG_OPTION_BIG_ENDIAN#define FT_RASTER_BIG_ENDIAN#endif#define FT_RASTER_CONSTANT_PRECISION#define FT_DYNAMIC_BEZIER_STEPS#define FT_PRECISION_BITS    8#endif /* _STANDALONE_ *//* to keep the compiler happy */#ifndef PTRACE2#define PTRACE2(x)  /*void*/#endif  /*************************************************************************/  /*                                                                       */  /* FT_RASTER_ANY_ENDIAN indicates that no endianess was defined by one   */  /* of the configuration macros.                                          */  /*                                                                       */#if !defined( FT_RASTER_LITTLE_ENDIAN ) && !defined( FT_RASTER_BIG_ENDIAN )#define FT_RASTER_ANY_ENDIAN#endif  /*************************************************************************/  /*                                                                       */  /* The rasterizer is a very general purpose component.  Please leave the */  /* following redefinitions here (you never know your target              */  /* environment).                                                         */  /*                                                                       */  /*************************************************************************/#ifndef TRUE#define TRUE   1#endif#ifndef FALSE#define FALSE  0#endif#ifndef NULL#define NULL  (void*)0#endif#ifndef UNUSED#define UNUSED( arg )  ( (void)(arg) )#endif#undef  FAILURE#define FAILURE  TRUE#undef  SUCCESS#define SUCCESS  FALSE#ifndef ABS#define ABS(x)  ( (x) < 0 ? -(x) : (x) )#endif  /*************************************************************************/  /*                                                                       */  /* Please don't touch the following macros. Their importance is          */  /* historical to FreeType, but they have some nice effects, like getting */  /* rid of all `->' symbols when accessing the raster object (replacing   */  /* them with a simple `.').                                              */  /*                                                                       */  /*************************************************************************/  /* used in function signatures to define the _first_ argument */#define RAS_ARG_  FT_Raster  raster,#define RAS_ARG   FT_Raster  raster  /* used to call a function within this component, first parameter */#define RAS_VAR_  raster,#define RAS_VAR   raster  /* used to access the current raster object, with a `.' instead of a */  /* `->'                                                              */#define ras       (*raster)  /*************************************************************************/  /*                                                                       */  /* Error codes returned by the scan-line converter/raster.               */  /*                                                                       */#define ErrRaster_Ok                     0#define ErrRaster_Uninitialized_Object   1#define ErrRaster_Overflow               2#define ErrRaster_Negative_Height        3#define ErrRaster_Invalid_Outline        4#define ErrRaster_Invalid_Map            5#define ErrRaster_AntiAlias_Unsupported  6#define ErrRaster_Invalid_Pool           7#define ErrRaster_Unimplemented          8

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -