[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] anuj-distance-field d928ca8 03/95: added new `FT_RENDER_MODE
From: |
Anuj Verma |
Subject: |
[freetype2] anuj-distance-field d928ca8 03/95: added new `FT_RENDER_MODE_SDF' |
Date: |
Sun, 2 Aug 2020 01:10:24 -0400 (EDT) |
branch: anuj-distance-field
commit d928ca897b7eec37d653b80e13cf26c3ef78a6d9
Author: Anuj Verma <anujv@iitbhilai.ac.in>
Commit: Anuj Verma <anujv@iitbhilai.ac.in>
added new `FT_RENDER_MODE_SDF'
---
[GSoC]ChangeLog | 10 ++++++++++
include/freetype/freetype.h | 20 ++++++++++++++++----
src/sdf/ftsdfrend.h | 2 +-
src/sdf/module.mk | 2 +-
src/sdf/rules.mk | 2 +-
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog
index 7c8d792..076a7eb 100644
--- a/[GSoC]ChangeLog
+++ b/[GSoC]ChangeLog
@@ -1,3 +1,13 @@
+2020-06-19 Anuj Verma <anujv@iitbhilai.ac.in>
+
+ * include/freetype/freetype.h (FT_Render_Mode_): Added new
+ rendermode `FT_RENDER_MODE_SDF' which will be used by the
+ `sdf' module to generate signed distance fields from glyph's
+ outline.
+
+ * src/sdf/ftsdfrend.h, src/sdf/module.mk, src/sdf/rules.mk:
+ Add a new line at the end of files.
+
2020-06-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added the structure of a new module to render
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 71e22a1..de06623 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3208,10 +3208,14 @@ FT_BEGIN_HEADER
* in the @FT_GlyphSlotRec structure gives the format of the returned
* bitmap.
*
- * All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity,
- * indicating pixel coverage. Use linear alpha blending and gamma
- * correction to correctly render non-monochrome glyph bitmaps onto a
- * surface; see @FT_Render_Glyph.
+ * All modes except @FT_RENDER_MODE_MONO and @FT_RENDER_MODE_SDF use
+ * 256 levels of opacity, indicating pixel coverage. Use linear alpha
+ * blending and gamma correction to correctly render non-monochrome glyph
+ * bitmaps onto a surface; see @FT_Render_Glyph.
+ *
+ * The @FT_RENDER_MODE_SDF is s special render mode which uses as much
+ * 65536 distance values, indicating the signed distance from the grid
+ * position to the nearest outline.
*
* @values:
* FT_RENDER_MODE_NORMAL ::
@@ -3238,6 +3242,13 @@ FT_BEGIN_HEADER
* bitmaps that are 3~times the height of the original glyph outline in
* pixels and use the @FT_PIXEL_MODE_LCD_V mode.
*
+ * FT_RENDER_MODE_SDF ::
+ * This mode corresponds to 16-bit signed distance fields bitmap. Each
+ * pixel in a SDF bitmap contains information about the nearest edge of
+ * the glyph outline. The distances are calculated from the center of
+ * the pixel and are positive if they are filled by the outline (i.e.
+ * inside the outline) and negative otherwise.
+ *
* @note:
* The selected render mode only affects vector glyphs of a font.
* Embedded bitmaps often have a different pixel mode like
@@ -3251,6 +3262,7 @@ FT_BEGIN_HEADER
FT_RENDER_MODE_MONO,
FT_RENDER_MODE_LCD,
FT_RENDER_MODE_LCD_V,
+ FT_RENDER_MODE_SDF,
FT_RENDER_MODE_MAX
diff --git a/src/sdf/ftsdfrend.h b/src/sdf/ftsdfrend.h
index b07a806..3ea7619 100644
--- a/src/sdf/ftsdfrend.h
+++ b/src/sdf/ftsdfrend.h
@@ -17,4 +17,4 @@ FT_END_HEADER
#endif /* FTSDFREND_H_ */
-/* END */
\ No newline at end of file
+/* END */
diff --git a/src/sdf/module.mk b/src/sdf/module.mk
index 7d66c3c..00dd078 100644
--- a/src/sdf/module.mk
+++ b/src/sdf/module.mk
@@ -7,4 +7,4 @@ $(OPEN_DRIVER) FT_Renderer_Class, ft_sdf_renderer_class
$(CLOSE_DRIVER)
$(ECHO_DRIVER)sdf $(ECHO_DRIVER_DESC) signed distance field renderer
$(ECHO_DRIVER_DONE)
endef
-#EOF
\ No newline at end of file
+#EOF
diff --git a/src/sdf/rules.mk b/src/sdf/rules.mk
index 7785b7f..88525a4 100644
--- a/src/sdf/rules.mk
+++ b/src/sdf/rules.mk
@@ -55,4 +55,4 @@ $(OBJ_DIR)/%.$O: $(SDF_DIR)/%.c $(FREETYPE_H) $(SDF_DRV_H)
# update main driver list
#
DRV_OBJ_S += $(SDF_DRV_OBJ_S)
-DRV_OBJ_M += $(SDF_DRV_OBJ_M)
\ No newline at end of file
+DRV_OBJ_M += $(SDF_DRV_OBJ_M)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] anuj-distance-field d928ca8 03/95: added new `FT_RENDER_MODE_SDF',
Anuj Verma <=