2018-06-03 22:00:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftcolor.h
|
|
|
|
*
|
|
|
|
* FreeType's glyph color management (specification).
|
|
|
|
*
|
2022-01-11 10:54:10 +01:00
|
|
|
* Copyright (C) 2018-2022 by
|
2018-06-03 22:00:42 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2018-05-20 22:50:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef FTCOLOR_H_
|
|
|
|
#define FTCOLOR_H_
|
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/freetype.h>
|
2018-05-20 22:50:00 +02:00
|
|
|
|
|
|
|
#ifdef FREETYPE_H
|
|
|
|
#error "freetype.h of FreeType 1 has been loaded!"
|
|
|
|
#error "Please fix the directory search order for header files"
|
|
|
|
#error "so that freetype.h of FreeType 2 is found first."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @section:
|
|
|
|
* color_management
|
|
|
|
*
|
|
|
|
* @title:
|
|
|
|
* Glyph Color Management
|
|
|
|
*
|
|
|
|
* @abstract:
|
2019-02-21 09:19:09 +01:00
|
|
|
* Retrieving and manipulating OpenType's 'CPAL' table data.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* The functions described here allow access and manipulation of color
|
2019-02-21 09:19:09 +01:00
|
|
|
* palette entries in OpenType's 'CPAL' tables.
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_Color
|
|
|
|
*
|
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* This structure models a BGRA color value of a 'CPAL' palette entry.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* The used color space is sRGB; the colors are not pre-multiplied, and
|
|
|
|
* alpha values must be explicitly set.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* blue ::
|
|
|
|
* Blue value.
|
|
|
|
*
|
|
|
|
* green ::
|
|
|
|
* Green value.
|
|
|
|
*
|
|
|
|
* red ::
|
|
|
|
* Red value.
|
|
|
|
*
|
|
|
|
* alpha ::
|
|
|
|
* Alpha value, giving the red, green, and blue color's opacity.
|
|
|
|
*
|
|
|
|
* @since:
|
2018-05-30 09:34:57 +02:00
|
|
|
* 2.10
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
|
|
|
typedef struct FT_Color_
|
|
|
|
{
|
|
|
|
FT_Byte blue;
|
|
|
|
FT_Byte green;
|
|
|
|
FT_Byte red;
|
|
|
|
FT_Byte alpha;
|
|
|
|
|
|
|
|
} FT_Color;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_PALETTE_XXX
|
|
|
|
*
|
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* A list of bit field constants used in the `palette_flags` array of the
|
|
|
|
* @FT_Palette_Data structure to indicate for which background a palette
|
|
|
|
* with a given index is usable.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @values:
|
2018-06-21 00:21:09 +02:00
|
|
|
* FT_PALETTE_FOR_LIGHT_BACKGROUND ::
|
2018-05-20 22:50:00 +02:00
|
|
|
* The palette is appropriate to use when displaying the font on a
|
|
|
|
* light background such as white.
|
|
|
|
*
|
2018-06-21 00:21:09 +02:00
|
|
|
* FT_PALETTE_FOR_DARK_BACKGROUND ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The palette is appropriate to use when displaying the font on a dark
|
|
|
|
* background such as black.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @since:
|
2018-05-30 09:34:57 +02:00
|
|
|
* 2.10
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
2018-06-21 00:21:09 +02:00
|
|
|
#define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01
|
|
|
|
#define FT_PALETTE_FOR_DARK_BACKGROUND 0x02
|
2018-05-20 22:50:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-06 17:37:51 +02:00
|
|
|
* @struct:
|
2018-06-10 21:37:15 +02:00
|
|
|
* FT_Palette_Data
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* This structure holds the data of the 'CPAL' table.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2018-06-06 17:37:51 +02:00
|
|
|
* @fields:
|
|
|
|
* num_palettes ::
|
|
|
|
* The number of palettes.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2018-06-06 17:37:51 +02:00
|
|
|
* palette_name_ids ::
|
2019-08-06 20:38:17 +02:00
|
|
|
* An optional read-only array of palette name IDs with `num_palettes`
|
|
|
|
* elements, corresponding to entries like 'dark' or 'light' in the
|
|
|
|
* font's 'name' table.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* An empty name ID in the 'CPAL' table gets represented as value
|
2018-06-06 17:37:51 +02:00
|
|
|
* 0xFFFF.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2018-07-02 11:50:04 +02:00
|
|
|
* palette_flags ::
|
2019-08-06 20:38:17 +02:00
|
|
|
* An optional read-only array of palette flags with `num_palettes`
|
|
|
|
* elements. Possible values are an ORed combination of
|
2018-06-21 00:21:09 +02:00
|
|
|
* @FT_PALETTE_FOR_LIGHT_BACKGROUND and
|
|
|
|
* @FT_PALETTE_FOR_DARK_BACKGROUND.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2018-06-06 17:37:51 +02:00
|
|
|
* num_palette_entries ::
|
|
|
|
* The number of entries in a single palette. All palettes have the
|
|
|
|
* same size.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2018-06-06 17:37:51 +02:00
|
|
|
* palette_entry_name_ids ::
|
2019-08-06 20:38:17 +02:00
|
|
|
* An optional read-only array of palette entry name IDs with
|
2018-08-24 18:52:30 +02:00
|
|
|
* `num_palette_entries`. In each palette, entries with the same index
|
|
|
|
* have the same function. For example, index~0 might correspond to
|
2019-02-21 09:19:09 +01:00
|
|
|
* string 'outline' in the font's 'name' table to indicate that this
|
2018-08-24 18:52:30 +02:00
|
|
|
* palette entry is used for outlines, index~1 might correspond to
|
|
|
|
* 'fill' to indicate the filling color palette entry, etc.
|
2018-05-30 21:21:19 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* An empty entry name ID in the 'CPAL' table gets represented as value
|
2018-08-24 18:52:30 +02:00
|
|
|
* 0xFFFF.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @note:
|
2018-06-06 17:37:51 +02:00
|
|
|
* Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to
|
|
|
|
* name strings.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-08-05 10:00:41 +02:00
|
|
|
* Use function @FT_Palette_Select to get the colors associated with a
|
|
|
|
* palette entry.
|
|
|
|
*
|
2018-05-20 22:50:00 +02:00
|
|
|
* @since:
|
2018-05-30 09:34:57 +02:00
|
|
|
* 2.10
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
2018-06-10 21:37:15 +02:00
|
|
|
typedef struct FT_Palette_Data_ {
|
2018-06-06 17:37:51 +02:00
|
|
|
FT_UShort num_palettes;
|
|
|
|
const FT_UShort* palette_name_ids;
|
2018-07-02 11:50:04 +02:00
|
|
|
const FT_UShort* palette_flags;
|
2018-06-06 17:37:51 +02:00
|
|
|
|
|
|
|
FT_UShort num_palette_entries;
|
|
|
|
const FT_UShort* palette_entry_name_ids;
|
|
|
|
|
2018-06-10 21:37:15 +02:00
|
|
|
} FT_Palette_Data;
|
2018-05-20 22:50:00 +02:00
|
|
|
|
|
|
|
|
2018-06-06 17:49:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 11:22:37 +02:00
|
|
|
* @function:
|
2018-06-10 21:37:15 +02:00
|
|
|
* FT_Palette_Data_Get
|
2018-06-06 17:49:17 +02:00
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Retrieve the face's color palette data.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* The source face handle.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* apalette ::
|
2018-06-10 21:37:15 +02:00
|
|
|
* A pointer to an @FT_Palette_Data structure.
|
2018-06-06 17:49:17 +02:00
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
|
|
|
* @note:
|
2018-06-10 21:37:15 +02:00
|
|
|
* All arrays in the returned @FT_Palette_Data structure are read-only.
|
2018-06-06 17:49:17 +02:00
|
|
|
*
|
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
|
2018-06-06 17:49:17 +02:00
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.10
|
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Error )
|
2018-06-10 21:37:15 +02:00
|
|
|
FT_Palette_Data_Get( FT_Face face,
|
|
|
|
FT_Palette_Data *apalette );
|
2018-06-06 17:49:17 +02:00
|
|
|
|
|
|
|
|
2018-05-20 22:50:00 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 11:22:37 +02:00
|
|
|
* @function:
|
2018-05-20 22:50:00 +02:00
|
|
|
* FT_Palette_Select
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* This function has two purposes.
|
|
|
|
*
|
|
|
|
* (1) It activates a palette for rendering color glyphs, and
|
|
|
|
*
|
|
|
|
* (2) it retrieves all (unmodified) color entries of this palette. This
|
|
|
|
* function returns a read-write array, which means that a calling
|
|
|
|
* application can modify the palette entries on demand.
|
|
|
|
*
|
|
|
|
* A corollary of (2) is that calling the function, then modifying some
|
|
|
|
* values, then calling the function again with the same arguments resets
|
2019-02-21 09:19:09 +01:00
|
|
|
* all color entries to the original 'CPAL' values; all user modifications
|
2018-05-20 22:50:00 +02:00
|
|
|
* are lost.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* The source face handle.
|
|
|
|
*
|
|
|
|
* palette_index ::
|
|
|
|
* The palette index.
|
|
|
|
*
|
|
|
|
* @output:
|
2018-06-11 09:02:06 +02:00
|
|
|
* apalette ::
|
2019-02-20 16:04:48 +01:00
|
|
|
* An array of color entries for a palette with index `palette_index`,
|
|
|
|
* having `num_palette_entries` elements (as found in the
|
2019-02-20 16:18:40 +01:00
|
|
|
* `FT_Palette_Data` structure). If `apalette` is set to `NULL`, no
|
2019-02-20 16:04:48 +01:00
|
|
|
* array gets returned (and no color entries can be modified).
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
2019-02-20 16:18:40 +01:00
|
|
|
* In case the font doesn't support color palettes, `NULL` is returned.
|
2018-06-10 21:37:15 +02:00
|
|
|
*
|
2018-05-20 22:50:00 +02:00
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
|
|
|
* @note:
|
2018-08-24 18:52:30 +02:00
|
|
|
* The array pointed to by `apalette_entries` is owned and managed by
|
2018-05-20 22:50:00 +02:00
|
|
|
* FreeType.
|
|
|
|
*
|
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @since:
|
2018-05-30 09:34:57 +02:00
|
|
|
* 2.10
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Palette_Select( FT_Face face,
|
|
|
|
FT_UShort palette_index,
|
2018-06-11 09:02:06 +02:00
|
|
|
FT_Color* *apalette );
|
2018-05-20 22:50:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 11:22:37 +02:00
|
|
|
* @function:
|
2018-05-20 22:50:00 +02:00
|
|
|
* FT_Palette_Set_Foreground_Color
|
|
|
|
*
|
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* 'COLR' uses palette index 0xFFFF to indicate a 'text foreground
|
2018-06-11 09:02:06 +02:00
|
|
|
* color'. This function sets this value.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* The source face handle.
|
|
|
|
*
|
|
|
|
* foreground_color ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* An `FT_Color` structure to define the text foreground color.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
|
|
|
* @note:
|
2018-06-06 17:37:51 +02:00
|
|
|
* If this function isn't called, the text foreground color is set to
|
2018-06-07 06:49:44 +02:00
|
|
|
* white opaque (BGRA value 0xFFFFFFFF) if
|
2018-08-24 18:52:30 +02:00
|
|
|
* @FT_PALETTE_FOR_DARK_BACKGROUND is present for the current palette,
|
|
|
|
* and black opaque (BGRA value 0x000000FF) otherwise, including the case
|
2019-02-21 09:19:09 +01:00
|
|
|
* that no palette types are available in the 'CPAL' table.
|
2018-06-06 17:37:51 +02:00
|
|
|
*
|
2018-05-20 22:50:00 +02:00
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
|
2018-05-20 22:50:00 +02:00
|
|
|
*
|
|
|
|
* @since:
|
2018-05-30 09:34:57 +02:00
|
|
|
* 2.10
|
2018-05-20 22:50:00 +02:00
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Error )
|
2018-05-30 21:21:19 +02:00
|
|
|
FT_Palette_Set_Foreground_Color( FT_Face face,
|
2018-05-20 22:50:00 +02:00
|
|
|
FT_Color foreground_color );
|
|
|
|
|
2021-06-22 13:21:49 +02:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @section:
|
|
|
|
* layer_management
|
|
|
|
*
|
|
|
|
* @title:
|
|
|
|
* Glyph Layer Management
|
|
|
|
*
|
|
|
|
* @abstract:
|
|
|
|
* Retrieving and manipulating OpenType's 'COLR' table data.
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* The functions described here allow access of colored glyph layer data
|
|
|
|
* in OpenType's 'COLR' tables.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_LayerIterator
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* This iterator object is needed for @FT_Get_Color_Glyph_Layer.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* num_layers ::
|
|
|
|
* The number of glyph layers for the requested glyph index. Will be
|
|
|
|
* set by @FT_Get_Color_Glyph_Layer.
|
|
|
|
*
|
|
|
|
* layer ::
|
|
|
|
* The current layer. Will be set by @FT_Get_Color_Glyph_Layer.
|
|
|
|
*
|
|
|
|
* p ::
|
|
|
|
* An opaque pointer into 'COLR' table data. The caller must set this
|
|
|
|
* to `NULL` before the first call of @FT_Get_Color_Glyph_Layer.
|
|
|
|
*/
|
|
|
|
typedef struct FT_LayerIterator_
|
|
|
|
{
|
|
|
|
FT_UInt num_layers;
|
|
|
|
FT_UInt layer;
|
|
|
|
FT_Byte* p;
|
|
|
|
|
|
|
|
} FT_LayerIterator;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_Get_Color_Glyph_Layer
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* This is an interface to the 'COLR' table in OpenType fonts to
|
|
|
|
* iteratively retrieve the colored glyph layers associated with the
|
|
|
|
* current glyph slot.
|
|
|
|
*
|
|
|
|
* https://docs.microsoft.com/en-us/typography/opentype/spec/colr
|
|
|
|
*
|
|
|
|
* The glyph layer data for a given glyph index, if present, provides an
|
|
|
|
* alternative, multi-color glyph representation: Instead of rendering
|
|
|
|
* the outline or bitmap with the given glyph index, glyphs with the
|
|
|
|
* indices and colors returned by this function are rendered layer by
|
|
|
|
* layer.
|
|
|
|
*
|
|
|
|
* The returned elements are ordered in the z~direction from bottom to
|
|
|
|
* top; the 'n'th element should be rendered with the associated palette
|
|
|
|
* color and blended on top of the already rendered layers (elements 0,
|
|
|
|
* 1, ..., n-1).
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* A handle to the parent face object.
|
|
|
|
*
|
|
|
|
* base_glyph ::
|
|
|
|
* The glyph index the colored glyph layers are associated with.
|
|
|
|
*
|
|
|
|
* @inout:
|
|
|
|
* iterator ::
|
|
|
|
* An @FT_LayerIterator object. For the first call you should set
|
|
|
|
* `iterator->p` to `NULL`. For all following calls, simply use the
|
|
|
|
* same object again.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* aglyph_index ::
|
|
|
|
* The glyph index of the current layer.
|
|
|
|
*
|
|
|
|
* acolor_index ::
|
|
|
|
* The color index into the font face's color palette of the current
|
|
|
|
* layer. The value 0xFFFF is special; it doesn't reference a palette
|
|
|
|
* entry but indicates that the text foreground color should be used
|
|
|
|
* instead (to be set up by the application outside of FreeType).
|
|
|
|
*
|
|
|
|
* The color palette can be retrieved with @FT_Palette_Select.
|
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* Value~1 if everything is OK. If there are no more layers (or if there
|
|
|
|
* are no layers at all), value~0 gets returned. In case of an error,
|
|
|
|
* value~0 is returned also.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function is necessary if you want to handle glyph layers by
|
|
|
|
* yourself. In particular, functions that operate with @FT_GlyphRec
|
|
|
|
* objects (like @FT_Get_Glyph or @FT_Glyph_To_Bitmap) don't have access
|
|
|
|
* to this information.
|
|
|
|
*
|
|
|
|
* Note that @FT_Render_Glyph is able to handle colored glyph layers
|
|
|
|
* automatically if the @FT_LOAD_COLOR flag is passed to a previous call
|
|
|
|
* to @FT_Load_Glyph. [This is an experimental feature.]
|
|
|
|
*
|
|
|
|
* @example:
|
|
|
|
* ```
|
|
|
|
* FT_Color* palette;
|
|
|
|
* FT_LayerIterator iterator;
|
|
|
|
*
|
|
|
|
* FT_Bool have_layers;
|
|
|
|
* FT_UInt layer_glyph_index;
|
|
|
|
* FT_UInt layer_color_index;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* error = FT_Palette_Select( face, palette_index, &palette );
|
|
|
|
* if ( error )
|
|
|
|
* palette = NULL;
|
|
|
|
*
|
|
|
|
* iterator.p = NULL;
|
|
|
|
* have_layers = FT_Get_Color_Glyph_Layer( face,
|
|
|
|
* glyph_index,
|
|
|
|
* &layer_glyph_index,
|
|
|
|
* &layer_color_index,
|
|
|
|
* &iterator );
|
|
|
|
*
|
|
|
|
* if ( palette && have_layers )
|
|
|
|
* {
|
|
|
|
* do
|
|
|
|
* {
|
|
|
|
* FT_Color layer_color;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* if ( layer_color_index == 0xFFFF )
|
|
|
|
* layer_color = text_foreground_color;
|
|
|
|
* else
|
|
|
|
* layer_color = palette[layer_color_index];
|
|
|
|
*
|
|
|
|
* // Load and render glyph `layer_glyph_index', then
|
|
|
|
* // blend resulting pixmap (using color `layer_color')
|
|
|
|
* // with previously created pixmaps.
|
|
|
|
*
|
|
|
|
* } while ( FT_Get_Color_Glyph_Layer( face,
|
|
|
|
* glyph_index,
|
|
|
|
* &layer_glyph_index,
|
|
|
|
* &layer_color_index,
|
|
|
|
* &iterator ) );
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
FT_EXPORT( FT_Bool )
|
|
|
|
FT_Get_Color_Glyph_Layer( FT_Face face,
|
|
|
|
FT_UInt base_glyph,
|
|
|
|
FT_UInt *aglyph_index,
|
|
|
|
FT_UInt *acolor_index,
|
|
|
|
FT_LayerIterator* iterator );
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_PaintFormat
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Enumeration describing the different paint format types of the v1
|
|
|
|
* extensions to the 'COLR' table, see
|
|
|
|
* 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
*
|
2021-06-22 14:01:19 +02:00
|
|
|
* The enumeration values losely correspond with the format numbers of
|
|
|
|
* the specification: FreeType always returns a fully specified 'Paint'
|
|
|
|
* structure for the 'Transform', 'Translate', 'Scale', 'Rotate', and
|
|
|
|
* 'Skew' table types even though the specification has different formats
|
|
|
|
* depending on whether or not a center is specified, whether the scale
|
|
|
|
* is uniform in x and y~direction or not, etc. Also, only non-variable
|
|
|
|
* format identifiers are listed in this enumeration; as soon as support
|
|
|
|
* for variable 'COLR' v1 fonts is implemented, interpolation is
|
|
|
|
* performed dependent on axis coordinates, which are configured on the
|
|
|
|
* @FT_Face through @FT_Set_Var_Design_Coordinates. This implies that
|
|
|
|
* always static, readily interpolated values are returned in the 'Paint'
|
|
|
|
* structures.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef enum FT_PaintFormat_
|
|
|
|
{
|
|
|
|
FT_COLR_PAINTFORMAT_COLR_LAYERS = 1,
|
|
|
|
FT_COLR_PAINTFORMAT_SOLID = 2,
|
|
|
|
FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 4,
|
|
|
|
FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 6,
|
|
|
|
FT_COLR_PAINTFORMAT_SWEEP_GRADIENT = 8,
|
|
|
|
FT_COLR_PAINTFORMAT_GLYPH = 10,
|
|
|
|
FT_COLR_PAINTFORMAT_COLR_GLYPH = 11,
|
2021-06-22 20:50:48 +02:00
|
|
|
FT_COLR_PAINTFORMAT_TRANSFORM = 12,
|
2021-06-22 13:21:49 +02:00
|
|
|
FT_COLR_PAINTFORMAT_TRANSLATE = 14,
|
2021-06-22 14:01:19 +02:00
|
|
|
FT_COLR_PAINTFORMAT_SCALE = 16,
|
|
|
|
FT_COLR_PAINTFORMAT_ROTATE = 24,
|
|
|
|
FT_COLR_PAINTFORMAT_SKEW = 28,
|
|
|
|
FT_COLR_PAINTFORMAT_COMPOSITE = 32,
|
|
|
|
FT_COLR_PAINT_FORMAT_MAX = 33,
|
2021-06-22 13:21:49 +02:00
|
|
|
FT_COLR_PAINTFORMAT_UNSUPPORTED = 255
|
|
|
|
|
|
|
|
} FT_PaintFormat;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_ColorStopIterator
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* This iterator object is needed for @FT_Get_Colorline_Stops. It keeps
|
2022-07-04 15:29:31 +02:00
|
|
|
* state while iterating over the stops of an @FT_ColorLine, representing
|
|
|
|
* the `ColorLine` struct of the v1 extensions to 'COLR', see
|
|
|
|
* 'https://github.com/googlefonts/colr-gradients-spec'. Do not manually
|
|
|
|
* modify fields of this iterator.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* num_color_stops ::
|
|
|
|
* The number of color stops for the requested glyph index. Set by
|
2022-04-04 21:28:54 +02:00
|
|
|
* @FT_Get_Paint.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* current_color_stop ::
|
|
|
|
* The current color stop. Set by @FT_Get_Colorline_Stops.
|
|
|
|
*
|
|
|
|
* p ::
|
2022-04-04 21:28:54 +02:00
|
|
|
* An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint.
|
|
|
|
* Updated by @FT_Get_Colorline_Stops.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
2022-07-04 15:29:31 +02:00
|
|
|
* read_variable ::
|
|
|
|
* A boolean keeping track of whether variable color lines are to be
|
|
|
|
* read. Set by @FT_Get_Paint.
|
|
|
|
*
|
2021-06-22 13:21:49 +02:00
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_ColorStopIterator_
|
|
|
|
{
|
|
|
|
FT_UInt num_color_stops;
|
|
|
|
FT_UInt current_color_stop;
|
|
|
|
|
|
|
|
FT_Byte* p;
|
|
|
|
|
2022-07-04 15:29:31 +02:00
|
|
|
FT_Bool read_variable;
|
|
|
|
|
2021-06-22 13:21:49 +02:00
|
|
|
} FT_ColorStopIterator;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_ColorIndex
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `ColorIndex` value of the 'COLR' v1
|
|
|
|
* extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* palette_index ::
|
|
|
|
* The palette index into a 'CPAL' palette.
|
|
|
|
*
|
|
|
|
* alpha ::
|
|
|
|
* Alpha transparency value multiplied with the value from 'CPAL'.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_ColorIndex_
|
|
|
|
{
|
|
|
|
FT_UInt16 palette_index;
|
|
|
|
FT_F2Dot14 alpha;
|
|
|
|
|
|
|
|
} FT_ColorIndex;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_ColorStop
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `ColorStop` value of the 'COLR' v1
|
|
|
|
* extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* stop_offset ::
|
2022-06-22 11:33:20 +02:00
|
|
|
* The stop offset along the gradient, expressed as a 16.16 fixed-point
|
|
|
|
* coordinate.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* color ::
|
|
|
|
* The color information for this stop, see @FT_ColorIndex.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_ColorStop_
|
|
|
|
{
|
2022-06-22 11:33:20 +02:00
|
|
|
FT_Fixed stop_offset;
|
2021-06-22 13:21:49 +02:00
|
|
|
FT_ColorIndex color;
|
|
|
|
|
|
|
|
} FT_ColorStop;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_PaintExtend
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* An enumeration representing the 'Extend' mode of the 'COLR' v1
|
|
|
|
* extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
* It describes how the gradient fill continues at the other boundaries.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef enum FT_PaintExtend_
|
|
|
|
{
|
|
|
|
FT_COLR_PAINT_EXTEND_PAD = 0,
|
|
|
|
FT_COLR_PAINT_EXTEND_REPEAT = 1,
|
|
|
|
FT_COLR_PAINT_EXTEND_REFLECT = 2
|
|
|
|
|
|
|
|
} FT_PaintExtend;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_ColorLine
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `ColorLine` value of the 'COLR' v1
|
|
|
|
* extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
* It describes a list of color stops along the defined gradient.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* extend ::
|
|
|
|
* The extend mode at the outer boundaries, see @FT_PaintExtend.
|
|
|
|
*
|
|
|
|
* color_stop_iterator ::
|
|
|
|
* The @FT_ColorStopIterator used to enumerate and retrieve the
|
|
|
|
* actual @FT_ColorStop's.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_ColorLine_
|
|
|
|
{
|
|
|
|
FT_PaintExtend extend;
|
|
|
|
FT_ColorStopIterator color_stop_iterator;
|
|
|
|
|
|
|
|
} FT_ColorLine;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_Affine23
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure used to store a 2x3 matrix. Coefficients are in
|
|
|
|
* 16.16 fixed-point format. The computation performed is
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* x' = x*xx + y*xy + dx
|
|
|
|
* y' = x*yx + y*yy + dy
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* xx ::
|
|
|
|
* Matrix coefficient.
|
|
|
|
*
|
|
|
|
* xy ::
|
|
|
|
* Matrix coefficient.
|
|
|
|
*
|
|
|
|
* dx ::
|
|
|
|
* x translation.
|
|
|
|
*
|
|
|
|
* yx ::
|
|
|
|
* Matrix coefficient.
|
|
|
|
*
|
|
|
|
* yy ::
|
|
|
|
* Matrix coefficient.
|
|
|
|
*
|
|
|
|
* dy ::
|
|
|
|
* y translation.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_Affine_23_
|
|
|
|
{
|
|
|
|
FT_Fixed xx, xy, dx;
|
|
|
|
FT_Fixed yx, yy, dy;
|
|
|
|
|
|
|
|
} FT_Affine23;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_Composite_Mode
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* An enumeration listing the 'COLR' v1 composite modes used in
|
|
|
|
* @FT_PaintComposite. For more details on each paint mode, see
|
|
|
|
* 'https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators'.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef enum FT_Composite_Mode_
|
|
|
|
{
|
|
|
|
FT_COLR_COMPOSITE_CLEAR = 0,
|
|
|
|
FT_COLR_COMPOSITE_SRC = 1,
|
|
|
|
FT_COLR_COMPOSITE_DEST = 2,
|
|
|
|
FT_COLR_COMPOSITE_SRC_OVER = 3,
|
|
|
|
FT_COLR_COMPOSITE_DEST_OVER = 4,
|
|
|
|
FT_COLR_COMPOSITE_SRC_IN = 5,
|
|
|
|
FT_COLR_COMPOSITE_DEST_IN = 6,
|
|
|
|
FT_COLR_COMPOSITE_SRC_OUT = 7,
|
|
|
|
FT_COLR_COMPOSITE_DEST_OUT = 8,
|
|
|
|
FT_COLR_COMPOSITE_SRC_ATOP = 9,
|
|
|
|
FT_COLR_COMPOSITE_DEST_ATOP = 10,
|
|
|
|
FT_COLR_COMPOSITE_XOR = 11,
|
2021-08-09 12:44:55 +02:00
|
|
|
FT_COLR_COMPOSITE_PLUS = 12,
|
|
|
|
FT_COLR_COMPOSITE_SCREEN = 13,
|
|
|
|
FT_COLR_COMPOSITE_OVERLAY = 14,
|
|
|
|
FT_COLR_COMPOSITE_DARKEN = 15,
|
|
|
|
FT_COLR_COMPOSITE_LIGHTEN = 16,
|
|
|
|
FT_COLR_COMPOSITE_COLOR_DODGE = 17,
|
|
|
|
FT_COLR_COMPOSITE_COLOR_BURN = 18,
|
|
|
|
FT_COLR_COMPOSITE_HARD_LIGHT = 19,
|
|
|
|
FT_COLR_COMPOSITE_SOFT_LIGHT = 20,
|
|
|
|
FT_COLR_COMPOSITE_DIFFERENCE = 21,
|
|
|
|
FT_COLR_COMPOSITE_EXCLUSION = 22,
|
|
|
|
FT_COLR_COMPOSITE_MULTIPLY = 23,
|
|
|
|
FT_COLR_COMPOSITE_HSL_HUE = 24,
|
|
|
|
FT_COLR_COMPOSITE_HSL_SATURATION = 25,
|
|
|
|
FT_COLR_COMPOSITE_HSL_COLOR = 26,
|
|
|
|
FT_COLR_COMPOSITE_HSL_LUMINOSITY = 27,
|
|
|
|
FT_COLR_COMPOSITE_MAX = 28
|
2021-06-22 13:21:49 +02:00
|
|
|
|
|
|
|
} FT_Composite_Mode;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_OpaquePaint
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing an offset to a `Paint` value stored in any
|
|
|
|
* of the paint tables of a 'COLR' v1 font. Compare Offset<24> there.
|
|
|
|
* When 'COLR' v1 paint tables represented by FreeType objects such as
|
2021-06-22 20:50:48 +02:00
|
|
|
* @FT_PaintColrLayers, @FT_PaintComposite, or @FT_PaintTransform
|
2021-06-22 13:21:49 +02:00
|
|
|
* reference downstream nested paint tables, we do not immediately
|
|
|
|
* retrieve them but encapsulate their location in this type. Use
|
|
|
|
* @FT_Get_Paint to retrieve the actual @FT_COLR_Paint object that
|
|
|
|
* describes the details of the respective paint table.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* p ::
|
|
|
|
* An internal offset to a Paint table, needs to be set to NULL before
|
|
|
|
* passing this struct as an argument to @FT_Get_Paint.
|
|
|
|
*
|
|
|
|
* insert_root_transform ::
|
|
|
|
* An internal boolean to track whether an initial root transform is
|
|
|
|
* to be provided. Do not set this value.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_Opaque_Paint_
|
|
|
|
{
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Bool insert_root_transform;
|
|
|
|
} FT_OpaquePaint;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_PaintColrLayers
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `PaintColrLayers` table of a 'COLR' v1
|
|
|
|
* font. This table describes a set of layers that are to be composited
|
|
|
|
* with composite mode `FT_COLR_COMPOSITE_SRC_OVER`. The return value
|
|
|
|
* of this function is an @FT_LayerIterator initialized so that it can
|
|
|
|
* be used with @FT_Get_Paint_Layers to retrieve the @FT_OpaquePaint
|
|
|
|
* objects as references to each layer.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* layer_iterator ::
|
|
|
|
* The layer iterator that describes the layers of this paint.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_PaintColrLayers_
|
|
|
|
{
|
|
|
|
FT_LayerIterator layer_iterator;
|
|
|
|
|
|
|
|
} FT_PaintColrLayers;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_PaintSolid
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `PaintSolid` value of the 'COLR' v1
|
|
|
|
* extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
|
|
* Using a `PaintSolid` value means that the glyph layer filled with
|
|
|
|
* this paint is solid-colored and does not contain a gradient.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* color ::
|
|
|
|
* The color information for this solid paint, see @FT_ColorIndex.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_PaintSolid_
|
|
|
|
{
|
|
|
|
FT_ColorIndex color;
|
|
|
|
|
|
|
|
} FT_PaintSolid;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_PaintLinearGradient
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `PaintLinearGradient` value of the 'COLR'
|
|
|
|
* v1 extensions, see
|
|
|
|
* 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
|
|
* layer filled with this paint is drawn filled with a linear gradient.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* colorline ::
|
|
|
|
* The @FT_ColorLine information for this paint, i.e., the list of
|
|
|
|
* color stops along the gradient.
|
|
|
|
*
|
|
|
|
* p0 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The starting point of the gradient definition in font units
|
|
|
|
* represented as a 16.16 fixed-point `FT_Vector`.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* p1 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The end point of the gradient definition in font units
|
|
|
|
* represented as a 16.16 fixed-point `FT_Vector`.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* p2 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* Optional point~p2 to rotate the gradient in font units
|
|
|
|
* represented as a 16.16 fixed-point `FT_Vector`.
|
2021-06-22 13:21:49 +02:00
|
|
|
* Otherwise equal to~p0.
|
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_PaintLinearGradient_
|
|
|
|
{
|
|
|
|
FT_ColorLine colorline;
|
|
|
|
|
|
|
|
/* TODO: Potentially expose those as x0, y0 etc. */
|
|
|
|
FT_Vector p0;
|
|
|
|
FT_Vector p1;
|
|
|
|
FT_Vector p2;
|
|
|
|
|
|
|
|
} FT_PaintLinearGradient;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_PaintRadialGradient
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `PaintRadialGradient` value of the 'COLR'
|
|
|
|
* v1 extensions, see
|
|
|
|
* 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
|
|
* layer filled with this paint is drawn filled filled with a radial
|
|
|
|
* gradient.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* colorline ::
|
|
|
|
* The @FT_ColorLine information for this paint, i.e., the list of
|
|
|
|
* color stops along the gradient.
|
|
|
|
*
|
|
|
|
* c0 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The center of the starting point of the radial gradient in font
|
|
|
|
* units represented as a 16.16 fixed-point `FT_Vector`.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* r0 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The radius of the starting circle of the radial gradient in font
|
|
|
|
* units represented as a 16.16 fixed-point value.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* c1 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The center of the end point of the radial gradient in font units
|
|
|
|
* represented as a 16.16 fixed-point `FT_Vector`.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* r1 ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The radius of the end circle of the radial gradient in font
|
|
|
|
* units represented as a 16.16 fixed-point value.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* @since:
|
|
|
|
* 2.11 -- **currently experimental only!** There might be changes
|
2021-06-29 06:07:00 +02:00
|
|
|
* without retaining backward compatibility of both the API and ABI.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct FT_PaintRadialGradient_
|
|
|
|
{
|
|
|
|
FT_ColorLine colorline;
|
|
|
|
|
|
|
|
FT_Vector c0;
|
2021-11-01 16:32:27 +01:00
|
|
|
FT_Pos r0;
|
2021-06-22 13:21:49 +02:00
|
|
|
FT_Vector c1;
|
2021-11-01 16:32:27 +01:00
|
|
|
FT_Pos r1;
|
2021-06-22 13:21:49 +02:00
|
|
|
|
|
|
|
} FT_PaintRadialGradient;
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_PaintSweepGradient
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure representing a `PaintSweepGradient` value of the 'COLR'
|
|
|
|
* v1 extensions, see
|
|
|
|
* 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
|
|
* layer filled with this paint is drawn filled with a sweep gradient
|
|
|
|
* from `start_angle` to `end_angle`.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* colorline ::
|
|
|
|
* The @FT_ColorLine information for this paint, i.e., the list of
|
|
|
|
* color stops along the gradient.
|
|
|
|
*
|
|
|
|
* center ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The center of the sweep gradient in font units represented as a
|
|
|
|
* vector of 16.16 fixed-point values.
|
2021-06-22 13:21:49 +02:00
|
|
|
*
|
|
|
|
* start_angle ::
|
2021-11-01 16:32:27 +01:00
|
|
|
* The start angle of the sweep gradient in 16.16 fixed-point
|
|