Commit f87ced9dc98c8f9178e2668b998e7a41d11406f8

Werner Lemberg 2018-06-06T17:49:17

ftcolor.h: Redesign API. While going to implement it I noticed that I need access to most of the `CPAL' elements; I thus plan to add a `cpal' field to `TT_FaceRec', which makes most of the previously suggested API functions obsolete because the fields will be directly accessable.

diff --git a/ChangeLog b/ChangeLog
index 674da28..db224a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-06-06  Werner Lemberg  <wl@gnu.org>
+
+	ftcolor.h: Redesign API.
+
+	While going to implement it I noticed that I need access to most of
+	the `CPAL' elements; I thus plan to add a `cpal' field to
+	`TT_FaceRec', which makes most of the previously suggested API
+	functions obsolete because the fields will be directly accessable.
+
 2018-06-06  Parth Wazurkar  <parthwazurkar@gmail.com>
 
 	[bdf, pcf] Remove deprecated FT_FACE_FLAG_FAST_GLYPHS flag.
diff --git a/include/freetype/ftcolor.h b/include/freetype/ftcolor.h
index c119981..3abe402 100644
--- a/include/freetype/ftcolor.h
+++ b/include/freetype/ftcolor.h
@@ -167,7 +167,7 @@ FT_BEGIN_HEADER
    * @since:
    *   2.10
    */
-  typedef FT_Palette_ {
+  typedef struct  FT_Palette_ {
     FT_UShort         num_palettes;
     const FT_UShort*  palette_name_ids;
     const FT_UShort*  palette_types;
@@ -181,6 +181,39 @@ FT_BEGIN_HEADER
   /**************************************************************************
    *
    * @func:
+   *   FT_Palette_Get
+   *
+   * @description:
+   *   Retrieve the face's color palette data.
+   *
+   * @input:
+   *   face ::
+   *     The source face handle.
+   *
+   * @output:
+   *   apalette ::
+   *     A pointer to an @FT_Palette structure.
+   *
+   * @return:
+   *   FreeType error code.  0~means success.
+   *
+   * @note:
+   *   All arrays in the returned @FT_Palette structure are read-only.
+   *
+   *   This function always returns an error if the config macro
+   *   `TT_CONFIG_OPTION_COLOR_LAYERS' is not defined in `ftoption.h'.
+   *
+   * @since:
+   *   2.10
+   */
+  FT_EXPORT( FT_Error )
+  FT_Palette_Get( FT_Face      face,
+                  FT_Palette  *apalette );
+
+
+  /**************************************************************************
+   *
+   * @func:
    *   FT_Palette_Select
    *
    * @description: