tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ftsdf.h (2914B)


      1 /****************************************************************************
      2 *
      3 * ftsdf.h
      4 *
      5 *   Signed Distance Field support (specification).
      6 *
      7 * Copyright (C) 2020-2025 by
      8 * David Turner, Robert Wilhelm, and Werner Lemberg.
      9 *
     10 * Written by Anuj Verma.
     11 *
     12 * This file is part of the FreeType project, and may only be used,
     13 * modified, and distributed under the terms of the FreeType project
     14 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
     15 * this file you indicate that you have read the license and
     16 * understand and accept it fully.
     17 *
     18 */
     19 
     20 
     21 #ifndef FTSDF_H_
     22 #define FTSDF_H_
     23 
     24 #include <ft2build.h>
     25 #include FT_CONFIG_CONFIG_H
     26 #include <freetype/ftimage.h>
     27 
     28 /* common properties and function */
     29 #include "ftsdfcommon.h"
     30 
     31 FT_BEGIN_HEADER
     32 
     33  /**************************************************************************
     34   *
     35   * @struct:
     36   *   SDF_Raster_Params
     37   *
     38   * @description:
     39   *   This struct must be passed to the raster render function
     40   *   @FT_Raster_RenderFunc instead of @FT_Raster_Params because the
     41   *   rasterizer requires some additional information to render properly.
     42   *
     43   * @fields:
     44   *   root ::
     45   *     The native raster parameters structure.
     46   *
     47   *   spread ::
     48   *     This is an essential parameter/property required by the renderer.
     49   *     `spread` defines the maximum unsigned value that is present in the
     50   *     final SDF output.  For the default value check file
     51   *     `ftsdfcommon.h`.
     52   *
     53   *   flip_sign ::
     54   *     By default positive values indicate positions inside of contours,
     55   *     i.e., filled by a contour.  If this property is true then that
     56   *     output will be the opposite of the default, i.e., negative values
     57   *     indicate positions inside of contours.
     58   *
     59   *   flip_y ::
     60   *     Setting this parameter to true makes the output image flipped
     61   *     along the y-axis.
     62   *
     63   *   overlaps ::
     64   *     Set this to true to generate SDF for glyphs having overlapping
     65   *     contours.  The overlapping support is limited to glyphs that do not
     66   *     have self-intersecting contours.  Also, removing overlaps require a
     67   *     considerable amount of extra memory; additionally, it will not work
     68   *     if generating SDF from bitmap.
     69   *
     70   * @note:
     71   *   All properties are valid for both the 'sdf' and 'bsdf' renderers; the
     72   *   exception is `overlaps`, which gets ignored by the 'bsdf' renderer.
     73   *
     74   */
     75  typedef struct  SDF_Raster_Params_
     76  {
     77    FT_Raster_Params  root;
     78    FT_UInt           spread;
     79    FT_Bool           flip_sign;
     80    FT_Bool           flip_y;
     81    FT_Bool           overlaps;
     82 
     83  } SDF_Raster_Params;
     84 
     85 
     86  /* rasterizer to convert outline to SDF */
     87  FT_EXPORT_VAR( const FT_Raster_Funcs )  ft_sdf_raster;
     88 
     89  /* rasterizer to convert bitmap to SDF */
     90  FT_EXPORT_VAR( const FT_Raster_Funcs )  ft_bitmap_sdf_raster;
     91 
     92 FT_END_HEADER
     93 
     94 #endif /* FTSDF_H_ */
     95 
     96 
     97 /* END */