summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2005-09-27 16:25:29 +0000
committerDavid Turner <david@freetype.org>2005-09-27 16:25:29 +0000
commit07c654f441a91596659fc9b0302888e5758f62b7 (patch)
tree84d4c4e76824c870867af2fd78d162ee879f7e8a
parentf44a1f671c4bc0d58f32f4853caa9126c2fd4361 (diff)
downloadfreetype2-07c654f441a91596659fc9b0302888e5758f62b7.tar.gz
* include/freetype/config/ftheader.h, include/freetype/ftrgb.h,
src/rgbfilt/ftrgb.c, src/rgbfilt/ftrgbgen.h, src/rgbfilt/ftrgbgen2.h, src/rgbfilt/Jamfile, src/rgbfilt/rules.mk, Jamfile: Adding color filter for LCD modes, in order to reduce "fringes"
-rw-r--r--ChangeLog7
-rw-r--r--Jamfile1
-rw-r--r--include/freetype/config/ftheader.h1224
-rw-r--r--src/rgbfilt/Jamfile16
-rw-r--r--src/rgbfilt/ftrgb.c319
-rw-r--r--src/rgbfilt/ftrgbgen.h70
-rw-r--r--src/rgbfilt/ftrgbgn2.h65
-rw-r--r--src/rgbfilt/rules.mk35
8 files changed, 1131 insertions, 606 deletions
diff --git a/ChangeLog b/ChangeLog
index 5181a2b8c..e881067fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-09-27 David Turner <david@freetype.org>
+
+ * include/freetype/config/ftheader.h, include/freetype/ftrgb.h,
+ src/rgbfilt/ftrgb.c, src/rgbfilt/ftrgbgen.h, src/rgbfilt/ftrgbgen2.h,
+ src/rgbfilt/Jamfile, src/rgbfilt/rules.mk, Jamfile: Adding color
+ filter for LCD modes, in order to reduce "fringes"
+
2005-09-26 David Turner <david@freetype.org>
* src/autofit/aflatin.c (af_latin_compute_stem_width): fixed bad
diff --git a/Jamfile b/Jamfile
index 40622a34f..4b8bdb80b 100644
--- a/Jamfile
+++ b/Jamfile
@@ -86,6 +86,7 @@ FT2_COMPONENTS ?= autofit # auto-fitter
pshinter # PostScript hinter module
psnames # PostScript names handling
raster # monochrome rasterizer
+ rgbfilt # RGB Color Filter for LCD modes
smooth # anti-aliased rasterizer
sfnt # SFNT-based format support routines
truetype # TrueType font driver
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 9b55f473f..2e29d32e4 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -1,606 +1,618 @@
-/***************************************************************************/
-/* */
-/* ftheader.h */
-/* */
-/* Build macros of the FreeType 2 library. */
-/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005 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 __FT_HEADER_H__
-#define __FT_HEADER_H__
-
-
- /*@***********************************************************************/
- /* */
- /* <Macro> */
- /* FT_BEGIN_HEADER */
- /* */
- /* <Description> */
- /* This macro is used in association with @FT_END_HEADER in header */
- /* files to ensure that the declarations within are properly */
- /* encapsulated in an `extern "C" { .. }' block when included from a */
- /* C++ compiler. */
- /* */
-#ifdef __cplusplus
-#define FT_BEGIN_HEADER extern "C" {
-#else
-#define FT_BEGIN_HEADER /* nothing */
-#endif
-
-
- /*@***********************************************************************/
- /* */
- /* <Macro> */
- /* FT_END_HEADER */
- /* */
- /* <Description> */
- /* This macro is used in association with @FT_BEGIN_HEADER in header */
- /* files to ensure that the declarations within are properly */
- /* encapsulated in an `extern "C" { .. }' block when included from a */
- /* C++ compiler. */
- /* */
-#ifdef __cplusplus
-#define FT_END_HEADER }
-#else
-#define FT_END_HEADER /* nothing */
-#endif
-
-
- /*************************************************************************/
- /* */
- /* Aliases for the FreeType 2 public and configuration files. */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* header_file_macros */
- /* */
- /* <Title> */
- /* Header File Macros */
- /* */
- /* <Abstract> */
- /* Macro definitions used to #include specific header files. */
- /* */
- /* <Description> */
- /* The following macros are defined to the name of specific */
- /* FreeType 2 header files. They can be used directly in #include */
- /* statements as in: */
- /* */
- /* { */
- /* #include FT_FREETYPE_H */
- /* #include FT_MULTIPLE_MASTERS_H */
- /* #include FT_GLYPH_H */
- /* } */
- /* */
- /* There are several reasons why we are now using macros to name */
- /* public header files. The first one is that such macros are not */
- /* limited to the infamous 8.3 naming rule required by DOS (and */
- /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
- /* */
- /* The second reason is that is allows for more flexibility in the */
- /* way FreeType 2 is installed on a given system. */
- /* */
- /*************************************************************************/
-
-
- /* configuration files */
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CONFIG_CONFIG_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* FreeType 2 configuration data. */
- /* */
-#ifndef FT_CONFIG_CONFIG_H
-#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
-#endif
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CONFIG_STANDARD_LIBRARY_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* FreeType 2 configuration data. */
- /* */
-#ifndef FT_CONFIG_STANDARD_LIBRARY_H
-#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
-#endif
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CONFIG_OPTIONS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* FreeType 2 project-specific configuration options. */
- /* */
-#ifndef FT_CONFIG_OPTIONS_H
-#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
-#endif
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CONFIG_MODULES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the list of FreeType 2 modules that are statically linked to new */
- /* library instances in @FT_Init_FreeType. */
- /* */
-#ifndef FT_CONFIG_MODULES_H
-#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
-#endif
-
-
- /* public headers */
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_FREETYPE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the base FreeType 2 API. */
- /* */
-#define FT_FREETYPE_H <freetype/freetype.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_ERRORS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the list of FreeType 2 error codes (and messages). */
- /* */
- /* It is included by @FT_FREETYPE_H. */
- /* */
-#define FT_ERRORS_H <freetype/fterrors.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_MODULE_ERRORS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the list of FreeType 2 module error offsets (and messages). */
- /* */
-#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_SYSTEM_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the FreeType 2 interface to low-level operations (i.e. memory */
- /* management and stream i/o). */
- /* */
- /* It is included by @FT_FREETYPE_H. */
- /* */
-#define FT_SYSTEM_H <freetype/ftsystem.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_IMAGE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* types definitions related to glyph images (i.e. bitmaps, outlines, */
- /* scan-converter parameters). */
- /* */
- /* It is included by @FT_FREETYPE_H. */
- /* */
-#define FT_IMAGE_H <freetype/ftimage.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_TYPES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the basic data types defined by FreeType 2. */
- /* */
- /* It is included by @FT_FREETYPE_H. */
- /* */
-#define FT_TYPES_H <freetype/fttypes.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_LIST_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the list management API of FreeType 2. */
- /* */
- /* (Most applications will never need to include this file.) */
- /* */
-#define FT_LIST_H <freetype/ftlist.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_OUTLINE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the scalable outline management API of FreeType 2. */
- /* */
-#define FT_OUTLINE_H <freetype/ftoutln.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_SIZES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the API used to manage multiple @FT_Size objects per face. */
- /* */
-#define FT_SIZES_H <freetype/ftsizes.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_MODULE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the module management API of FreeType 2. */
- /* */
-#define FT_MODULE_H <freetype/ftmodapi.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_RENDER_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the renderer module management API of FreeType 2. */
- /* */
-#define FT_RENDER_H <freetype/ftrender.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_TYPE1_TABLES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the types and API specific to the Type 1 format. */
- /* */
-#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_TRUETYPE_IDS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the enumeration values used to identify name strings, languages, */
- /* encodings, etc. This file really contains a _large_ set of */
- /* constant macro definitions, taken from the TrueType and OpenType */
- /* specifications. */
- /* */
-#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_TRUETYPE_TABLES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the types and API specific to the TrueType (as well as OpenType) */
- /* format. */
- /* */
-#define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_TRUETYPE_TAGS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the definitions of TrueType 4-byte `tags' used to identify blocks */
- /* in SFNT-based font formats (i.e. TrueType and OpenType). */
- /* */
-#define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_BDF_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the definitions of an API to access BDF-specific strings from a */
- /* face. */
- /* */
-#define FT_BDF_H <freetype/ftbdf.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_GZIP_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the definitions of an API to support for gzip-compressed files. */
- /* */
-#define FT_GZIP_H <freetype/ftgzip.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_LZW_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the definitions of an API to support for LZW-compressed files. */
- /* */
-#define FT_LZW_H <freetype/ftlzw.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_WINFONTS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the definitions of an API to support Windows .FNT files */
- /* */
-#define FT_WINFONTS_H <freetype/ftwinfnt.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_GLYPH_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the API of the optional glyph management component. */
- /* */
-#define FT_GLYPH_H <freetype/ftglyph.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_BITMAP_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the API of the optional bitmap conversion component. */
- /* */
-#define FT_BITMAP_H <freetype/ftbitmap.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_BBOX_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the API of the optional exact bounding box computation routines. */
- /* */
-#define FT_BBOX_H <freetype/ftbbox.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CACHE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the API of the optional FreeType 2 cache sub-system. */
- /* */
-#define FT_CACHE_H <freetype/ftcache.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CACHE_IMAGE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the `glyph image' API of the FreeType 2 cache sub-system. */
- /* */
- /* It is used to define a cache for @FT_Glyph elements. You can also */
- /* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */
- /* to store small glyph bitmaps, as it will use less memory. */
- /* */
- /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
- /* glyph image-related cache declarations. */
- /* */
-#define FT_CACHE_IMAGE_H FT_CACHE_H
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CACHE_SMALL_BITMAPS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the `small bitmaps' API of the FreeType 2 cache sub-system. */
- /* */
- /* It is used to define a cache for small glyph bitmaps in a */
- /* relatively memory-efficient way. You can also use the API defined */
- /* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */
- /* including scalable outlines. */
- /* */
- /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
- /* small bitmaps-related cache declarations. */
- /* */
-#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_CACHE_CHARMAP_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the `charmap' API of the FreeType 2 cache sub-system. */
- /* */
- /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
- /* charmap-based cache declarations. */
- /* */
-#define FT_CACHE_CHARMAP_H FT_CACHE_H
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_MAC_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the Macintosh-specific FreeType 2 API. The latter is used to */
- /* access fonts embedded in resource forks. */
- /* */
- /* This header file must be explicitly included by client */
- /* applications compiled on the Mac (note that the base API still */
- /* works though). */
- /* */
-#define FT_MAC_H <freetype/ftmac.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_MULTIPLE_MASTERS_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the optional multiple-masters management API of FreeType 2. */
- /* */
-#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_SFNT_NAMES_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the optional FreeType 2 API used to access embedded `name' strings */
- /* in SFNT-based font formats (i.e. TrueType and OpenType). */
- /* */
-#define FT_SFNT_NAMES_H <freetype/ftsnames.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_OPENTYPE_VALIDATE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the optional FreeType 2 API used to validate OpenType tables */
- /* (BASE, GDEF, GPOS, GSUB, JSTF). */
- /* */
-#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
-
-
- /*************************************************************************/
- /* */
- /* @macro: */
- /* FT_GX_VALIDATE_H */
- /* */
- /* @description: */
- /* A macro used in #include statements to name the file containing */
- /* the optional FreeType 2 API used to validate TrueTypeGX/AAT tables */
- /* (feat, mort, morx, bsln, just, kern, opbd, trak, prop). */
- /* */
-#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
-
-
- /* */
-
-#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
-#define FT_STROKER_H <freetype/ftstroke.h>
-#define FT_SYNTHESIS_H <freetype/ftsynth.h>
-#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
-
-#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
-
-#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h>
-#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h>
-#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
-#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
-#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h>
-#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h>
-
-
-#define FT_XFREE86_H <freetype/ftxf86.h>
-
-#define FT_INCREMENTAL_H <freetype/ftincrem.h>
-
-#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
-
- /* now include internal headers definitions from <freetype/internal/...> */
-
-#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
-#include FT_INTERNAL_INTERNAL_H
-
-
-#endif /* __FT2_BUILD_H__ */
-
-
-/* END */
+/***************************************************************************/
+/* */
+/* ftheader.h */
+/* */
+/* Build macros of the FreeType 2 library. */
+/* */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005 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 __FT_HEADER_H__
+#define __FT_HEADER_H__
+
+
+ /*@***********************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_BEGIN_HEADER */
+ /* */
+ /* <Description> */
+ /* This macro is used in association with @FT_END_HEADER in header */
+ /* files to ensure that the declarations within are properly */
+ /* encapsulated in an `extern "C" { .. }' block when included from a */
+ /* C++ compiler. */
+ /* */
+#ifdef __cplusplus
+#define FT_BEGIN_HEADER extern "C" {
+#else
+#define FT_BEGIN_HEADER /* nothing */
+#endif
+
+
+ /*@***********************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_END_HEADER */
+ /* */
+ /* <Description> */
+ /* This macro is used in association with @FT_BEGIN_HEADER in header */
+ /* files to ensure that the declarations within are properly */
+ /* encapsulated in an `extern "C" { .. }' block when included from a */
+ /* C++ compiler. */
+ /* */
+#ifdef __cplusplus
+#define FT_END_HEADER }
+#else
+#define FT_END_HEADER /* nothing */
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* Aliases for the FreeType 2 public and configuration files. */
+ /* */
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* <Section> */
+ /* header_file_macros */
+ /* */
+ /* <Title> */
+ /* Header File Macros */
+ /* */
+ /* <Abstract> */
+ /* Macro definitions used to #include specific header files. */
+ /* */
+ /* <Description> */
+ /* The following macros are defined to the name of specific */
+ /* FreeType 2 header files. They can be used directly in #include */
+ /* statements as in: */
+ /* */
+ /* { */
+ /* #include FT_FREETYPE_H */
+ /* #include FT_MULTIPLE_MASTERS_H */
+ /* #include FT_GLYPH_H */
+ /* } */
+ /* */
+ /* There are several reasons why we are now using macros to name */
+ /* public header files. The first one is that such macros are not */
+ /* limited to the infamous 8.3 naming rule required by DOS (and */
+ /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
+ /* */
+ /* The second reason is that is allows for more flexibility in the */
+ /* way FreeType 2 is installed on a given system. */
+ /* */
+ /*************************************************************************/
+
+
+ /* configuration files */
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CONFIG_CONFIG_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* FreeType 2 configuration data. */
+ /* */
+#ifndef FT_CONFIG_CONFIG_H
+#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CONFIG_STANDARD_LIBRARY_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* FreeType 2 configuration data. */
+ /* */
+#ifndef FT_CONFIG_STANDARD_LIBRARY_H
+#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CONFIG_OPTIONS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* FreeType 2 project-specific configuration options. */
+ /* */
+#ifndef FT_CONFIG_OPTIONS_H
+#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CONFIG_MODULES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the list of FreeType 2 modules that are statically linked to new */
+ /* library instances in @FT_Init_FreeType. */
+ /* */
+#ifndef FT_CONFIG_MODULES_H
+#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
+#endif
+
+
+ /* public headers */
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_FREETYPE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the base FreeType 2 API. */
+ /* */
+#define FT_FREETYPE_H <freetype/freetype.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_ERRORS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the list of FreeType 2 error codes (and messages). */
+ /* */
+ /* It is included by @FT_FREETYPE_H. */
+ /* */
+#define FT_ERRORS_H <freetype/fterrors.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_MODULE_ERRORS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the list of FreeType 2 module error offsets (and messages). */
+ /* */
+#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_SYSTEM_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the FreeType 2 interface to low-level operations (i.e. memory */
+ /* management and stream i/o). */
+ /* */
+ /* It is included by @FT_FREETYPE_H. */
+ /* */
+#define FT_SYSTEM_H <freetype/ftsystem.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_IMAGE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* types definitions related to glyph images (i.e. bitmaps, outlines, */
+ /* scan-converter parameters). */
+ /* */
+ /* It is included by @FT_FREETYPE_H. */
+ /* */
+#define FT_IMAGE_H <freetype/ftimage.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_TYPES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the basic data types defined by FreeType 2. */
+ /* */
+ /* It is included by @FT_FREETYPE_H. */
+ /* */
+#define FT_TYPES_H <freetype/fttypes.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_LIST_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the list management API of FreeType 2. */
+ /* */
+ /* (Most applications will never need to include this file.) */
+ /* */
+#define FT_LIST_H <freetype/ftlist.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_OUTLINE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the scalable outline management API of FreeType 2. */
+ /* */
+#define FT_OUTLINE_H <freetype/ftoutln.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_SIZES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the API used to manage multiple @FT_Size objects per face. */
+ /* */
+#define FT_SIZES_H <freetype/ftsizes.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_MODULE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the module management API of FreeType 2. */
+ /* */
+#define FT_MODULE_H <freetype/ftmodapi.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_RENDER_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the renderer module management API of FreeType 2. */
+ /* */
+#define FT_RENDER_H <freetype/ftrender.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_TYPE1_TABLES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the types and API specific to the Type 1 format. */
+ /* */
+#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_TRUETYPE_IDS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the enumeration values used to identify name strings, languages, */
+ /* encodings, etc. This file really contains a _large_ set of */
+ /* constant macro definitions, taken from the TrueType and OpenType */
+ /* specifications. */
+ /* */
+#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_TRUETYPE_TABLES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the types and API specific to the TrueType (as well as OpenType) */
+ /* format. */
+ /* */
+#define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_TRUETYPE_TAGS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the definitions of TrueType 4-byte `tags' used to identify blocks */
+ /* in SFNT-based font formats (i.e. TrueType and OpenType). */
+ /* */
+#define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_BDF_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the definitions of an API to access BDF-specific strings from a */
+ /* face. */
+ /* */
+#define FT_BDF_H <freetype/ftbdf.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_GZIP_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the definitions of an API to support for gzip-compressed files. */
+ /* */
+#define FT_GZIP_H <freetype/ftgzip.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_LZW_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the definitions of an API to support for LZW-compressed files. */
+ /* */
+#define FT_LZW_H <freetype/ftlzw.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_WINFONTS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the definitions of an API to support Windows .FNT files */
+ /* */
+#define FT_WINFONTS_H <freetype/ftwinfnt.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_GLYPH_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the API of the optional glyph management component. */
+ /* */
+#define FT_GLYPH_H <freetype/ftglyph.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_BITMAP_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the API of the optional bitmap conversion component. */
+ /* */
+#define FT_BITMAP_H <freetype/ftbitmap.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_BBOX_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the API of the optional exact bounding box computation routines. */
+ /* */
+#define FT_BBOX_H <freetype/ftbbox.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CACHE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the API of the optional FreeType 2 cache sub-system. */
+ /* */
+#define FT_CACHE_H <freetype/ftcache.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CACHE_IMAGE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the `glyph image' API of the FreeType 2 cache sub-system. */
+ /* */
+ /* It is used to define a cache for @FT_Glyph elements. You can also */
+ /* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */
+ /* to store small glyph bitmaps, as it will use less memory. */
+ /* */
+ /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
+ /* glyph image-related cache declarations. */
+ /* */
+#define FT_CACHE_IMAGE_H FT_CACHE_H
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CACHE_SMALL_BITMAPS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the `small bitmaps' API of the FreeType 2 cache sub-system. */
+ /* */
+ /* It is used to define a cache for small glyph bitmaps in a */
+ /* relatively memory-efficient way. You can also use the API defined */
+ /* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */
+ /* including scalable outlines. */
+ /* */
+ /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
+ /* small bitmaps-related cache declarations. */
+ /* */
+#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_CACHE_CHARMAP_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the `charmap' API of the FreeType 2 cache sub-system. */
+ /* */
+ /* This macro is deprecated. Simply include @FT_CACHE_H to have all */
+ /* charmap-based cache declarations. */
+ /* */
+#define FT_CACHE_CHARMAP_H FT_CACHE_H
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_MAC_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the Macintosh-specific FreeType 2 API. The latter is used to */
+ /* access fonts embedded in resource forks. */
+ /* */
+ /* This header file must be explicitly included by client */
+ /* applications compiled on the Mac (note that the base API still */
+ /* works though). */
+ /* */
+#define FT_MAC_H <freetype/ftmac.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_MULTIPLE_MASTERS_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the optional multiple-masters management API of FreeType 2. */
+ /* */
+#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_SFNT_NAMES_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the optional FreeType 2 API used to access embedded `name' strings */
+ /* in SFNT-based font formats (i.e. TrueType and OpenType). */
+ /* */
+#define FT_SFNT_NAMES_H <freetype/ftsnames.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_OPENTYPE_VALIDATE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the optional FreeType 2 API used to validate OpenType tables */
+ /* (BASE, GDEF, GPOS, GSUB, JSTF). */
+ /* */
+#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_GX_VALIDATE_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the optional FreeType 2 API used to validate TrueTypeGX/AAT tables */
+ /* (feat, mort, morx, bsln, just, kern, opbd, trak, prop). */
+ /* */
+#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
+
+
+ /*************************************************************************/
+ /* */
+ /* @macro: */
+ /* FT_RGB_FILTER_H */
+ /* */
+ /* @description: */
+ /* A macro used in #include statements to name the file containing */
+ /* the optional FreeType 2 API used to perform RGB decimated color */
+ /* filtering. */
+ /* */
+#define FT_RGB_FILTER_H <freetype/ftrgb.h>
+
+ /* */
+
+#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
+#define FT_STROKER_H <freetype/ftstroke.h>
+#define FT_SYNTHESIS_H <freetype/ftsynth.h>
+#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
+
+#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
+
+#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h>
+#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h>
+#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
+#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
+#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h>
+#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h>
+
+
+#define FT_XFREE86_H <freetype/ftxf86.h>
+
+#define FT_INCREMENTAL_H <freetype/ftincrem.h>
+
+#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
+
+ /* now include internal headers definitions from <freetype/internal/...> */
+
+#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
+#include FT_INTERNAL_INTERNAL_H
+
+
+#endif /* __FT2_BUILD_H__ */
+
+
+/* END */
diff --git a/src/rgbfilt/Jamfile b/src/rgbfilt/Jamfile
new file mode 100644
index 000000000..c5a51fcda
--- /dev/null
+++ b/src/rgbfilt/Jamfile
@@ -0,0 +1,16 @@
+# FreeType 2 src/rgbfilt Jamfile
+#
+# Copyright 2005 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.
+
+SubDir FT2_TOP $(FT2_SRC_DIR) rgbfilt ;
+
+Library $(FT2_LIB) : ftrgb.c ;
+
+# end of src/rgbfilt Jamfile
diff --git a/src/rgbfilt/ftrgb.c b/src/rgbfilt/ftrgb.c
new file mode 100644
index 000000000..afa8dbbec
--- /dev/null
+++ b/src/rgbfilt/ftrgb.c
@@ -0,0 +1,319 @@
+#include <ft2build.h>
+#include FT_RGB_FILTER_H
+#include FT_INTERNAL_OBJECTS_H
+
+typedef struct FT_RgbFilterRec_
+{
+ FT_Fixed factors[9];
+ FT_Memory memory;
+
+} FT_RgbFilterRec;
+
+typedef struct FT_RgbFilterinRec_
+{
+ FT_Fixed factors[9];
+ FT_Byte* in_line;
+ FT_Long in_pitch;
+ FT_Byte* out_line;
+ FT_Long out_pitch;
+ FT_Int width;
+ FT_Int height;
+
+} FT_RgbFilteringRec, *FT_RgbFiltering;
+
+
+/* these values come from libXft */
+static const FT_RgbFilterRec ft_rgbfilter_default =
+{
+ { 65538*9/13, 65538*3/13, 65538*1/13,
+ 65538*1/6, 65538*4/6, 65538*1/6,
+ 65538*1/13, 65538*3/13, 65538*9/13 },
+ NULL
+};
+
+static void
+ft_rgbfilter_apply_argb_rgb( FT_RgbFiltering oper )
+{
+#define HMUL 3
+#define VMUL 1
+#define OFF_R 0
+#define OFF_G 1
+#define OFF_B 2
+#include "ftrgbgen.h"
+}
+
+
+static void
+ft_rgbfilter_apply_argb_bgr( FT_RgbFiltering oper )
+{
+#define HMUL 3
+#define VMUL 1
+#define OFF_R 2
+#define OFF_G 1
+#define OFF_B 0
+#include "ftrgbgen.h"
+}
+
+
+static void
+ft_rgbfilter_apply_argb_vrgb( FT_RgbFiltering oper )
+{
+#define HMUL 1
+#define VMUL 3
+#define OFF_R 0
+#define OFF_G 1
+#define OFF_B 2
+#include "ftrgbgen.h"
+}
+
+
+static void
+ft_rgbfilter_apply_argb_vbgr( FT_RgbFiltering oper )
+{
+#define HMUL 1
+#define VMUL 3
+#define OFF_R 2
+#define OFF_G 1
+#define OFF_B 0
+#include "ftrgbgen.h"
+}
+
+
+
+static void
+ft_rgbfilter_apply_inplace_rgb( FT_RgbFiltering oper )
+{
+#define HMUL 3
+#define VMUL 1
+#define OFF_R 0
+#define OFF_G 1
+#define OFF_B 2
+#include "ftrgbgn2.h"
+}
+
+
+static void
+ft_rgbfilter_apply_inplace_bgr( FT_RgbFiltering oper )
+{
+#define HMUL 3
+#define VMUL 1
+#define OFF_R 2
+#define OFF_G 1
+#define OFF_B 0
+#include "ftrgbgn2.h"
+}
+
+
+static void
+ft_rgbfilter_apply_inplace_vrgb( FT_RgbFiltering oper )
+{
+#define HMUL 1
+#define VMUL 3
+#define OFF_R 0
+#define OFF_G 1
+#define OFF_B 2
+#include "ftrgbgn2.h"
+}
+
+
+static void
+ft_rgbfilter_apply_inplace_vbgr( FT_RgbFiltering oper )
+{
+#define HMUL 1
+#define VMUL 3
+#define OFF_R 2
+#define OFF_G 1
+#define OFF_B 0
+#include "ftrgbgn2.h"
+}
+
+
+
+FT_EXPORT_DEF( FT_Error )
+FT_RgbFilter_ApplyARGB( FT_RgbFilter filter,
+ FT_Bool inverted,
+ FT_Pixel_Mode in_mode,
+ FT_Byte* in_bytes,
+ FT_Long in_pitch,
+ FT_Int out_width,
+ FT_Int out_height,
+ FT_UInt32* out_bytes,
+ FT_Long out_pitch )
+{
+ FT_RgbFilteringRec oper;
+ int in_width = out_width;
+ int in_height = out_height;
+
+ switch ( in_mode )
+ {
+ case FT_PIXEL_MODE_LCD:
+ in_width = 3*out_width;
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ in_height = 3*out_height;
+ break;
+
+ default:
+ return FT_Err_Invalid_Argument;
+ }
+
+ if ( FT_ABS(in_pitch) < in_width ||
+ FT_ABS(out_pitch) < 4*out_width )
+ return FT_Err_Invalid_Argument;
+
+ oper.width = out_width;
+ oper.height = out_height;
+
+ oper.in_line = in_bytes;
+ oper.in_pitch = in_pitch;
+ if ( in_pitch < 0 )
+ oper.in_line -= in_pitch*(in_height-1);
+
+ oper.out_line = (FT_Byte*) out_bytes;
+ oper.out_pitch = out_pitch;
+ if ( out_pitch < 0 )
+ oper.out_line -= out_pitch*(out_height-1);
+
+ if ( filter == NULL )
+ filter = (FT_RgbFilter)&ft_rgbfilter_default;
+
+ FT_ARRAY_COPY( oper.factors, filter->factors, 9 );
+
+ switch ( in_mode )
+ {
+ case FT_PIXEL_MODE_LCD:
+ if ( inverted )
+ ft_rgbfilter_apply_argb_bgr( &oper );
+ else
+ ft_rgbfilter_apply_argb_rgb( &oper );
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ if ( inverted )
+ ft_rgbfilter_apply_argb_vbgr( &oper );
+ else
+ ft_rgbfilter_apply_argb_vrgb( &oper );
+ break;
+
+ default:
+ ;
+ }
+ return 0;
+}
+
+
+FT_EXPORT_DEF( FT_Error )
+FT_RgbFilter_ApplyInPlace( FT_RgbFilter filter,
+ FT_Bool inverted,
+ FT_Pixel_Mode in_mode,
+ FT_Byte* in_bytes,
+ FT_Long in_pitch,
+ FT_Int org_width,
+ FT_Int org_height )
+{
+ FT_RgbFilteringRec oper;
+ int in_width = org_width;
+ int in_height = org_height;
+
+ switch ( in_mode )
+ {
+ case FT_PIXEL_MODE_LCD:
+ in_width = 3*org_width;
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ in_height = 3*org_height;
+ break;
+
+ default:
+ return FT_Err_Invalid_Argument;
+ }
+
+ if ( FT_ABS(in_pitch) < in_width )
+ return FT_Err_Invalid_Argument;
+
+ oper.width = org_width;
+ oper.height = org_height;
+
+ oper.in_line = in_bytes;
+ oper.in_pitch = in_pitch;
+ if ( in_pitch < 0 )
+ oper.in_line -= in_pitch*(in_height-1);
+
+ if ( filter == NULL )
+ filter = (FT_RgbFilter)&ft_rgbfilter_default;
+
+ FT_ARRAY_COPY( oper.factors, filter->factors, 9 );
+
+ switch ( in_mode )
+ {
+ case FT_PIXEL_MODE_LCD:
+ if ( inverted )
+ ft_rgbfilter_apply_inplace_bgr( &oper );
+ else
+ ft_rgbfilter_apply_inplace_rgb( &oper );
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ if ( inverted )
+ ft_rgbfilter_apply_inplace_vbgr( &oper );
+ else
+ ft_rgbfilter_apply_inplace_vrgb( &oper );
+ break;
+
+ default:
+ ;
+ }
+ return 0;
+}
+
+
+
+
+FT_EXPORT_DEF( FT_Error )
+FT_RgbFilter_New( FT_Library library,
+ FT_Fixed* values_9,
+ FT_RgbFilter *pfilter )
+{
+ FT_Error error = 0;
+ FT_RgbFilter filter = NULL;
+
+ if ( !library || !values_9 )
+ error = FT_Err_Invalid_Argument;
+ else
+ {
+ FT_Memory memory = library->memory;
+
+ if ( !FT_NEW( filter ) )
+ {
+ FT_ARRAY_COPY( filter->factors, values_9, 9 );
+ filter->memory = memory;
+ }
+ }
+ *pfilter = filter;
+ return error;
+}
+
+
+FT_EXPORT_DEF( void )
+FT_RgbFilter_Done( FT_RgbFilter filter )
+{
+ if ( filter )
+ {
+ FT_Memory memory = filter->memory;
+
+ filter->memory = NULL;
+ if ( memory )
+ FT_FREE( filter );
+ }
+}
+
+
+FT_EXPORT_DEF( void )
+FT_RgbFilter_Reset( FT_RgbFilter filter,
+ FT_Fixed* values_9 )
+{
+ if ( filter && values_9 )
+ FT_ARRAY_COPY( filter->factors, values_9, 9 );
+}
diff --git a/src/rgbfilt/ftrgbgen.h b/src/rgbfilt/ftrgbgen.h
new file mode 100644
index 000000000..da7cf15c0
--- /dev/null
+++ b/src/rgbfilt/ftrgbgen.h
@@ -0,0 +1,70 @@
+/* this file contains a template for the RGB color filter algorithm
+ * it is included several times by "ftrgb.c"
+ */
+#ifndef OFF_R
+#error "OFF_R must be defined as the offset of the red channel"
+#endif
+
+#ifndef OFF_G
+#error "OFF_G must be defiend as the offset of the green channel"
+#endif
+
+#ifndef OFF_B
+#error "OFF_B must be defined as the offset of the blue channel"
+#endif
+
+#ifndef HMUL
+#error "HMUL must be defined as the horizontal multiplier, either 1 or 3"
+#endif
+
+#ifndef VMUL
+#error "VMUL must be defined as the vertical multipler, either 1 or 3"
+#endif
+
+
+ int hh = oper->height;
+ FT_Byte* in_line = oper->in_line;
+ FT_Long in_pitch = oper->in_pitch;
+ FT_Byte* out_line = oper->out_line;
+ FT_Long out_pitch = oper->out_pitch;
+ FT_Fixed* mults = oper->factors;
+
+ for ( ; hh > 0; hh--, in_line += in_pitch*VMUL, out_line += out_pitch )
+ {
+ int ww = oper->width;
+ FT_Byte* read = in_line;
+ FT_UInt32* write = (FT_UInt32*)out_line;
+
+ for ( ; ww > 0; ww--, read += HMUL, write += 1 )
+ {
+ FT_UInt rr, gg, bb;
+ FT_UInt val;
+
+ val = read[OFF_R];
+ rr = mults[0]*val;
+ gg = mults[3]*val;
+ bb = mults[6]*val;
+
+ val = read[OFF_G];
+ rr += mults[1]*val;
+ gg += mults[4]*val;
+ bb += mults[7]*val;
+
+ val = read[OFF_B];
+ rr += mults[2]*val;
+ gg += mults[5]*val;
+ bb += mults[8]*val;
+
+ rr = (rr >> 16) & 255;
+ gg = (gg >> 16) & 255;
+ bb = (bb >> 16) & 255;
+
+ write[0] = (FT_UInt)( (gg << 24) | (rr << 16) | (gg << 8) | bb );
+ }
+ }
+
+#undef OFF_R
+#undef OFF_G
+#undef OFF_B
+#undef HMUL
+#undef VMUL
diff --git a/src/rgbfilt/ftrgbgn2.h b/src/rgbfilt/ftrgbgn2.h
new file mode 100644
index 000000000..b3d9365cb
--- /dev/null
+++ b/src/rgbfilt/ftrgbgn2.h
@@ -0,0 +1,65 @@
+/* this file contains a template for the in-place RGB color filter algorithm
+ * it is included several times by "ftrgb.c"
+ */
+#ifndef OFF_R
+#error "OFF_R must be defined as the offset of the red channel"
+#endif
+
+#ifndef OFF_G
+#error "OFF_G must be defiend as the offset of the green channel"
+#endif
+
+#ifndef OFF_B
+#error "OFF_B must be defined as the offset of the blue channel"
+#endif
+
+#ifndef HMUL
+#error "HMUL must be defined as the horizontal multiplier, either 1 or 3"
+#endif
+
+#ifndef VMUL
+#error "VMUL must be defined as the vertical multipler, either 1 or 3"
+#endif
+
+
+ int hh = oper->height;
+ FT_Byte* in_line = oper->in_line;
+ FT_Long in_pitch = oper->in_pitch;
+ FT_Fixed* mults = oper->factors;
+
+ for ( ; hh > 0; hh--, in_line += in_pitch*VMUL )
+ {
+ int ww = oper->width;
+ FT_Byte* pix = in_line;
+
+ for ( ; ww > 0; ww--, pix += HMUL )
+ {
+ FT_UInt rr, gg, bb;
+ FT_UInt val;
+
+ val = pix[OFF_R];
+ rr = mults[0]*val;
+ gg = mults[3]*val;
+ bb = mults[6]*val;
+
+ val = pix[OFF_G];
+ rr += mults[1]*val;
+ gg += mults[4]*val;
+ bb += mults[7]*val;
+
+ val = pix[OFF_B];
+ rr += mults[2]*val;
+ gg += mults[5]*val;
+ bb += mults[8]*val;
+
+ pix[OFF_R] = (FT_Byte)(rr >> 16);
+ pix[OFF_G] = (FT_Byte)(gg >> 16);
+ pix[OFF_B] = (FT_Byte)(bb >> 16);
+ }
+ }
+
+#undef OFF_R
+#undef OFF_G
+#undef OFF_B
+#undef HMUL
+#undef VMUL
diff --git a/src/rgbfilt/rules.mk b/src/rgbfilt/rules.mk
new file mode 100644
index 000000000..b5be6b5f7
--- /dev/null
+++ b/src/rgbfilt/rules.mk
@@ -0,0 +1,35 @@
+#
+# FreeType 2 RGB filter configuration rules
+#
+
+# rgb driver directory
+#
+RGBFILT_DIR := $(SRC_DIR)/rgbfilt
+
+
+RGBFILT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(RGBFILT_DIR))
+
+
+# RGB filter sources (i.e., C files)
+#
+RGBFILT_DRV_SRC := $(RGBFILT_DIR)/ftrgb.c
+
+# RGB filter driver headers
+#
+RGBFILT_DRV_H := $(RGBFILT_DIR)/ftrgbgen.h \
+ $(RGBFILT_DIR)/ftrgbgn2.h
+
+# RGB filter driver object(s)
+#
+RGBFILT_DRV_OBJ := $(RGBFILT_DRV_SRC:$(RGBFILT_DIR)/%.c=$(OBJ_DIR)/%.$O)
+
+$(RGBFILT_DRV_OBJ): $(RGBFILT_DRV_SRC) $(FREETYPE_H) $(RGBFILT_DRV_H)
+ $(RGBFILT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(RGBFILT_DRV_SRC))
+
+# update main driver object lists
+#
+DRV_OBJS_S += $(RGBFILT_DRV_OBJ)
+DRV_OBJS_M += $(RGBFILT_DRV_OBJ)
+
+
+# EOF