@hxa-rn/react-native-gcanvas 6.0.24-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1280) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/README.md +207 -0
  4. package/harmony/gcanvas/LICENSE +21 -0
  5. package/harmony/gcanvas/NOTICE +33 -0
  6. package/harmony/gcanvas/OAT.xml +38 -0
  7. package/harmony/gcanvas/build-profile.json5 +16 -0
  8. package/harmony/gcanvas/consumer-rules.txt +0 -0
  9. package/harmony/gcanvas/hvigorfile.ts +2 -0
  10. package/harmony/gcanvas/index.ets +1 -0
  11. package/harmony/gcanvas/oh-package.json5 +14 -0
  12. package/harmony/gcanvas/src/main/cpp/CMakeLists.txt +126 -0
  13. package/harmony/gcanvas/src/main/cpp/GCanvasEngine.cpp +665 -0
  14. package/harmony/gcanvas/src/main/cpp/GCanvasEngine.h +123 -0
  15. package/harmony/gcanvas/src/main/cpp/GCanvasNapi.cpp +485 -0
  16. package/harmony/gcanvas/src/main/cpp/GCanvasXComponent.cpp +166 -0
  17. package/harmony/gcanvas/src/main/cpp/GcanvasPackage.h +24 -0
  18. package/harmony/gcanvas/src/main/cpp/core/CMakeLists.txt +221 -0
  19. package/harmony/gcanvas/src/main/cpp/core/README.md +1 -0
  20. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/gmanager.cpp +69 -0
  21. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/gmanager.h +34 -0
  22. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/jsc/weexjsc.h +14 -0
  23. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/util/auto_ptr.h +110 -0
  24. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/util/i_delete.h +23 -0
  25. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/util/ref_count.h +34 -0
  26. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/view/GcanvasWeexOhos.cpp +28 -0
  27. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/view/GcanvasWeexOhos.h +27 -0
  28. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/view/grenderer.cpp +677 -0
  29. package/harmony/gcanvas/src/main/cpp/core/harmony/3d/view/grenderer.h +127 -0
  30. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/LICENSE.TXT +46 -0
  31. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/README +107 -0
  32. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/ftconfig.h +51 -0
  33. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/ftheader.h +836 -0
  34. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/ftmodule.h +33 -0
  35. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/ftoption.h +1030 -0
  36. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/ftstdlib.h +185 -0
  37. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/integer-types.h +250 -0
  38. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/mac-support.h +49 -0
  39. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/config/public-macros.h +138 -0
  40. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/freetype.h +5289 -0
  41. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftadvanc.h +188 -0
  42. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftbbox.h +101 -0
  43. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftbdf.h +212 -0
  44. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftbitmap.h +329 -0
  45. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftbzip2.h +102 -0
  46. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftcache.h +1087 -0
  47. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftchapters.h +168 -0
  48. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftcid.h +167 -0
  49. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftcolor.h +1667 -0
  50. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftdriver.h +1320 -0
  51. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/fterrdef.h +283 -0
  52. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/fterrors.h +296 -0
  53. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftfntfmt.h +93 -0
  54. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftgasp.h +143 -0
  55. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftglyph.h +750 -0
  56. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftgxval.h +354 -0
  57. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftgzip.h +151 -0
  58. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftimage.h +1289 -0
  59. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftincrem.h +348 -0
  60. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftlcdfil.h +323 -0
  61. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftlist.h +296 -0
  62. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftlogging.h +184 -0
  63. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftlzw.h +100 -0
  64. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftmac.h +289 -0
  65. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftmm.h +834 -0
  66. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftmodapi.h +807 -0
  67. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftmoderr.h +204 -0
  68. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftotval.h +206 -0
  69. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftoutln.h +588 -0
  70. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftparams.h +218 -0
  71. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftpfr.h +179 -0
  72. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftrender.h +244 -0
  73. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftsizes.h +159 -0
  74. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftsnames.h +272 -0
  75. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftstroke.h +773 -0
  76. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftsynth.h +104 -0
  77. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftsystem.h +350 -0
  78. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/fttrigon.h +350 -0
  79. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/fttypes.h +617 -0
  80. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ftwinfnt.h +276 -0
  81. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/autohint.h +234 -0
  82. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/cffotypes.h +107 -0
  83. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/cfftypes.h +416 -0
  84. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/compiler-macros.h +343 -0
  85. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftcalc.h +584 -0
  86. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftdebug.h +442 -0
  87. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftdrv.h +289 -0
  88. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftgloadr.h +147 -0
  89. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/fthash.h +135 -0
  90. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftmemory.h +401 -0
  91. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftmmtypes.h +91 -0
  92. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftobjs.h +1232 -0
  93. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftpsprop.h +47 -0
  94. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftrfork.h +245 -0
  95. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftserv.h +495 -0
  96. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftstream.h +570 -0
  97. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/fttrace.h +173 -0
  98. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/ftvalid.h +160 -0
  99. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/psaux.h +1447 -0
  100. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/pshints.h +699 -0
  101. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svbdf.h +66 -0
  102. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svcfftl.h +90 -0
  103. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svcid.h +69 -0
  104. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svfntfmt.h +55 -0
  105. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svgldict.h +72 -0
  106. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svgxval.h +72 -0
  107. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svkern.h +51 -0
  108. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svmetric.h +131 -0
  109. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svmm.h +214 -0
  110. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svotval.h +55 -0
  111. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svpfr.h +65 -0
  112. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svpostnm.h +65 -0
  113. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svprop.h +66 -0
  114. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svpscmap.h +145 -0
  115. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svpsinfo.h +86 -0
  116. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svsfnt.h +88 -0
  117. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svttcmap.h +90 -0
  118. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svtteng.h +53 -0
  119. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svttglyf.h +56 -0
  120. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/services/svwinfnt.h +50 -0
  121. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/sfnt.h +1099 -0
  122. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/svginterface.h +46 -0
  123. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/t1types.h +307 -0
  124. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/tttypes.h +1747 -0
  125. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/internal/wofftypes.h +312 -0
  126. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/otsvg.h +336 -0
  127. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/t1tables.h +735 -0
  128. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/ttnameid.h +1235 -0
  129. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/tttables.h +856 -0
  130. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/freetype/tttags.h +124 -0
  131. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/include/ft2build.h +42 -0
  132. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afblue.c +779 -0
  133. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afblue.cin +39 -0
  134. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afblue.dat +1121 -0
  135. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afblue.h +429 -0
  136. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afblue.hin +146 -0
  137. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afcjk.c +2383 -0
  138. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afcjk.h +141 -0
  139. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afcover.h +105 -0
  140. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afdummy.c +77 -0
  141. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afdummy.h +40 -0
  142. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/aferrors.h +42 -0
  143. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afglobal.c +513 -0
  144. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afglobal.h +173 -0
  145. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afhints.c +1796 -0
  146. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afhints.h +467 -0
  147. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afindic.c +157 -0
  148. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afindic.h +41 -0
  149. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/aflatin.c +3643 -0
  150. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/aflatin.h +194 -0
  151. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afloader.c +706 -0
  152. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afloader.h +91 -0
  153. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afmodule.c +527 -0
  154. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afmodule.h +55 -0
  155. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afranges.c +1072 -0
  156. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afranges.h +47 -0
  157. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afscript.h +408 -0
  158. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afshaper.c +690 -0
  159. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afshaper.h +71 -0
  160. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afstyles.h +487 -0
  161. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/aftypes.h +511 -0
  162. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afws-decl.h +33 -0
  163. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/afws-iter.h +31 -0
  164. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/autofit.c +35 -0
  165. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/ft-hb.c +115 -0
  166. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/ft-hb.h +48 -0
  167. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/module.mk +23 -0
  168. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/autofit/rules.mk +88 -0
  169. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftadvanc.c +174 -0
  170. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftbase.c +41 -0
  171. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftbase.h +82 -0
  172. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftbbox.c +542 -0
  173. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftbdf.c +90 -0
  174. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftbitmap.c +1144 -0
  175. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftcalc.c +1126 -0
  176. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftcid.c +117 -0
  177. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftcolor.c +156 -0
  178. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftdbgmem.c +971 -0
  179. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftdebug.c +644 -0
  180. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/fterrors.c +45 -0
  181. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftfntfmt.c +54 -0
  182. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftfstype.c +61 -0
  183. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftgasp.c +60 -0
  184. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftgloadr.c +383 -0
  185. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftglyph.c +911 -0
  186. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftgxval.c +141 -0
  187. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/fthash.c +338 -0
  188. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftinit.c +263 -0
  189. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftlcdfil.c +437 -0
  190. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftmac.c +1099 -0
  191. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftmm.c +704 -0
  192. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftobjs.c +5917 -0
  193. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftotval.c +90 -0
  194. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftoutln.c +1120 -0
  195. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftpatent.c +50 -0
  196. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftpfr.c +152 -0
  197. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftpsprop.c +284 -0
  198. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftrfork.c +934 -0
  199. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftsnames.c +185 -0
  200. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftstream.c +872 -0
  201. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftstroke.c +2403 -0
  202. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftsynth.c +180 -0
  203. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftsystem.c +338 -0
  204. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/fttrigon.c +517 -0
  205. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/fttype1.c +126 -0
  206. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftutil.c +442 -0
  207. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftver.rc +61 -0
  208. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/ftwinfnt.c +52 -0
  209. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/md5.c +291 -0
  210. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/md5.h +45 -0
  211. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/base/rules.mk +108 -0
  212. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/README +152 -0
  213. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdf.c +34 -0
  214. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdf.h +253 -0
  215. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdfdrivr.c +1013 -0
  216. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdfdrivr.h +72 -0
  217. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdferror.h +45 -0
  218. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/bdflib.c +2378 -0
  219. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/module.mk +34 -0
  220. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bdf/rules.mk +84 -0
  221. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bzip2/ftbzip2.c +535 -0
  222. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/bzip2/rules.mk +64 -0
  223. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcache.c +31 -0
  224. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcbasic.c +598 -0
  225. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftccache.c +584 -0
  226. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftccache.h +359 -0
  227. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftccback.h +85 -0
  228. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftccmap.c +323 -0
  229. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcerror.h +42 -0
  230. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcglyph.c +204 -0
  231. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcglyph.h +314 -0
  232. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcimage.c +158 -0
  233. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcimage.h +106 -0
  234. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcmanag.c +677 -0
  235. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcmanag.h +175 -0
  236. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcmru.c +341 -0
  237. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcmru.h +242 -0
  238. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcsbits.c +413 -0
  239. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/ftcsbits.h +91 -0
  240. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cache/rules.mk +85 -0
  241. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cff.c +28 -0
  242. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffcmap.c +230 -0
  243. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffcmap.h +67 -0
  244. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffdrivr.c +1263 -0
  245. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffdrivr.h +35 -0
  246. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cfferrs.h +42 -0
  247. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffgload.c +762 -0
  248. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffgload.h +62 -0
  249. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffload.c +2570 -0
  250. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffload.h +124 -0
  251. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffobjs.c +1175 -0
  252. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffobjs.h +84 -0
  253. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffparse.c +1550 -0
  254. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cffparse.h +144 -0
  255. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/cfftoken.h +150 -0
  256. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/module.mk +23 -0
  257. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cff/rules.mk +75 -0
  258. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/ciderrs.h +41 -0
  259. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidgload.c +618 -0
  260. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidgload.h +58 -0
  261. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidload.c +937 -0
  262. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidload.h +52 -0
  263. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidobjs.c +543 -0
  264. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidobjs.h +154 -0
  265. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidparse.c +311 -0
  266. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidparse.h +130 -0
  267. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidriver.c +274 -0
  268. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidriver.h +36 -0
  269. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/cidtoken.h +115 -0
  270. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/module.mk +23 -0
  271. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/rules.mk +73 -0
  272. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/cid/type1cid.c +28 -0
  273. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/dlg/dlgwrap.c +32 -0
  274. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/dlg/rules.mk +70 -0
  275. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/README +532 -0
  276. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvalid.c +46 -0
  277. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvalid.h +107 -0
  278. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvbsln.c +334 -0
  279. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvcommn.c +1747 -0
  280. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvcommn.h +581 -0
  281. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxverror.h +51 -0
  282. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvfeat.c +339 -0
  283. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvfeat.h +173 -0
  284. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvfgen.c +484 -0
  285. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvjust.c +721 -0
  286. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvkern.c +920 -0
  287. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvlcar.c +224 -0
  288. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmod.c +288 -0
  289. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmod.h +46 -0
  290. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort.c +301 -0
  291. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort.h +99 -0
  292. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort0.c +152 -0
  293. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort1.c +260 -0
  294. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort2.c +312 -0
  295. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort4.c +126 -0
  296. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmort5.c +234 -0
  297. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx.c +199 -0
  298. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx.h +73 -0
  299. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx0.c +112 -0
  300. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx1.c +278 -0
  301. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx2.c +331 -0
  302. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx4.c +56 -0
  303. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvmorx5.c +226 -0
  304. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvopbd.c +218 -0
  305. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvprop.c +330 -0
  306. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/gxvtrak.c +288 -0
  307. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/module.mk +23 -0
  308. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gxvalid/rules.mk +98 -0
  309. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/README.freetype +22 -0
  310. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/adler32.c +168 -0
  311. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/crc32.c +1061 -0
  312. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/crc32.h +9446 -0
  313. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/ftgzip.c +805 -0
  314. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/ftzconf.h +551 -0
  315. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/gzguts.h +218 -0
  316. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inffast.c +320 -0
  317. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inffast.h +11 -0
  318. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inffixed.h +94 -0
  319. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inflate.c +1534 -0
  320. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inflate.h +131 -0
  321. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inftrees.c +299 -0
  322. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/inftrees.h +67 -0
  323. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/patches/freetype-zlib.diff +451 -0
  324. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/rules.mk +81 -0
  325. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/zlib.h +1972 -0
  326. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/zutil.c +305 -0
  327. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/gzip/zutil.h +281 -0
  328. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/lzw/ftlzw.c +415 -0
  329. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/lzw/ftzopen.c +429 -0
  330. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/lzw/ftzopen.h +174 -0
  331. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/lzw/rules.mk +72 -0
  332. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/module.mk +23 -0
  333. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvalid.c +31 -0
  334. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvalid.h +77 -0
  335. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvbase.c +345 -0
  336. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvcommn.c +1099 -0
  337. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvcommn.h +468 -0
  338. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otverror.h +42 -0
  339. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvgdef.c +303 -0
  340. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvgpos.c +1051 -0
  341. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvgpos.h +36 -0
  342. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvgsub.c +627 -0
  343. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvjstf.c +259 -0
  344. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvmath.c +453 -0
  345. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvmod.c +281 -0
  346. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/otvmod.h +38 -0
  347. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/otvalid/rules.mk +81 -0
  348. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/README +96 -0
  349. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/module.mk +34 -0
  350. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcf.c +35 -0
  351. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcf.h +251 -0
  352. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfdrivr.c +836 -0
  353. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfdrivr.h +44 -0
  354. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcferror.h +41 -0
  355. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfread.c +1731 -0
  356. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfread.h +44 -0
  357. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfutil.c +119 -0
  358. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/pcfutil.h +55 -0
  359. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pcf/rules.mk +82 -0
  360. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/module.mk +23 -0
  361. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfr.c +29 -0
  362. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrcmap.c +188 -0
  363. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrcmap.h +45 -0
  364. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrdrivr.c +212 -0
  365. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrdrivr.h +36 -0
  366. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrerror.h +41 -0
  367. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrgload.c +849 -0
  368. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrgload.h +49 -0
  369. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrload.c +1062 -0
  370. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrload.h +123 -0
  371. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrobjs.c +603 -0
  372. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrobjs.h +96 -0
  373. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrsbit.c +813 -0
  374. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrsbit.h +37 -0
  375. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/pfrtypes.h +331 -0
  376. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pfr/rules.mk +76 -0
  377. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/afmparse.c +1094 -0
  378. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/afmparse.h +88 -0
  379. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/cffdecode.c +2411 -0
  380. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/cffdecode.h +63 -0
  381. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/module.mk +23 -0
  382. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psarrst.c +240 -0
  383. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psarrst.h +99 -0
  384. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psaux.c +40 -0
  385. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psauxerr.h +42 -0
  386. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psauxmod.c +190 -0
  387. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psauxmod.h +60 -0
  388. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psblues.c +571 -0
  389. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psblues.h +185 -0
  390. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psconv.c +610 -0
  391. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psconv.h +70 -0
  392. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/pserror.c +52 -0
  393. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/pserror.h +120 -0
  394. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psfixed.h +94 -0
  395. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psfont.c +566 -0
  396. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psfont.h +134 -0
  397. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psft.c +895 -0
  398. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psft.h +167 -0
  399. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psglue.h +144 -0
  400. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/pshints.c +1952 -0
  401. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/pshints.h +288 -0
  402. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psintrp.c +3050 -0
  403. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psintrp.h +83 -0
  404. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psobjs.c +2560 -0
  405. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psobjs.h +312 -0
  406. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psread.c +112 -0
  407. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psread.h +68 -0
  408. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psstack.c +329 -0
  409. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/psstack.h +122 -0
  410. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/pstypes.h +77 -0
  411. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/rules.mk +89 -0
  412. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/t1cmap.c +393 -0
  413. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/t1cmap.h +104 -0
  414. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/t1decode.c +2159 -0
  415. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psaux/t1decode.h +73 -0
  416. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/module.mk +23 -0
  417. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshalgo.c +2191 -0
  418. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshalgo.h +233 -0
  419. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshglob.c +795 -0
  420. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshglob.h +196 -0
  421. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshinter.c +27 -0
  422. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshmod.c +125 -0
  423. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshmod.h +38 -0
  424. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshnterr.h +41 -0
  425. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshrec.c +1224 -0
  426. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/pshrec.h +171 -0
  427. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/pshinter/rules.mk +75 -0
  428. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/module.mk +23 -0
  429. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/psmodule.c +621 -0
  430. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/psmodule.h +37 -0
  431. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/psnamerr.h +42 -0
  432. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/psnames.c +24 -0
  433. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/pstables.h +4238 -0
  434. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/psnames/rules.mk +73 -0
  435. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/ftmisc.h +118 -0
  436. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/ftraster.c +2738 -0
  437. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/ftraster.h +47 -0
  438. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/ftrend1.c +209 -0
  439. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/ftrend1.h +37 -0
  440. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/module.mk +23 -0
  441. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/raster.c +25 -0
  442. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/rasterrs.h +42 -0
  443. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/raster/rules.mk +72 -0
  444. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftbsdf.c +1350 -0
  445. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdf.c +3932 -0
  446. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdf.h +97 -0
  447. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdfcommon.c +104 -0
  448. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdfcommon.h +140 -0
  449. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdferrs.h +37 -0
  450. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdfrend.c +603 -0
  451. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/ftsdfrend.h +118 -0
  452. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/module.mk +29 -0
  453. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/rules.mk +78 -0
  454. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sdf/sdf.c +29 -0
  455. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/module.mk +23 -0
  456. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/pngshim.c +474 -0
  457. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/pngshim.h +50 -0
  458. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/rules.mk +87 -0
  459. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfdriver.c +1384 -0
  460. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfdriver.h +35 -0
  461. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sferrors.h +41 -0
  462. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfnt.c +41 -0
  463. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfobjs.c +1552 -0
  464. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfobjs.h +58 -0
  465. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfwoff.c +426 -0
  466. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfwoff.h +43 -0
  467. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfwoff2.c +2380 -0
  468. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/sfwoff2.h +78 -0
  469. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttbdf.c +257 -0
  470. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttbdf.h +49 -0
  471. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcmap.c +3902 -0
  472. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcmap.h +126 -0
  473. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcmapc.h +56 -0
  474. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcolr.c +1923 -0
  475. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcolr.h +83 -0
  476. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcpal.c +310 -0
  477. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttcpal.h +48 -0
  478. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttgpos.c +598 -0
  479. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttgpos.h +53 -0
  480. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttkern.c +317 -0
  481. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttkern.h +51 -0
  482. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttload.c +1496 -0
  483. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttload.h +111 -0
  484. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttmtx.c +338 -0
  485. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttmtx.h +54 -0
  486. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttpost.c +484 -0
  487. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttpost.h +46 -0
  488. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttsbit.c +1685 -0
  489. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttsbit.h +62 -0
  490. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttsvg.c +413 -0
  491. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/ttsvg.h +43 -0
  492. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/woff2tags.c +119 -0
  493. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/sfnt/woff2tags.h +41 -0
  494. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/ftgrays.c +2149 -0
  495. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/ftgrays.h +57 -0
  496. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/ftsmerrs.h +42 -0
  497. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/ftsmooth.c +605 -0
  498. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/ftsmooth.h +37 -0
  499. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/module.mk +23 -0
  500. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/rules.mk +73 -0
  501. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/smooth/smooth.c +25 -0
  502. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/ftsvg.c +355 -0
  503. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/ftsvg.h +35 -0
  504. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/module.mk +23 -0
  505. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/rules.mk +70 -0
  506. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/svg.c +24 -0
  507. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/svg/svgtypes.h +42 -0
  508. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/afblue.pl +551 -0
  509. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/apinames.c +556 -0
  510. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/chktrcmp.py +119 -0
  511. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/cordic.py +32 -0
  512. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/ftrandom/Makefile +45 -0
  513. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/ftrandom/README +69 -0
  514. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/ftrandom/ftrandom.c +720 -0
  515. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/glnames.py +5533 -0
  516. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/make_distribution_archives.py +208 -0
  517. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/no-copyright +66 -0
  518. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/test_afm.c +156 -0
  519. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/test_bbox.c +187 -0
  520. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/test_trig.c +257 -0
  521. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/update-copyright +14 -0
  522. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/update-copyright-year +157 -0
  523. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/tools/vms_shorten_symbol.c +250 -0
  524. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/module.mk +23 -0
  525. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/rules.mk +75 -0
  526. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/truetype.c +29 -0
  527. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttdriver.c +704 -0
  528. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttdriver.h +35 -0
  529. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/tterrors.h +42 -0
  530. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttgload.c +2740 -0
  531. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttgload.h +61 -0
  532. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttgxvar.c +4594 -0
  533. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttgxvar.h +453 -0
  534. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttinterp.c +7751 -0
  535. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttinterp.h +465 -0
  536. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttobjs.c +1543 -0
  537. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttobjs.h +426 -0
  538. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttpload.c +665 -0
  539. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/truetype/ttpload.h +74 -0
  540. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/module.mk +23 -0
  541. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/rules.mk +76 -0
  542. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1afm.c +413 -0
  543. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1afm.h +53 -0
  544. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1driver.c +807 -0
  545. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1driver.h +35 -0
  546. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1errors.h +41 -0
  547. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1gload.c +606 -0
  548. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1gload.h +52 -0
  549. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1load.c +2755 -0
  550. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1load.h +126 -0
  551. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1objs.c +655 -0
  552. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1objs.h +160 -0
  553. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1parse.c +487 -0
  554. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1parse.h +137 -0
  555. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/t1tokens.h +143 -0
  556. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type1/type1.c +29 -0
  557. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/module.mk +23 -0
  558. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/rules.mk +73 -0
  559. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42drivr.c +248 -0
  560. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42drivr.h +36 -0
  561. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42error.h +41 -0
  562. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42objs.c +698 -0
  563. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42objs.h +123 -0
  564. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42parse.c +1351 -0
  565. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42parse.h +91 -0
  566. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/t42types.h +56 -0
  567. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/type42/type42.c +26 -0
  568. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/winfonts/fnterrs.h +42 -0
  569. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/winfonts/module.mk +23 -0
  570. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/winfonts/rules.mk +68 -0
  571. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/winfonts/winfnt.c +1219 -0
  572. package/harmony/gcanvas/src/main/cpp/core/harmony/freetype/src/winfonts/winfnt.h +164 -0
  573. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/.appveyor.yml +69 -0
  574. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/.travis.yml +41 -0
  575. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/ANNOUNCE +55 -0
  576. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/AUTHORS +46 -0
  577. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/CHANGES +6111 -0
  578. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/CMakeLists.txt +1042 -0
  579. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/INSTALL +465 -0
  580. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/LICENSE +134 -0
  581. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/Makefile.am +392 -0
  582. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/Makefile.in +2420 -0
  583. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/README +183 -0
  584. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/TODO +23 -0
  585. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/TRADEMARK +8 -0
  586. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/aclocal.m4 +1196 -0
  587. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/arm/arm_init.c +136 -0
  588. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/arm/filter_neon.S +253 -0
  589. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/arm/filter_neon_intrinsics.c +402 -0
  590. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/arm/palette_neon_intrinsics.c +149 -0
  591. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/autogen.sh +225 -0
  592. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/ci/ci_autotools.sh +95 -0
  593. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/ci/ci_cmake.sh +127 -0
  594. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/ci/ci_legacy.sh +116 -0
  595. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/compile +348 -0
  596. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/config.guess +1476 -0
  597. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/config.h.in +126 -0
  598. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/config.sub +1801 -0
  599. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/configure +16116 -0
  600. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/configure.ac +532 -0
  601. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/README.txt +5 -0
  602. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/arm-neon/README +83 -0
  603. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/arm-neon/android-ndk.c +39 -0
  604. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/arm-neon/linux-auxv.c +120 -0
  605. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/arm-neon/linux.c +161 -0
  606. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/README +49 -0
  607. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/pngcp.dfa +57 -0
  608. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/read.dfa +58 -0
  609. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/s_read.dfa +35 -0
  610. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/s_write.dfa +33 -0
  611. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/simple.dfa +36 -0
  612. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/conftest/write.dfa +45 -0
  613. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/examples/README.txt +24 -0
  614. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/examples/iccfrompng.c +185 -0
  615. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/examples/pngpixel.c +371 -0
  616. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/examples/pngtopng.c +98 -0
  617. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/examples/simpleover.c +648 -0
  618. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/COPYING +340 -0
  619. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/LICENSE +50 -0
  620. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/Makefile.mingw32 +131 -0
  621. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/Makefile.sgi +105 -0
  622. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/Makefile.unx +134 -0
  623. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/Makefile.w32 +114 -0
  624. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/README +186 -0
  625. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/makevms.com +132 -0
  626. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/readpng.c +323 -0
  627. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/readpng.h +88 -0
  628. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/readpng2.c +521 -0
  629. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/readpng2.h +116 -0
  630. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/readppm.c +188 -0
  631. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/rpng-win.c +735 -0
  632. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/rpng-x.c +911 -0
  633. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/rpng2-win.c +1261 -0
  634. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/rpng2-x.c +2143 -0
  635. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/toucan.png +0 -0
  636. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/wpng.c +865 -0
  637. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/writepng.c +401 -0
  638. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/gregbook/writepng.h +133 -0
  639. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/fakepng.c +65 -0
  640. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/gentests.sh +100 -0
  641. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/makepng.c +1948 -0
  642. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/pngimage.c +1722 -0
  643. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/pngstest-errors.h +165 -0
  644. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/pngstest.c +3832 -0
  645. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/pngunknown.c +1305 -0
  646. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/pngvalid.c +12279 -0
  647. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/readpng.c +114 -0
  648. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/tarith.c +1011 -0
  649. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/libtests/timepng.c +607 -0
  650. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/mips-msa/README +83 -0
  651. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/mips-msa/linux.c +67 -0
  652. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/Dockerfile +25 -0
  653. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/README.txt +37 -0
  654. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/build.sh +51 -0
  655. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc +209 -0
  656. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/libpng_read_fuzzer.options +2 -0
  657. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/oss-fuzz/png.dict +39 -0
  658. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/README +5 -0
  659. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/decoder/README +10 -0
  660. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/decoder/pngusr.dfa +40 -0
  661. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/decoder/pngusr.h +23 -0
  662. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/encoder/README +10 -0
  663. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/encoder/pngusr.dfa +39 -0
  664. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/encoder/pngusr.h +23 -0
  665. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/preader/README +15 -0
  666. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/preader/pngusr.dfa +40 -0
  667. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminim/preader/pngusr.h +23 -0
  668. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/CHANGES.txt +13 -0
  669. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/CMakeLists.txt +34 -0
  670. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/LICENSE.txt +22 -0
  671. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/README.txt +120 -0
  672. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/makevms.com +92 -0
  673. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/png2pnm.bat +41 -0
  674. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/png2pnm.c +427 -0
  675. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/png2pnm.sh +42 -0
  676. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/pngminus.bat +4 -0
  677. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/pngminus.sh +5 -0
  678. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/pnm2png.bat +41 -0
  679. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/pnm2png.c +620 -0
  680. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngminus/pnm2png.sh +42 -0
  681. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/README +107 -0
  682. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/bad_interlace_conversions.txt +9 -0
  683. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn0g01.png +0 -0
  684. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn0g02.png +0 -0
  685. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn0g04.png +0 -0
  686. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn0g08.png +0 -0
  687. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn0g16.png +0 -0
  688. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn2c08.png +0 -0
  689. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn2c16.png +0 -0
  690. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn3p01.png +0 -0
  691. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn3p02.png +0 -0
  692. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn3p04.png +0 -0
  693. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn3p08.png +0 -0
  694. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn4a08.png +0 -0
  695. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn4a16.png +0 -0
  696. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn6a08.png +0 -0
  697. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/basn6a16.png +0 -0
  698. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbbn0g01.png +0 -0
  699. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbbn0g02.png +0 -0
  700. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbbn0g04.png +0 -0
  701. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbbn2c16.png +0 -0
  702. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbbn3p08.png +0 -0
  703. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbgn2c16.png +0 -0
  704. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbgn3p08.png +0 -0
  705. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbrn2c08.png +0 -0
  706. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbwn0g16.png +0 -0
  707. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbwn3p08.png +0 -0
  708. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftbyn3p08.png +0 -0
  709. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftp0n0g08.png +0 -0
  710. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftp0n2c08.png +0 -0
  711. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftp0n3p08.png +0 -0
  712. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ftp1n3p08.png +0 -0
  713. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn0g08.png +0 -0
  714. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn0g16.png +0 -0
  715. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn2c08.png +0 -0
  716. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn2c16.png +0 -0
  717. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn3p08.png +0 -0
  718. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn4a08.png +0 -0
  719. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn4a16.png +0 -0
  720. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn6a08.png +0 -0
  721. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/ibasn6a16.png +0 -0
  722. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbbn2c16.png +0 -0
  723. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbbn3p08.png +0 -0
  724. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbgn2c16.png +0 -0
  725. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbgn3p08.png +0 -0
  726. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbrn2c08.png +0 -0
  727. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbwn0g16.png +0 -0
  728. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbwn3p08.png +0 -0
  729. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftbyn3p08.png +0 -0
  730. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftp0n0g08.png +0 -0
  731. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftp0n2c08.png +0 -0
  732. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftp0n3p08.png +0 -0
  733. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/iftp1n3p08.png +0 -0
  734. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/README +2 -0
  735. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn0g01.png +0 -0
  736. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn0g02.png +0 -0
  737. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn0g04.png +0 -0
  738. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn3p01.png +0 -0
  739. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn3p02.png +0 -0
  740. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/ibasn3p04.png +0 -0
  741. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/iftbbn0g01.png +0 -0
  742. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/iftbbn0g02.png +0 -0
  743. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/pngsuite/interlaced/iftbbn0g04.png +0 -0
  744. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/powerpc-vsx/README +81 -0
  745. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/powerpc-vsx/linux.c +57 -0
  746. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/powerpc-vsx/linux_aux.c +34 -0
  747. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/bad_iCCP.png +0 -0
  748. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/badadler.png +0 -0
  749. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/badcrc.png +0 -0
  750. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/empty_ancillary_chunks.png +0 -0
  751. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_IDAT.png +0 -0
  752. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_bKGD_chunk.png +0 -0
  753. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_cHRM_chunk.png +0 -0
  754. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_eXIf_chunk.png +0 -0
  755. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_gAMA_chunk.png +0 -0
  756. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_hIST_chunk.png +0 -0
  757. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_iCCP_chunk.png +0 -0
  758. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_iTXt_chunk.png +0 -0
  759. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_juNK_unsafe_to_copy.png +0 -0
  760. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_juNk_safe_to_copy.png +0 -0
  761. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_pCAL_chunk.png +0 -0
  762. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_pHYs_chunk.png +0 -0
  763. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_sCAL_chunk.png +0 -0
  764. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_sPLT_chunk.png +0 -0
  765. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_sRGB_chunk.png +0 -0
  766. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_sTER_chunk.png +0 -0
  767. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_tEXt_chunk.png +0 -0
  768. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_tIME_chunk.png +0 -0
  769. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/crashers/huge_zTXt_chunk.png +0 -0
  770. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-1.8-tRNS.png +0 -0
  771. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-1.8.png +0 -0
  772. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-linear-tRNS.png +0 -0
  773. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-linear.png +0 -0
  774. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-sRGB-tRNS.png +0 -0
  775. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-sRGB.png +0 -0
  776. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1-tRNS.png +0 -0
  777. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-1.png +0 -0
  778. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-1.8-tRNS.png +0 -0
  779. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-1.8.png +0 -0
  780. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-linear-tRNS.png +0 -0
  781. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-linear.png +0 -0
  782. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-sRGB-tRNS.png +0 -0
  783. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-sRGB.png +0 -0
  784. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16-tRNS.png +0 -0
  785. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-16.png +0 -0
  786. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-1.8-tRNS.png +0 -0
  787. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-1.8.png +0 -0
  788. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-linear-tRNS.png +0 -0
  789. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-linear.png +0 -0
  790. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-sRGB-tRNS.png +0 -0
  791. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-sRGB.png +0 -0
  792. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2-tRNS.png +0 -0
  793. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-2.png +0 -0
  794. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-1.8-tRNS.png +0 -0
  795. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-1.8.png +0 -0
  796. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-linear-tRNS.png +0 -0
  797. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-linear.png +0 -0
  798. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-sRGB-tRNS.png +0 -0
  799. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-sRGB.png +0 -0
  800. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4-tRNS.png +0 -0
  801. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-4.png +0 -0
  802. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-1.8-tRNS.png +0 -0
  803. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-1.8.png +0 -0
  804. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-linear-tRNS.png +0 -0
  805. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-linear.png +0 -0
  806. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-sRGB-tRNS.png +0 -0
  807. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-sRGB.png +0 -0
  808. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8-tRNS.png +0 -0
  809. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-8.png +0 -0
  810. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-16-1.8.png +0 -0
  811. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-16-linear.png +0 -0
  812. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-16-sRGB.png +0 -0
  813. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-16.png +0 -0
  814. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-8-1.8.png +0 -0
  815. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-8-linear.png +0 -0
  816. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-8-sRGB.png +0 -0
  817. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/gray-alpha-8.png +0 -0
  818. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/makepngs.sh +94 -0
  819. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-1.8-tRNS.png +0 -0
  820. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-1.8.png +0 -0
  821. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-linear-tRNS.png +0 -0
  822. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-linear.png +0 -0
  823. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-sRGB-tRNS.png +0 -0
  824. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-sRGB.png +0 -0
  825. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1-tRNS.png +0 -0
  826. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-1.png +0 -0
  827. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-1.8-tRNS.png +0 -0
  828. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-1.8.png +0 -0
  829. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-linear-tRNS.png +0 -0
  830. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-linear.png +0 -0
  831. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-sRGB-tRNS.png +0 -0
  832. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-sRGB.png +0 -0
  833. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2-tRNS.png +0 -0
  834. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-2.png +0 -0
  835. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-1.8-tRNS.png +0 -0
  836. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-1.8.png +0 -0
  837. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-linear-tRNS.png +0 -0
  838. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-linear.png +0 -0
  839. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-sRGB-tRNS.png +0 -0
  840. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-sRGB.png +0 -0
  841. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4-tRNS.png +0 -0
  842. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-4.png +0 -0
  843. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-1.8-tRNS.png +0 -0
  844. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-1.8.png +0 -0
  845. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-linear-tRNS.png +0 -0
  846. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-linear.png +0 -0
  847. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-sRGB-tRNS.png +0 -0
  848. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-sRGB.png +0 -0
  849. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8-tRNS.png +0 -0
  850. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/palette-8.png +0 -0
  851. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-1.8-tRNS.png +0 -0
  852. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-1.8.png +0 -0
  853. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-linear-tRNS.png +0 -0
  854. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-linear.png +0 -0
  855. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-sRGB-tRNS.png +0 -0
  856. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-sRGB.png +0 -0
  857. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16-tRNS.png +0 -0
  858. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-16.png +0 -0
  859. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-1.8-tRNS.png +0 -0
  860. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-1.8.png +0 -0
  861. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-linear-tRNS.png +0 -0
  862. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-linear.png +0 -0
  863. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-sRGB-tRNS.png +0 -0
  864. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-sRGB.png +0 -0
  865. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8-tRNS.png +0 -0
  866. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-8.png +0 -0
  867. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-16-1.8.png +0 -0
  868. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-16-linear.png +0 -0
  869. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-16-sRGB.png +0 -0
  870. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-16.png +0 -0
  871. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-8-1.8.png +0 -0
  872. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-8-linear.png +0 -0
  873. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-8-sRGB.png +0 -0
  874. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/testpngs/rgb-alpha-8.png +0 -0
  875. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/README.txt +27 -0
  876. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/checksum-icc.c +102 -0
  877. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/chkfmt +144 -0
  878. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/cvtcolor.c +188 -0
  879. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/genpng.c +881 -0
  880. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/intgamma.sh +110 -0
  881. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/makesRGB.c +430 -0
  882. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/png-fix-itxt.c +164 -0
  883. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/pngcp.c +2453 -0
  884. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/pngfix.c +4049 -0
  885. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/reindent +25 -0
  886. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/tools/sRGB.h +48 -0
  887. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/PngFile.c +454 -0
  888. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/PngFile.h +30 -0
  889. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/README.txt +61 -0
  890. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.c +978 -0
  891. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.dsp +147 -0
  892. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.dsw +29 -0
  893. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.ico +0 -0
  894. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.png +0 -0
  895. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/VisualPng.rc +152 -0
  896. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/cexcept.h +248 -0
  897. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/contrib/visupng/resource.h +23 -0
  898. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/depcomp +791 -0
  899. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/example.c +1041 -0
  900. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/install-sh +518 -0
  901. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/intel/filter_sse2_intrinsics.c +391 -0
  902. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/intel/intel_init.c +52 -0
  903. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/libpng-config.in +127 -0
  904. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/libpng-manual.txt +5409 -0
  905. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/libpng.3 +6052 -0
  906. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/libpng.pc.in +12 -0
  907. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/libpngpf.3 +24 -0
  908. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/ltmain.sh +11147 -0
  909. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/mips/filter_msa_intrinsics.c +808 -0
  910. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/mips/mips_init.c +130 -0
  911. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/missing +215 -0
  912. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/png.5 +84 -0
  913. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/png.c +4607 -0
  914. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/png.h +3247 -0
  915. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngbar.jpg +0 -0
  916. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngbar.png +0 -0
  917. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngconf.h +623 -0
  918. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngdebug.h +153 -0
  919. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngerror.c +963 -0
  920. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngget.c +1249 -0
  921. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pnginfo.h +267 -0
  922. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pnglibconf.h +219 -0
  923. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngmem.c +284 -0
  924. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngnow.png +0 -0
  925. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngpread.c +1096 -0
  926. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngpriv.h +2152 -0
  927. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngread.c +4225 -0
  928. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngrio.c +120 -0
  929. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngrtran.c +5044 -0
  930. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngrutil.c +4678 -0
  931. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngset.c +1802 -0
  932. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngstruct.h +489 -0
  933. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngtest.c +2158 -0
  934. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngtest.png +0 -0
  935. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngtrans.c +864 -0
  936. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngusr.dfa +14 -0
  937. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngwio.c +168 -0
  938. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngwrite.c +2390 -0
  939. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngwtran.c +575 -0
  940. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/pngwutil.c +2781 -0
  941. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/powerpc/filter_vsx_intrinsics.c +768 -0
  942. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/powerpc/powerpc_init.c +126 -0
  943. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/libpng.tgt +383 -0
  944. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/libpng.wpj +112 -0
  945. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/pngconfig.mak +160 -0
  946. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/pngstest.tgt +219 -0
  947. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/pngtest.tgt +179 -0
  948. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/owatcom/pngvalid.tgt +210 -0
  949. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/PRJ0041.mak +21 -0
  950. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/README.txt +58 -0
  951. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/README_zlib.txt +44 -0
  952. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/libpng.sln +60 -0
  953. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/libpng.vcproj +419 -0
  954. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/pngtest.vcproj +267 -0
  955. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/visualc71/zlib.vcproj +391 -0
  956. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/README.txt +87 -0
  957. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/libpng/libpng.vcxproj +234 -0
  958. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/pnglibconf/pnglibconf.vcxproj +61 -0
  959. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/vstudio.sln +109 -0
  960. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/zlib/zlib.vcxproj +175 -0
  961. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/projects/vstudio/zlib.props +57 -0
  962. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/README.txt +83 -0
  963. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/SCOPTIONS.ppc +7 -0
  964. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/checksym.awk +173 -0
  965. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/descrip.mms +47 -0
  966. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/dfn.awk +203 -0
  967. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/genchk.cmake.in +37 -0
  968. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/genout.cmake.in +105 -0
  969. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/gensrc.cmake.in +138 -0
  970. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/intprefix.c +22 -0
  971. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/libpng-config-body.in +96 -0
  972. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/libpng-config-head.in +24 -0
  973. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/libpng.pc.in +10 -0
  974. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/libtool.m4 +8369 -0
  975. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/ltoptions.m4 +437 -0
  976. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/ltsugar.m4 +124 -0
  977. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/ltversion.m4 +23 -0
  978. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/lt~obsolete.m4 +99 -0
  979. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/macro.lst +3 -0
  980. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.32sunu +241 -0
  981. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.64sunu +241 -0
  982. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.acorn +57 -0
  983. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.aix +116 -0
  984. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.amiga +58 -0
  985. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.atari +71 -0
  986. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.bc32 +158 -0
  987. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.beos +222 -0
  988. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.cegcc +116 -0
  989. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.clang +87 -0
  990. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.darwin +222 -0
  991. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.dec +210 -0
  992. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.dj2 +72 -0
  993. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.freebsd +66 -0
  994. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.gcc +87 -0
  995. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.hp64 +228 -0
  996. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.hpgcc +225 -0
  997. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.hpux +226 -0
  998. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.ibmc +90 -0
  999. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.intel +118 -0
  1000. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.linux +240 -0
  1001. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.linux-opt +258 -0
  1002. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.mips +100 -0
  1003. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.msys +199 -0
  1004. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.netbsd +55 -0
  1005. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.openbsd +86 -0
  1006. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.sco +223 -0
  1007. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.sggcc +233 -0
  1008. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.sgi +234 -0
  1009. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.so9 +244 -0
  1010. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.solaris +240 -0
  1011. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.std +133 -0
  1012. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.sunos +112 -0
  1013. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makefile.vcwin32 +112 -0
  1014. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/makevms.com +142 -0
  1015. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/options.awk +898 -0
  1016. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/pnglibconf.dfa +920 -0
  1017. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/pnglibconf.h.prebuilt +219 -0
  1018. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/pnglibconf.mak +55 -0
  1019. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/pngwin.rc +112 -0
  1020. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/prefix.c +24 -0
  1021. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/smakefile.ppc +34 -0
  1022. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/sym.c +15 -0
  1023. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/symbols.c +58 -0
  1024. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/symbols.def +255 -0
  1025. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/test.cmake.in +31 -0
  1026. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/scripts/vers.c +19 -0
  1027. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/test-driver +148 -0
  1028. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngimage-full +2 -0
  1029. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngimage-quick +2 -0
  1030. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-1.8 +2 -0
  1031. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-1.8-alpha +2 -0
  1032. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-linear +2 -0
  1033. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-linear-alpha +2 -0
  1034. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-none +2 -0
  1035. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-none-alpha +2 -0
  1036. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-sRGB +2 -0
  1037. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngstest-sRGB-alpha +2 -0
  1038. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngtest-all +16 -0
  1039. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-IDAT +2 -0
  1040. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-discard +2 -0
  1041. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-if-safe +2 -0
  1042. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-sAPI +2 -0
  1043. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-sTER +2 -0
  1044. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-save +2 -0
  1045. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngunknown-vpAg +2 -0
  1046. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-16-to-8 +2 -0
  1047. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-alpha-mode +2 -0
  1048. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-background +2 -0
  1049. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-expand16-alpha-mode +2 -0
  1050. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-expand16-background +2 -0
  1051. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-expand16-transform +2 -0
  1052. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-sbit +2 -0
  1053. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-threshold +2 -0
  1054. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-gamma-transform +2 -0
  1055. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-progressive-interlace-standard +2 -0
  1056. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-progressive-size +2 -0
  1057. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-progressive-standard +2 -0
  1058. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-standard +2 -0
  1059. package/harmony/gcanvas/src/main/cpp/core/harmony/libpng/tests/pngvalid-transform +2 -0
  1060. package/harmony/gcanvas/src/main/cpp/core/harmony/manager/GCanvasManagerOhos.cpp +50 -0
  1061. package/harmony/gcanvas/src/main/cpp/core/harmony/memory/AutoPtr.h +99 -0
  1062. package/harmony/gcanvas/src/main/cpp/core/harmony/memory/IDelete.h +25 -0
  1063. package/harmony/gcanvas/src/main/cpp/core/harmony/memory/RefCount.h +55 -0
  1064. package/harmony/gcanvas/src/main/cpp/core/harmony/png/IPngCoder.h +38 -0
  1065. package/harmony/gcanvas/src/main/cpp/core/harmony/png/LodePngCoder.cpp +101 -0
  1066. package/harmony/gcanvas/src/main/cpp/core/harmony/png/LodePngCoder.h +40 -0
  1067. package/harmony/gcanvas/src/main/cpp/core/harmony/png/PngLoader.cpp +114 -0
  1068. package/harmony/gcanvas/src/main/cpp/core/harmony/png/PngLoader.h +53 -0
  1069. package/harmony/gcanvas/src/main/cpp/core/harmony/png/thirdparty/lodepng.c +6292 -0
  1070. package/harmony/gcanvas/src/main/cpp/core/harmony/png/thirdparty/lodepng.h +1890 -0
  1071. package/harmony/gcanvas/src/main/cpp/core/src/GCanvas.cpp +89 -0
  1072. package/harmony/gcanvas/src/main/cpp/core/src/GCanvas.hpp +45 -0
  1073. package/harmony/gcanvas/src/main/cpp/core/src/GCanvasManager.cpp +158 -0
  1074. package/harmony/gcanvas/src/main/cpp/core/src/GCanvasManager.h +56 -0
  1075. package/harmony/gcanvas/src/main/cpp/core/src/GCanvasWeex.cpp +1925 -0
  1076. package/harmony/gcanvas/src/main/cpp/core/src/GCanvasWeex.hpp +335 -0
  1077. package/harmony/gcanvas/src/main/cpp/core/src/RNCGCanvasBridge.h +225 -0
  1078. package/harmony/gcanvas/src/main/cpp/core/src/export.h +29 -0
  1079. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GCanvas2dContext.cpp +2366 -0
  1080. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GCanvas2dContext.h +449 -0
  1081. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GCanvasState.cpp +189 -0
  1082. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GCanvasState.h +83 -0
  1083. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GContext2dType.h +68 -0
  1084. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GConvert.cpp +476 -0
  1085. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GConvert.h +25 -0
  1086. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFillStyle.h +191 -0
  1087. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFontManager.h +110 -0
  1088. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFontStyle.cpp +149 -0
  1089. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFontStyle.h +94 -0
  1090. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFrameBufferObject.cpp +226 -0
  1091. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GFrameBufferObject.h +116 -0
  1092. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GGL.h +45 -0
  1093. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GGlyphCache.cpp +106 -0
  1094. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GGlyphCache.h +159 -0
  1095. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GPath.cpp +1213 -0
  1096. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GPath.h +115 -0
  1097. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GPoint.h +117 -0
  1098. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GShader.cpp +346 -0
  1099. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GShader.h +360 -0
  1100. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GShaderManager.cpp +140 -0
  1101. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GShaderManager.h +38 -0
  1102. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GStrSeparator.cpp +84 -0
  1103. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GStrSeparator.h +31 -0
  1104. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTextDefine.h +34 -0
  1105. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTexture.cpp +327 -0
  1106. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTexture.h +133 -0
  1107. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTransform.h +163 -0
  1108. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTreemap.cpp +61 -0
  1109. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GTreemap.h +88 -0
  1110. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GWebglContext.cpp +3259 -0
  1111. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/GWebglContext.h +13 -0
  1112. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/default.glsl +39 -0
  1113. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/grad.glsl +101 -0
  1114. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/pattern.glsl +45 -0
  1115. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/radiation.glsl +110 -0
  1116. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/shadow.glsl +39 -0
  1117. package/harmony/gcanvas/src/main/cpp/core/src/gcanvas/shaders/texture.glsl +34 -0
  1118. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GCanvas2DContextAndroid.cpp +386 -0
  1119. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GCanvas2DContextAndroid.h +113 -0
  1120. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GCanvas2DContextImpl.cpp +67 -0
  1121. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GCanvasAndroid.cpp +41 -0
  1122. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GCanvasAndroid.h +36 -0
  1123. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFont.cpp +806 -0
  1124. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFont.h +164 -0
  1125. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontCache.cpp +467 -0
  1126. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontCache.h +93 -0
  1127. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontFamily.cpp +187 -0
  1128. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontFamily.h +68 -0
  1129. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontManager.cpp +205 -0
  1130. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontManagerAndroid.cpp +328 -0
  1131. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontManagerAndroid.h +63 -0
  1132. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFontManagerImpl.cpp +22 -0
  1133. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GFrameBufferObjectImpl.cpp +180 -0
  1134. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GPreCompiledShaders.cpp +175 -0
  1135. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GPreCompiledShaders.h +75 -0
  1136. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GSystemFontInformation.cpp +231 -0
  1137. package/harmony/gcanvas/src/main/cpp/core/src/platform/Android/GSystemFontInformation.h +69 -0
  1138. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/FontTool.hpp +892 -0
  1139. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/GFont.cpp +742 -0
  1140. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/GFontCache.cpp +296 -0
  1141. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/GFontFamily.cpp +162 -0
  1142. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/GFontManager.cpp +230 -0
  1143. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/GSystemFontInformation.cpp +232 -0
  1144. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/PortableMap.hpp +621 -0
  1145. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/argh.h +434 -0
  1146. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/fonttool.cpp +109 -0
  1147. package/harmony/gcanvas/src/main/cpp/core/src/platform/Linux/utils.hpp +229 -0
  1148. package/harmony/gcanvas/src/main/cpp/core/src/platform/iOS/GCVFont.h +126 -0
  1149. package/harmony/gcanvas/src/main/cpp/core/src/platform/iOS/GCVFont.mm +573 -0
  1150. package/harmony/gcanvas/src/main/cpp/core/src/platform/iOS/GFontManager.mm +185 -0
  1151. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GCanvas2DContextHarmony.cpp +391 -0
  1152. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GCanvas2DContextHarmony.h +114 -0
  1153. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GCanvas2DContextOHOS.cpp +49 -0
  1154. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GCanvasHarmony.cpp +42 -0
  1155. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GCanvasHarmony.h +37 -0
  1156. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFont.cpp +806 -0
  1157. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFont.h +164 -0
  1158. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontCache.cpp +466 -0
  1159. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontCache.h +94 -0
  1160. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontFamily.cpp +188 -0
  1161. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontFamily.h +69 -0
  1162. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontManagerHarmony.cpp +329 -0
  1163. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontManagerHarmony.h +64 -0
  1164. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFontManagerImpl.cpp +23 -0
  1165. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GFrameBufferObjectImpl.cpp +221 -0
  1166. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GPreCompiledShaders.cpp +176 -0
  1167. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GPreCompiledShaders.h +76 -0
  1168. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GSystemFontInformation.cpp +232 -0
  1169. package/harmony/gcanvas/src/main/cpp/core/src/platform/ohos/GSystemFontInformation.h +70 -0
  1170. package/harmony/gcanvas/src/main/cpp/core/src/support/CharacterSet.cpp +126 -0
  1171. package/harmony/gcanvas/src/main/cpp/core/src/support/CharacterSet.h +30 -0
  1172. package/harmony/gcanvas/src/main/cpp/core/src/support/ConcurrenceQueue.h +128 -0
  1173. package/harmony/gcanvas/src/main/cpp/core/src/support/DynArray.h +157 -0
  1174. package/harmony/gcanvas/src/main/cpp/core/src/support/Encode.cpp +116 -0
  1175. package/harmony/gcanvas/src/main/cpp/core/src/support/Encode.h +20 -0
  1176. package/harmony/gcanvas/src/main/cpp/core/src/support/FileUtils.cpp +153 -0
  1177. package/harmony/gcanvas/src/main/cpp/core/src/support/FileUtils.h +56 -0
  1178. package/harmony/gcanvas/src/main/cpp/core/src/support/GLUtil.cpp +174 -0
  1179. package/harmony/gcanvas/src/main/cpp/core/src/support/GLUtil.h +25 -0
  1180. package/harmony/gcanvas/src/main/cpp/core/src/support/Lesser.h +27 -0
  1181. package/harmony/gcanvas/src/main/cpp/core/src/support/Log.cpp +158 -0
  1182. package/harmony/gcanvas/src/main/cpp/core/src/support/Log.h +100 -0
  1183. package/harmony/gcanvas/src/main/cpp/core/src/support/Util.cpp +118 -0
  1184. package/harmony/gcanvas/src/main/cpp/core/src/support/Util.h +38 -0
  1185. package/harmony/gcanvas/src/main/cpp/core/src/support/Value.cpp +180 -0
  1186. package/harmony/gcanvas/src/main/cpp/core/src/support/Value.h +76 -0
  1187. package/harmony/gcanvas/src/main/cpp/generated/RNOH/generated/BaseGcanvasPackage.h +79 -0
  1188. package/harmony/gcanvas/src/main/cpp/generated/RNOH/generated/components/GCanvasViewJSIBinder.h +37 -0
  1189. package/harmony/gcanvas/src/main/cpp/generated/RNOH/generated/turbo_modules/GCanvasModule.cpp +35 -0
  1190. package/harmony/gcanvas/src/main/cpp/generated/RNOH/generated/turbo_modules/GCanvasModule.h +16 -0
  1191. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/ComponentDescriptors.h +24 -0
  1192. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/EventEmitters.cpp +33 -0
  1193. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/EventEmitters.h +31 -0
  1194. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/Props.cpp +28 -0
  1195. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/Props.h +30 -0
  1196. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/ShadowNodes.cpp +17 -0
  1197. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/ShadowNodes.h +32 -0
  1198. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/States.cpp +16 -0
  1199. package/harmony/gcanvas/src/main/cpp/generated/react/renderer/components/gcanvas/States.h +29 -0
  1200. package/harmony/gcanvas/src/main/ets/GCanvasModuleTurboModule.ts +448 -0
  1201. package/harmony/gcanvas/src/main/ets/GCanvasNativeEngine.ts +206 -0
  1202. package/harmony/gcanvas/src/main/ets/GcanvasTurboModulesFactory.ets +42 -0
  1203. package/harmony/gcanvas/src/main/ets/components/GCanvasView.ets +109 -0
  1204. package/harmony/gcanvas/src/main/ets/generated/components/GCanvasView.ts +126 -0
  1205. package/harmony/gcanvas/src/main/ets/generated/components/ts.ts +5 -0
  1206. package/harmony/gcanvas/src/main/ets/generated/index.ets +5 -0
  1207. package/harmony/gcanvas/src/main/ets/generated/ts.ts +6 -0
  1208. package/harmony/gcanvas/src/main/ets/generated/turboModules/GCanvasModule.ts +52 -0
  1209. package/harmony/gcanvas/src/main/ets/generated/turboModules/ts.ts +5 -0
  1210. package/harmony/gcanvas/src/main/module.json5 +21 -0
  1211. package/harmony/gcanvas/src/main/resources/base/element/string.json +12 -0
  1212. package/harmony/gcanvas/src/main/resources/en_US/element/string.json +8 -0
  1213. package/harmony/gcanvas/src/main/resources/zh_CN/element/string.json +12 -0
  1214. package/harmony/gcanvas.har +0 -0
  1215. package/package.json +69 -0
  1216. package/packages/gcanvas/.babelrc +5 -0
  1217. package/packages/gcanvas/.eslintrc.js +133 -0
  1218. package/packages/gcanvas/package.json +19 -0
  1219. package/packages/gcanvas/rollup.config.js +14 -0
  1220. package/packages/gcanvas/src/bridge/react-native.js +286 -0
  1221. package/packages/gcanvas/src/bridge/weex.js +210 -0
  1222. package/packages/gcanvas/src/context/2d/FillStyleLinearGradient.js +17 -0
  1223. package/packages/gcanvas/src/context/2d/FillStylePattern.js +8 -0
  1224. package/packages/gcanvas/src/context/2d/FillStyleRadialGradient.js +17 -0
  1225. package/packages/gcanvas/src/context/2d/OffScreenRenderingContext.js +49 -0
  1226. package/packages/gcanvas/src/context/2d/RenderingContext.js +787 -0
  1227. package/packages/gcanvas/src/context/webgl/ActiveInfo.js +11 -0
  1228. package/packages/gcanvas/src/context/webgl/Buffer.js +21 -0
  1229. package/packages/gcanvas/src/context/webgl/Framebuffer.js +21 -0
  1230. package/packages/gcanvas/src/context/webgl/GLenum.js +300 -0
  1231. package/packages/gcanvas/src/context/webgl/GLmethod.js +142 -0
  1232. package/packages/gcanvas/src/context/webgl/GLtype.js +22 -0
  1233. package/packages/gcanvas/src/context/webgl/Program.js +21 -0
  1234. package/packages/gcanvas/src/context/webgl/Renderbuffer.js +21 -0
  1235. package/packages/gcanvas/src/context/webgl/RenderingContext.js +1479 -0
  1236. package/packages/gcanvas/src/context/webgl/Shader.js +22 -0
  1237. package/packages/gcanvas/src/context/webgl/ShaderPrecisionFormat.js +11 -0
  1238. package/packages/gcanvas/src/context/webgl/Texture.js +22 -0
  1239. package/packages/gcanvas/src/context/webgl/UniformLocation.js +22 -0
  1240. package/packages/gcanvas/src/context/webgl/classUtils.js +3 -0
  1241. package/packages/gcanvas/src/env/canvas.js +210 -0
  1242. package/packages/gcanvas/src/env/image.js +76 -0
  1243. package/packages/gcanvas/src/env/off-screen-canvas.js +74 -0
  1244. package/packages/gcanvas/src/index.js +65 -0
  1245. package/src/components/CanvasView.js +20 -0
  1246. package/src/components/GCanvasComponent.js +408 -0
  1247. package/src/index.js +69 -0
  1248. package/src/packages/gcanvas/.babelrc +5 -0
  1249. package/src/packages/gcanvas/.eslintrc.js +133 -0
  1250. package/src/packages/gcanvas/package.json +19 -0
  1251. package/src/packages/gcanvas/rollup.config.js +14 -0
  1252. package/src/packages/gcanvas/src/bridge/react-native.js +288 -0
  1253. package/src/packages/gcanvas/src/bridge/weex.js +210 -0
  1254. package/src/packages/gcanvas/src/context/2d/FillStyleLinearGradient.js +17 -0
  1255. package/src/packages/gcanvas/src/context/2d/FillStylePattern.js +8 -0
  1256. package/src/packages/gcanvas/src/context/2d/FillStyleRadialGradient.js +17 -0
  1257. package/src/packages/gcanvas/src/context/2d/OffScreenRenderingContext.js +49 -0
  1258. package/src/packages/gcanvas/src/context/2d/RenderingContext.js +801 -0
  1259. package/src/packages/gcanvas/src/context/webgl/ActiveInfo.js +11 -0
  1260. package/src/packages/gcanvas/src/context/webgl/Buffer.js +21 -0
  1261. package/src/packages/gcanvas/src/context/webgl/Framebuffer.js +21 -0
  1262. package/src/packages/gcanvas/src/context/webgl/GLenum.js +300 -0
  1263. package/src/packages/gcanvas/src/context/webgl/GLmethod.js +142 -0
  1264. package/src/packages/gcanvas/src/context/webgl/GLtype.js +22 -0
  1265. package/src/packages/gcanvas/src/context/webgl/Program.js +21 -0
  1266. package/src/packages/gcanvas/src/context/webgl/Renderbuffer.js +21 -0
  1267. package/src/packages/gcanvas/src/context/webgl/RenderingContext.js +1479 -0
  1268. package/src/packages/gcanvas/src/context/webgl/Shader.js +22 -0
  1269. package/src/packages/gcanvas/src/context/webgl/ShaderPrecisionFormat.js +11 -0
  1270. package/src/packages/gcanvas/src/context/webgl/Texture.js +22 -0
  1271. package/src/packages/gcanvas/src/context/webgl/UniformLocation.js +22 -0
  1272. package/src/packages/gcanvas/src/context/webgl/classUtils.js +3 -0
  1273. package/src/packages/gcanvas/src/env/canvas.js +210 -0
  1274. package/src/packages/gcanvas/src/env/image.js +76 -0
  1275. package/src/packages/gcanvas/src/env/off-screen-canvas.js +74 -0
  1276. package/src/packages/gcanvas/src/index.js +65 -0
  1277. package/src/specs/v1/.gitkeep +1 -0
  1278. package/src/specs/v1/GCanvasViewNativeComponent.ts +47 -0
  1279. package/src/specs/v1/NativeGCanvasModule.ts +140 -0
  1280. package/src/specs/v2/.gitkeep +1 -0
@@ -0,0 +1,3932 @@
1
+ /****************************************************************************
2
+ *
3
+ * ftsdf.c
4
+ *
5
+ * Signed Distance Field support for outline fonts (body).
6
+ *
7
+ * Copyright (C) 2020-2024 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
+ #include <freetype/internal/ftobjs.h>
22
+ #include <freetype/internal/ftdebug.h>
23
+ #include <freetype/ftoutln.h>
24
+ #include <freetype/fttrigon.h>
25
+ #include <freetype/ftbitmap.h>
26
+ #include "ftsdf.h"
27
+
28
+ #include "ftsdferrs.h"
29
+
30
+
31
+ /**************************************************************************
32
+ *
33
+ * A brief technical overview of how the SDF rasterizer works
34
+ * ----------------------------------------------------------
35
+ *
36
+ * [Notes]:
37
+ * * SDF stands for Signed Distance Field everywhere.
38
+ *
39
+ * * This renderer generates SDF directly from outlines. There is
40
+ * another renderer called 'bsdf', which converts bitmaps to SDF; see
41
+ * file `ftbsdf.c` for more.
42
+ *
43
+ * * The basic idea of generating the SDF is taken from Viktor Chlumsky's
44
+ * research paper. The paper explains both single and multi-channel
45
+ * SDF, however, this implementation only generates single-channel SDF.
46
+ *
47
+ * Chlumsky, Viktor: Shape Decomposition for Multi-channel Distance
48
+ * Fields. Master's thesis. Czech Technical University in Prague,
49
+ * Faculty of InformationTechnology, 2015.
50
+ *
51
+ * For more information: https://github.com/Chlumsky/msdfgen
52
+ *
53
+ * ========================================================================
54
+ *
55
+ * Generating SDF from outlines is pretty straightforward.
56
+ *
57
+ * (1) We have a set of contours that make the outline of a shape/glyph.
58
+ * Each contour comprises of several edges, with three types of edges.
59
+ *
60
+ * * line segments
61
+ * * conic Bezier curves
62
+ * * cubic Bezier curves
63
+ *
64
+ * (2) Apart from the outlines we also have a two-dimensional grid, namely
65
+ * the bitmap that is used to represent the final SDF data.
66
+ *
67
+ * (3) In order to generate SDF, our task is to find shortest signed
68
+ * distance from each grid point to the outline. The 'signed
69
+ * distance' means that if the grid point is filled by any contour
70
+ * then its sign is positive, otherwise it is negative. The pseudo
71
+ * code is as follows.
72
+ *
73
+ * ```
74
+ * foreach grid_point (x, y):
75
+ * {
76
+ * int min_dist = INT_MAX;
77
+ *
78
+ * foreach contour in outline:
79
+ * {
80
+ * foreach edge in contour:
81
+ * {
82
+ * // get shortest distance from point (x, y) to the edge
83
+ * d = get_min_dist(x, y, edge);
84
+ *
85
+ * if (d < min_dist)
86
+ * min_dist = d;
87
+ * }
88
+ *
89
+ * bitmap[x, y] = min_dist;
90
+ * }
91
+ * }
92
+ * ```
93
+ *
94
+ * (4) After running this algorithm the bitmap contains information about
95
+ * the shortest distance from each point to the outline of the shape.
96
+ * Of course, while this is the most straightforward way of generating
97
+ * SDF, we use various optimizations in our implementation. See the
98
+ * `sdf_generate_*' functions in this file for all details.
99
+ *
100
+ * The optimization currently used by default is subdivision; see
101
+ * function `sdf_generate_subdivision` for more.
102
+ *
103
+ * Also, to see how we compute the shortest distance from a point to
104
+ * each type of edge, check out the `get_min_distance_*' functions.
105
+ *
106
+ */
107
+
108
+
109
+ /**************************************************************************
110
+ *
111
+ * The macro FT_COMPONENT is used in trace mode. It is an implicit
112
+ * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
113
+ * messages during execution.
114
+ */
115
+ #undef FT_COMPONENT
116
+ #define FT_COMPONENT sdf
117
+
118
+
119
+ /**************************************************************************
120
+ *
121
+ * definitions
122
+ *
123
+ */
124
+
125
+ /*
126
+ * If set to 1, the rasterizer uses Newton-Raphson's method for finding
127
+ * the shortest distance from a point to a conic curve.
128
+ *
129
+ * If set to 0, an analytical method gets used instead, which computes the
130
+ * roots of a cubic polynomial to find the shortest distance. However,
131
+ * the analytical method can currently underflow; we thus use Newton's
132
+ * method by default.
133
+ */
134
+ #ifndef USE_NEWTON_FOR_CONIC
135
+ #define USE_NEWTON_FOR_CONIC 1
136
+ #endif
137
+
138
+ /*
139
+ * The number of intervals a Bezier curve gets sampled and checked to find
140
+ * the shortest distance.
141
+ */
142
+ #define MAX_NEWTON_DIVISIONS 4
143
+
144
+ /*
145
+ * The number of steps of Newton's iterations in each interval of the
146
+ * Bezier curve. Basically, we run Newton's approximation
147
+ *
148
+ * x -= Q(t) / Q'(t)
149
+ *
150
+ * for each division to get the shortest distance.
151
+ */
152
+ #define MAX_NEWTON_STEPS 4
153
+
154
+ /*
155
+ * The epsilon distance (in 16.16 fractional units) used for corner
156
+ * resolving. If the difference of two distances is less than this value
157
+ * they will be checked for a corner if they are ambiguous.
158
+ */
159
+ #define CORNER_CHECK_EPSILON 32
160
+
161
+ #if 0
162
+ /*
163
+ * Coarse grid dimension. Will probably be removed in the future because
164
+ * coarse grid optimization is the slowest algorithm.
165
+ */
166
+ #define CG_DIMEN 8
167
+ #endif
168
+
169
+
170
+ /**************************************************************************
171
+ *
172
+ * macros
173
+ *
174
+ */
175
+
176
+ #define MUL_26D6( a, b ) ( ( ( a ) * ( b ) ) / 64 )
177
+ #define VEC_26D6_DOT( p, q ) ( MUL_26D6( p.x, q.x ) + \
178
+ MUL_26D6( p.y, q.y ) )
179
+
180
+
181
+ /**************************************************************************
182
+ *
183
+ * structures and enums
184
+ *
185
+ */
186
+
187
+ /**************************************************************************
188
+ *
189
+ * @Struct:
190
+ * SDF_TRaster
191
+ *
192
+ * @Description:
193
+ * This struct is used in place of @FT_Raster and is stored within the
194
+ * internal FreeType renderer struct. While rasterizing it is passed to
195
+ * the @FT_Raster_RenderFunc function, which then can be used however we
196
+ * want.
197
+ *
198
+ * @Fields:
199
+ * memory ::
200
+ * Used internally to allocate intermediate memory while raterizing.
201
+ *
202
+ */
203
+ typedef struct SDF_TRaster_
204
+ {
205
+ FT_Memory memory;
206
+
207
+ } SDF_TRaster, *SDF_PRaster;
208
+
209
+
210
+ /**************************************************************************
211
+ *
212
+ * @Enum:
213
+ * SDF_Edge_Type
214
+ *
215
+ * @Description:
216
+ * Enumeration of all curve types present in fonts.
217
+ *
218
+ * @Fields:
219
+ * SDF_EDGE_UNDEFINED ::
220
+ * Undefined edge, simply used to initialize and detect errors.
221
+ *
222
+ * SDF_EDGE_LINE ::
223
+ * Line segment with start and end point.
224
+ *
225
+ * SDF_EDGE_CONIC ::
226
+ * A conic/quadratic Bezier curve with start, end, and one control
227
+ * point.
228
+ *
229
+ * SDF_EDGE_CUBIC ::
230
+ * A cubic Bezier curve with start, end, and two control points.
231
+ *
232
+ */
233
+ typedef enum SDF_Edge_Type_
234
+ {
235
+ SDF_EDGE_UNDEFINED = 0,
236
+ SDF_EDGE_LINE = 1,
237
+ SDF_EDGE_CONIC = 2,
238
+ SDF_EDGE_CUBIC = 3
239
+
240
+ } SDF_Edge_Type;
241
+
242
+
243
+ /**************************************************************************
244
+ *
245
+ * @Enum:
246
+ * SDF_Contour_Orientation
247
+ *
248
+ * @Description:
249
+ * Enumeration of all orientation values of a contour. We determine the
250
+ * orientation by calculating the area covered by a contour. Contrary
251
+ * to values returned by @FT_Outline_Get_Orientation,
252
+ * `SDF_Contour_Orientation` is independent of the fill rule, which can
253
+ * be different for different font formats.
254
+ *
255
+ * @Fields:
256
+ * SDF_ORIENTATION_NONE ::
257
+ * Undefined orientation, used for initialization and error detection.
258
+ *
259
+ * SDF_ORIENTATION_CW ::
260
+ * Clockwise orientation (positive area covered).
261
+ *
262
+ * SDF_ORIENTATION_CCW ::
263
+ * Counter-clockwise orientation (negative area covered).
264
+ *
265
+ * @Note:
266
+ * See @FT_Outline_Get_Orientation for more details.
267
+ *
268
+ */
269
+ typedef enum SDF_Contour_Orientation_
270
+ {
271
+ SDF_ORIENTATION_NONE = 0,
272
+ SDF_ORIENTATION_CW = 1,
273
+ SDF_ORIENTATION_CCW = 2
274
+
275
+ } SDF_Contour_Orientation;
276
+
277
+
278
+ /**************************************************************************
279
+ *
280
+ * @Struct:
281
+ * SDF_Edge
282
+ *
283
+ * @Description:
284
+ * Represent an edge of a contour.
285
+ *
286
+ * @Fields:
287
+ * start_pos ::
288
+ * Start position of an edge. Valid for all types of edges.
289
+ *
290
+ * end_pos ::
291
+ * Etart position of an edge. Valid for all types of edges.
292
+ *
293
+ * control_a ::
294
+ * A control point of the edge. Valid only for `SDF_EDGE_CONIC`
295
+ * and `SDF_EDGE_CUBIC`.
296
+ *
297
+ * control_b ::
298
+ * Another control point of the edge. Valid only for
299
+ * `SDF_EDGE_CONIC`.
300
+ *
301
+ * edge_type ::
302
+ * Type of the edge, see @SDF_Edge_Type for all possible edge types.
303
+ *
304
+ * next ::
305
+ * Used to create a singly linked list, which can be interpreted
306
+ * as a contour.
307
+ *
308
+ */
309
+ typedef struct SDF_Edge_
310
+ {
311
+ FT_26D6_Vec start_pos;
312
+ FT_26D6_Vec end_pos;
313
+ FT_26D6_Vec control_a;
314
+ FT_26D6_Vec control_b;
315
+
316
+ SDF_Edge_Type edge_type;
317
+
318
+ struct SDF_Edge_* next;
319
+
320
+ } SDF_Edge;
321
+
322
+
323
+ /**************************************************************************
324
+ *
325
+ * @Struct:
326
+ * SDF_Contour
327
+ *
328
+ * @Description:
329
+ * Represent a complete contour, which contains a list of edges.
330
+ *
331
+ * @Fields:
332
+ * last_pos ::
333
+ * Contains the value of `end_pos' of the last edge in the list of
334
+ * edges. Useful while decomposing the outline with
335
+ * @FT_Outline_Decompose.
336
+ *
337
+ * edges ::
338
+ * Linked list of all the edges that make the contour.
339
+ *
340
+ * next ::
341
+ * Used to create a singly linked list, which can be interpreted as a
342
+ * complete shape or @FT_Outline.
343
+ *
344
+ */
345
+ typedef struct SDF_Contour_
346
+ {
347
+ FT_26D6_Vec last_pos;
348
+ SDF_Edge* edges;
349
+
350
+ struct SDF_Contour_* next;
351
+
352
+ } SDF_Contour;
353
+
354
+
355
+ /**************************************************************************
356
+ *
357
+ * @Struct:
358
+ * SDF_Shape
359
+ *
360
+ * @Description:
361
+ * Represent a complete shape, which is the decomposition of
362
+ * @FT_Outline.
363
+ *
364
+ * @Fields:
365
+ * memory ::
366
+ * Used internally to allocate memory.
367
+ *
368
+ * contours ::
369
+ * Linked list of all the contours that make the shape.
370
+ *
371
+ */
372
+ typedef struct SDF_Shape_
373
+ {
374
+ FT_Memory memory;
375
+ SDF_Contour* contours;
376
+
377
+ } SDF_Shape;
378
+
379
+
380
+ /**************************************************************************
381
+ *
382
+ * @Struct:
383
+ * SDF_Signed_Distance
384
+ *
385
+ * @Description:
386
+ * Represent signed distance of a point, i.e., the distance of the edge
387
+ * nearest to the point.
388
+ *
389
+ * @Fields:
390
+ * distance ::
391
+ * Distance of the point from the nearest edge. Can be squared or
392
+ * absolute depending on the `USE_SQUARED_DISTANCES` macro defined in
393
+ * file `ftsdfcommon.h`.
394
+ *
395
+ * cross ::
396
+ * Cross product of the shortest distance vector (i.e., the vector
397
+ * from the point to the nearest edge) and the direction of the edge
398
+ * at the nearest point. This is used to resolve ambiguities of
399
+ * `sign`.
400
+ *
401
+ * sign ::
402
+ * A value used to indicate whether the distance vector is outside or
403
+ * inside the contour corresponding to the edge.
404
+ *
405
+ * @Note:
406
+ * `sign` may or may not be correct, therefore it must be checked
407
+ * properly in case there is an ambiguity.
408
+ *
409
+ */
410
+ typedef struct SDF_Signed_Distance_
411
+ {
412
+ FT_16D16 distance;
413
+ FT_16D16 cross;
414
+ FT_Char sign;
415
+
416
+ } SDF_Signed_Distance;
417
+
418
+
419
+ /**************************************************************************
420
+ *
421
+ * @Struct:
422
+ * SDF_Params
423
+ *
424
+ * @Description:
425
+ * Yet another internal parameters required by the rasterizer.
426
+ *
427
+ * @Fields:
428
+ * orientation ::
429
+ * This is not the @SDF_Contour_Orientation value but @FT_Orientation,
430
+ * which determines whether clockwise-oriented outlines are to be
431
+ * filled or counter-clockwise-oriented ones.
432
+ *
433
+ * flip_sign ::
434
+ * If set to true, flip the sign. By default the points filled by the
435
+ * outline are positive.
436
+ *
437
+ * flip_y ::
438
+ * If set to true the output bitmap is upside-down. Can be useful
439
+ * because OpenGL and DirectX use different coordinate systems for
440
+ * textures.
441
+ *
442
+ * overload_sign ::
443
+ * In the subdivision and bounding box optimization, the default
444
+ * outside sign is taken as -1. This parameter can be used to modify
445
+ * that behaviour. For example, while generating SDF for a single
446
+ * counter-clockwise contour, the outside sign should be 1.
447
+ *
448
+ */
449
+ typedef struct SDF_Params_
450
+ {
451
+ FT_Orientation orientation;
452
+ FT_Bool flip_sign;
453
+ FT_Bool flip_y;
454
+
455
+ FT_Int overload_sign;
456
+
457
+ } SDF_Params;
458
+
459
+
460
+ /**************************************************************************
461
+ *
462
+ * constants, initializer, and destructor
463
+ *
464
+ */
465
+
466
+ static
467
+ const FT_Vector zero_vector = { 0, 0 };
468
+
469
+ static
470
+ const SDF_Edge null_edge = { { 0, 0 }, { 0, 0 },
471
+ { 0, 0 }, { 0, 0 },
472
+ SDF_EDGE_UNDEFINED, NULL };
473
+
474
+ static
475
+ const SDF_Contour null_contour = { { 0, 0 }, NULL, NULL };
476
+
477
+ static
478
+ const SDF_Shape null_shape = { NULL, NULL };
479
+
480
+ static
481
+ const SDF_Signed_Distance max_sdf = { INT_MAX, 0, 0 };
482
+
483
+
484
+ /* Create a new @SDF_Edge on the heap and assigns the `edge` */
485
+ /* pointer to the newly allocated memory. */
486
+ static FT_Error
487
+ sdf_edge_new( FT_Memory memory,
488
+ SDF_Edge** edge )
489
+ {
490
+ FT_Error error = FT_Err_Ok;
491
+ SDF_Edge* ptr = NULL;
492
+
493
+
494
+ if ( !memory || !edge )
495
+ {
496
+ error = FT_THROW( Invalid_Argument );
497
+ goto Exit;
498
+ }
499
+
500
+ if ( !FT_QNEW( ptr ) )
501
+ {
502
+ *ptr = null_edge;
503
+ *edge = ptr;
504
+ }
505
+
506
+ Exit:
507
+ return error;
508
+ }
509
+
510
+
511
+ /* Free the allocated `edge` variable. */
512
+ static void
513
+ sdf_edge_done( FT_Memory memory,
514
+ SDF_Edge** edge )
515
+ {
516
+ if ( !memory || !edge || !*edge )
517
+ return;
518
+
519
+ FT_FREE( *edge );
520
+ }
521
+
522
+
523
+ /* Create a new @SDF_Contour on the heap and assign */
524
+ /* the `contour` pointer to the newly allocated memory. */
525
+ static FT_Error
526
+ sdf_contour_new( FT_Memory memory,
527
+ SDF_Contour** contour )
528
+ {
529
+ FT_Error error = FT_Err_Ok;
530
+ SDF_Contour* ptr = NULL;
531
+
532
+
533
+ if ( !memory || !contour )
534
+ {
535
+ error = FT_THROW( Invalid_Argument );
536
+ goto Exit;
537
+ }
538
+
539
+ if ( !FT_QNEW( ptr ) )
540
+ {
541
+ *ptr = null_contour;
542
+ *contour = ptr;
543
+ }
544
+
545
+ Exit:
546
+ return error;
547
+ }
548
+
549
+
550
+ /* Free the allocated `contour` variable. */
551
+ /* Also free the list of edges. */
552
+ static void
553
+ sdf_contour_done( FT_Memory memory,
554
+ SDF_Contour** contour )
555
+ {
556
+ SDF_Edge* edges;
557
+ SDF_Edge* temp;
558
+
559
+
560
+ if ( !memory || !contour || !*contour )
561
+ return;
562
+
563
+ edges = (*contour)->edges;
564
+
565
+ /* release all edges */
566
+ while ( edges )
567
+ {
568
+ temp = edges;
569
+ edges = edges->next;
570
+
571
+ sdf_edge_done( memory, &temp );
572
+ }
573
+
574
+ FT_FREE( *contour );
575
+ }
576
+
577
+
578
+ /* Create a new @SDF_Shape on the heap and assign */
579
+ /* the `shape` pointer to the newly allocated memory. */
580
+ static FT_Error
581
+ sdf_shape_new( FT_Memory memory,
582
+ SDF_Shape** shape )
583
+ {
584
+ FT_Error error = FT_Err_Ok;
585
+ SDF_Shape* ptr = NULL;
586
+
587
+
588
+ if ( !memory || !shape )
589
+ {
590
+ error = FT_THROW( Invalid_Argument );
591
+ goto Exit;
592
+ }
593
+
594
+ if ( !FT_QNEW( ptr ) )
595
+ {
596
+ *ptr = null_shape;
597
+ ptr->memory = memory;
598
+ *shape = ptr;
599
+ }
600
+
601
+ Exit:
602
+ return error;
603
+ }
604
+
605
+
606
+ /* Free the allocated `shape` variable. */
607
+ /* Also free the list of contours. */
608
+ static void
609
+ sdf_shape_done( SDF_Shape** shape )
610
+ {
611
+ FT_Memory memory;
612
+ SDF_Contour* contours;
613
+ SDF_Contour* temp;
614
+
615
+
616
+ if ( !shape || !*shape )
617
+ return;
618
+
619
+ memory = (*shape)->memory;
620
+ contours = (*shape)->contours;
621
+
622
+ if ( !memory )
623
+ return;
624
+
625
+ /* release all contours */
626
+ while ( contours )
627
+ {
628
+ temp = contours;
629
+ contours = contours->next;
630
+
631
+ sdf_contour_done( memory, &temp );
632
+ }
633
+
634
+ /* release the allocated shape struct */
635
+ FT_FREE( *shape );
636
+ }
637
+
638
+
639
+ /**************************************************************************
640
+ *
641
+ * shape decomposition functions
642
+ *
643
+ */
644
+
645
+ /* This function is called when starting a new contour at `to`, */
646
+ /* which gets added to the shape's list. */
647
+ static FT_Error
648
+ sdf_move_to( const FT_26D6_Vec* to,
649
+ void* user )
650
+ {
651
+ SDF_Shape* shape = ( SDF_Shape* )user;
652
+ SDF_Contour* contour = NULL;
653
+
654
+ FT_Error error = FT_Err_Ok;
655
+ FT_Memory memory = shape->memory;
656
+
657
+
658
+ if ( !to || !user )
659
+ {
660
+ error = FT_THROW( Invalid_Argument );
661
+ goto Exit;
662
+ }
663
+
664
+ FT_CALL( sdf_contour_new( memory, &contour ) );
665
+
666
+ contour->last_pos = *to;
667
+ contour->next = shape->contours;
668
+ shape->contours = contour;
669
+
670
+ Exit:
671
+ return error;
672
+ }
673
+
674
+
675
+ /* This function is called when there is a line in the */
676
+ /* contour. The line starts at the previous edge point and */
677
+ /* stops at `to`. */
678
+ static FT_Error
679
+ sdf_line_to( const FT_26D6_Vec* to,
680
+ void* user )
681
+ {
682
+ SDF_Shape* shape = ( SDF_Shape* )user;
683
+ SDF_Edge* edge = NULL;
684
+ SDF_Contour* contour = NULL;
685
+
686
+ FT_Error error = FT_Err_Ok;
687
+ FT_Memory memory = shape->memory;
688
+
689
+
690
+ if ( !to || !user )
691
+ {
692
+ error = FT_THROW( Invalid_Argument );
693
+ goto Exit;
694
+ }
695
+
696
+ contour = shape->contours;
697
+
698
+ if ( contour->last_pos.x == to->x &&
699
+ contour->last_pos.y == to->y )
700
+ goto Exit;
701
+
702
+ FT_CALL( sdf_edge_new( memory, &edge ) );
703
+
704
+ edge->edge_type = SDF_EDGE_LINE;
705
+ edge->start_pos = contour->last_pos;
706
+ edge->end_pos = *to;
707
+
708
+ edge->next = contour->edges;
709
+ contour->edges = edge;
710
+ contour->last_pos = *to;
711
+
712
+ Exit:
713
+ return error;
714
+ }
715
+
716
+
717
+ /* This function is called when there is a conic Bezier curve */
718
+ /* in the contour. The curve starts at the previous edge point */
719
+ /* and stops at `to`, with control point `control_1`. */
720
+ static FT_Error
721
+ sdf_conic_to( const FT_26D6_Vec* control_1,
722
+ const FT_26D6_Vec* to,
723
+ void* user )
724
+ {
725
+ SDF_Shape* shape = ( SDF_Shape* )user;
726
+ SDF_Edge* edge = NULL;
727
+ SDF_Contour* contour = NULL;
728
+
729
+ FT_Error error = FT_Err_Ok;
730
+ FT_Memory memory = shape->memory;
731
+
732
+
733
+ if ( !control_1 || !to || !user )
734
+ {
735
+ error = FT_THROW( Invalid_Argument );
736
+ goto Exit;
737
+ }
738
+
739
+ contour = shape->contours;
740
+
741
+ /* If the control point coincides with any of the end points */
742
+ /* then it is a line and should be treated as one to avoid */
743
+ /* unnecessary complexity later in the algorithm. */
744
+ if ( ( contour->last_pos.x == control_1->x &&
745
+ contour->last_pos.y == control_1->y ) ||
746
+ ( control_1->x == to->x &&
747
+ control_1->y == to->y ) )
748
+ {
749
+ sdf_line_to( to, user );
750
+ goto Exit;
751
+ }
752
+
753
+ FT_CALL( sdf_edge_new( memory, &edge ) );
754
+
755
+ edge->edge_type = SDF_EDGE_CONIC;
756
+ edge->start_pos = contour->last_pos;
757
+ edge->control_a = *control_1;
758
+ edge->end_pos = *to;
759
+
760
+ edge->next = contour->edges;
761
+ contour->edges = edge;
762
+ contour->last_pos = *to;
763
+
764
+ Exit:
765
+ return error;
766
+ }
767
+
768
+
769
+ /* This function is called when there is a cubic Bezier curve */
770
+ /* in the contour. The curve starts at the previous edge point */
771
+ /* and stops at `to`, with two control points `control_1` and */
772
+ /* `control_2`. */
773
+ static FT_Error
774
+ sdf_cubic_to( const FT_26D6_Vec* control_1,
775
+ const FT_26D6_Vec* control_2,
776
+ const FT_26D6_Vec* to,
777
+ void* user )
778
+ {
779
+ SDF_Shape* shape = ( SDF_Shape* )user;
780
+ SDF_Edge* edge = NULL;
781
+ SDF_Contour* contour = NULL;
782
+
783
+ FT_Error error = FT_Err_Ok;
784
+ FT_Memory memory = shape->memory;
785
+
786
+
787
+ if ( !control_2 || !control_1 || !to || !user )
788
+ {
789
+ error = FT_THROW( Invalid_Argument );
790
+ goto Exit;
791
+ }
792
+
793
+ contour = shape->contours;
794
+
795
+ FT_CALL( sdf_edge_new( memory, &edge ) );
796
+
797
+ edge->edge_type = SDF_EDGE_CUBIC;
798
+ edge->start_pos = contour->last_pos;
799
+ edge->control_a = *control_1;
800
+ edge->control_b = *control_2;
801
+ edge->end_pos = *to;
802
+
803
+ edge->next = contour->edges;
804
+ contour->edges = edge;
805
+ contour->last_pos = *to;
806
+
807
+ Exit:
808
+ return error;
809
+ }
810
+
811
+
812
+ /* Construct the structure to hold all four outline */
813
+ /* decomposition functions. */
814
+ FT_DEFINE_OUTLINE_FUNCS(
815
+ sdf_decompose_funcs,
816
+
817
+ (FT_Outline_MoveTo_Func) sdf_move_to, /* move_to */
818
+ (FT_Outline_LineTo_Func) sdf_line_to, /* line_to */
819
+ (FT_Outline_ConicTo_Func)sdf_conic_to, /* conic_to */
820
+ (FT_Outline_CubicTo_Func)sdf_cubic_to, /* cubic_to */
821
+
822
+ 0, /* shift */
823
+ 0 /* delta */
824
+ )
825
+
826
+
827
+ /* Decompose `outline` and put it into the `shape` structure. */
828
+ static FT_Error
829
+ sdf_outline_decompose( FT_Outline* outline,
830
+ SDF_Shape* shape )
831
+ {
832
+ FT_Error error = FT_Err_Ok;
833
+
834
+
835
+ if ( !outline || !shape )
836
+ {
837
+ error = FT_THROW( Invalid_Argument );
838
+ goto Exit;
839
+ }
840
+
841
+ error = FT_Outline_Decompose( outline,
842
+ &sdf_decompose_funcs,
843
+ (void*)shape );
844
+
845
+ Exit:
846
+ return error;
847
+ }
848
+
849
+
850
+ /**************************************************************************
851
+ *
852
+ * utility functions
853
+ *
854
+ */
855
+
856
+ /* Return the control box of an edge. The control box is a rectangle */
857
+ /* in which all the control points can fit tightly. */
858
+ static FT_CBox
859
+ get_control_box( SDF_Edge edge )
860
+ {
861
+ FT_CBox cbox = { 0, 0, 0, 0 };
862
+ FT_Bool is_set = 0;
863
+
864
+
865
+ switch ( edge.edge_type )
866
+ {
867
+ case SDF_EDGE_CUBIC:
868
+ cbox.xMin = edge.control_b.x;
869
+ cbox.xMax = edge.control_b.x;
870
+ cbox.yMin = edge.control_b.y;
871
+ cbox.yMax = edge.control_b.y;
872
+
873
+ is_set = 1;
874
+ FALL_THROUGH;
875
+
876
+ case SDF_EDGE_CONIC:
877
+ if ( is_set )
878
+ {
879
+ cbox.xMin = edge.control_a.x < cbox.xMin
880
+ ? edge.control_a.x
881
+ : cbox.xMin;
882
+ cbox.xMax = edge.control_a.x > cbox.xMax
883
+ ? edge.control_a.x
884
+ : cbox.xMax;
885
+
886
+ cbox.yMin = edge.control_a.y < cbox.yMin
887
+ ? edge.control_a.y
888
+ : cbox.yMin;
889
+ cbox.yMax = edge.control_a.y > cbox.yMax
890
+ ? edge.control_a.y
891
+ : cbox.yMax;
892
+ }
893
+ else
894
+ {
895
+ cbox.xMin = edge.control_a.x;
896
+ cbox.xMax = edge.control_a.x;
897
+ cbox.yMin = edge.control_a.y;
898
+ cbox.yMax = edge.control_a.y;
899
+
900
+ is_set = 1;
901
+ }
902
+ FALL_THROUGH;
903
+
904
+ case SDF_EDGE_LINE:
905
+ if ( is_set )
906
+ {
907
+ cbox.xMin = edge.start_pos.x < cbox.xMin
908
+ ? edge.start_pos.x
909
+ : cbox.xMin;
910
+ cbox.xMax = edge.start_pos.x > cbox.xMax
911
+ ? edge.start_pos.x
912
+ : cbox.xMax;
913
+
914
+ cbox.yMin = edge.start_pos.y < cbox.yMin
915
+ ? edge.start_pos.y
916
+ : cbox.yMin;
917
+ cbox.yMax = edge.start_pos.y > cbox.yMax
918
+ ? edge.start_pos.y
919
+ : cbox.yMax;
920
+ }
921
+ else
922
+ {
923
+ cbox.xMin = edge.start_pos.x;
924
+ cbox.xMax = edge.start_pos.x;
925
+ cbox.yMin = edge.start_pos.y;
926
+ cbox.yMax = edge.start_pos.y;
927
+ }
928
+
929
+ cbox.xMin = edge.end_pos.x < cbox.xMin
930
+ ? edge.end_pos.x
931
+ : cbox.xMin;
932
+ cbox.xMax = edge.end_pos.x > cbox.xMax
933
+ ? edge.end_pos.x
934
+ : cbox.xMax;
935
+
936
+ cbox.yMin = edge.end_pos.y < cbox.yMin
937
+ ? edge.end_pos.y
938
+ : cbox.yMin;
939
+ cbox.yMax = edge.end_pos.y > cbox.yMax
940
+ ? edge.end_pos.y
941
+ : cbox.yMax;
942
+
943
+ break;
944
+
945
+ default:
946
+ break;
947
+ }
948
+
949
+ return cbox;
950
+ }
951
+
952
+
953
+ /* Return orientation of a single contour. */
954
+ /* Note that the orientation is independent of the fill rule! */
955
+ /* So, for TTF a clockwise-oriented contour has to be filled */
956
+ /* and the opposite for OTF fonts. */
957
+ static SDF_Contour_Orientation
958
+ get_contour_orientation ( SDF_Contour* contour )
959
+ {
960
+ SDF_Edge* head = NULL;
961
+ FT_26D6 area = 0;
962
+
963
+
964
+ /* return none if invalid parameters */
965
+ if ( !contour || !contour->edges )
966
+ return SDF_ORIENTATION_NONE;
967
+
968
+ head = contour->edges;
969
+
970
+ /* Calculate the area of the control box for all edges. */
971
+ while ( head )
972
+ {
973
+ switch ( head->edge_type )
974
+ {
975
+ case SDF_EDGE_LINE:
976
+ area += MUL_26D6( ( head->end_pos.x - head->start_pos.x ),
977
+ ( head->end_pos.y + head->start_pos.y ) );
978
+ break;
979
+
980
+ case SDF_EDGE_CONIC:
981
+ area += MUL_26D6( head->control_a.x - head->start_pos.x,
982
+ head->control_a.y + head->start_pos.y );
983
+ area += MUL_26D6( head->end_pos.x - head->control_a.x,
984
+ head->end_pos.y + head->control_a.y );
985
+ break;
986
+
987
+ case SDF_EDGE_CUBIC:
988
+ area += MUL_26D6( head->control_a.x - head->start_pos.x,
989
+ head->control_a.y + head->start_pos.y );
990
+ area += MUL_26D6( head->control_b.x - head->control_a.x,
991
+ head->control_b.y + head->control_a.y );
992
+ area += MUL_26D6( head->end_pos.x - head->control_b.x,
993
+ head->end_pos.y + head->control_b.y );
994
+ break;
995
+
996
+ default:
997
+ return SDF_ORIENTATION_NONE;
998
+ }
999
+
1000
+ head = head->next;
1001
+ }
1002
+
1003
+ /* Clockwise contours cover a positive area, and counter-clockwise */
1004
+ /* contours cover a negative area. */
1005
+ if ( area > 0 )
1006
+ return SDF_ORIENTATION_CW;
1007
+ else
1008
+ return SDF_ORIENTATION_CCW;
1009
+ }
1010
+
1011
+
1012
+ /* This function is exactly the same as the one */
1013
+ /* in the smooth renderer. It splits a conic */
1014
+ /* into two conics exactly half way at t = 0.5. */
1015
+ static void
1016
+ split_conic( FT_26D6_Vec* base )
1017
+ {
1018
+ FT_26D6 a, b;
1019
+
1020
+
1021
+ base[4].x = base[2].x;
1022
+ a = base[0].x + base[1].x;
1023
+ b = base[1].x + base[2].x;
1024
+ base[3].x = b / 2;
1025
+ base[2].x = ( a + b ) / 4;
1026
+ base[1].x = a / 2;
1027
+
1028
+ base[4].y = base[2].y;
1029
+ a = base[0].y + base[1].y;
1030
+ b = base[1].y + base[2].y;
1031
+ base[3].y = b / 2;
1032
+ base[2].y = ( a + b ) / 4;
1033
+ base[1].y = a / 2;
1034
+ }
1035
+
1036
+
1037
+ /* This function is exactly the same as the one */
1038
+ /* in the smooth renderer. It splits a cubic */
1039
+ /* into two cubics exactly half way at t = 0.5. */
1040
+ static void
1041
+ split_cubic( FT_26D6_Vec* base )
1042
+ {
1043
+ FT_26D6 a, b, c;
1044
+
1045
+
1046
+ base[6].x = base[3].x;
1047
+ a = base[0].x + base[1].x;
1048
+ b = base[1].x + base[2].x;
1049
+ c = base[2].x + base[3].x;
1050
+ base[5].x = c / 2;
1051
+ c += b;
1052
+ base[4].x = c / 4;
1053
+ base[1].x = a / 2;
1054
+ a += b;
1055
+ base[2].x = a / 4;
1056
+ base[3].x = ( a + c ) / 8;
1057
+
1058
+ base[6].y = base[3].y;
1059
+ a = base[0].y + base[1].y;
1060
+ b = base[1].y + base[2].y;
1061
+ c = base[2].y + base[3].y;
1062
+ base[5].y = c / 2;
1063
+ c += b;
1064
+ base[4].y = c / 4;
1065
+ base[1].y = a / 2;
1066
+ a += b;
1067
+ base[2].y = a / 4;
1068
+ base[3].y = ( a + c ) / 8;
1069
+ }
1070
+
1071
+
1072
+ /* Split a conic Bezier curve into a number of lines */
1073
+ /* and add them to `out'. */
1074
+ /* */
1075
+ /* This function uses recursion; we thus need */
1076
+ /* parameter `max_splits' for stopping. */
1077
+ static FT_Error
1078
+ split_sdf_conic( FT_Memory memory,
1079
+ FT_26D6_Vec* control_points,
1080
+ FT_UInt max_splits,
1081
+ SDF_Edge** out )
1082
+ {
1083
+ FT_Error error = FT_Err_Ok;
1084
+ FT_26D6_Vec cpos[5];
1085
+ SDF_Edge* left,* right;
1086
+
1087
+
1088
+ if ( !memory || !out )
1089
+ {
1090
+ error = FT_THROW( Invalid_Argument );
1091
+ goto Exit;
1092
+ }
1093
+
1094
+ /* split conic outline */
1095
+ cpos[0] = control_points[0];
1096
+ cpos[1] = control_points[1];
1097
+ cpos[2] = control_points[2];
1098
+
1099
+ split_conic( cpos );
1100
+
1101
+ /* If max number of splits is done */
1102
+ /* then stop and add the lines to */
1103
+ /* the list. */
1104
+ if ( max_splits <= 2 )
1105
+ goto Append;
1106
+
1107
+ /* Otherwise keep splitting. */
1108
+ FT_CALL( split_sdf_conic( memory, &cpos[0], max_splits / 2, out ) );
1109
+ FT_CALL( split_sdf_conic( memory, &cpos[2], max_splits / 2, out ) );
1110
+
1111
+ /* [NOTE]: This is not an efficient way of */
1112
+ /* splitting the curve. Check the deviation */
1113
+ /* instead and stop if the deviation is less */
1114
+ /* than a pixel. */
1115
+
1116
+ goto Exit;
1117
+
1118
+ Append:
1119
+ /* Do allocation and add the lines to the list. */
1120
+
1121
+ FT_CALL( sdf_edge_new( memory, &left ) );
1122
+ FT_CALL( sdf_edge_new( memory, &right ) );
1123
+
1124
+ left->start_pos = cpos[0];
1125
+ left->end_pos = cpos[2];
1126
+ left->edge_type = SDF_EDGE_LINE;
1127
+
1128
+ right->start_pos = cpos[2];
1129
+ right->end_pos = cpos[4];
1130
+ right->edge_type = SDF_EDGE_LINE;
1131
+
1132
+ left->next = right;
1133
+ right->next = (*out);
1134
+ *out = left;
1135
+
1136
+ Exit:
1137
+ return error;
1138
+ }
1139
+
1140
+
1141
+ /* Split a cubic Bezier curve into a number of lines */
1142
+ /* and add them to `out`. */
1143
+ /* */
1144
+ /* This function uses recursion; we thus need */
1145
+ /* parameter `max_splits' for stopping. */
1146
+ static FT_Error
1147
+ split_sdf_cubic( FT_Memory memory,
1148
+ FT_26D6_Vec* control_points,
1149
+ FT_UInt max_splits,
1150
+ SDF_Edge** out )
1151
+ {
1152
+ FT_Error error = FT_Err_Ok;
1153
+ FT_26D6_Vec cpos[7];
1154
+ SDF_Edge* left, *right;
1155
+ const FT_26D6 threshold = ONE_PIXEL / 4;
1156
+
1157
+
1158
+ if ( !memory || !out )
1159
+ {
1160
+ error = FT_THROW( Invalid_Argument );
1161
+ goto Exit;
1162
+ }
1163
+
1164
+ /* split the cubic */
1165
+ cpos[0] = control_points[0];
1166
+ cpos[1] = control_points[1];
1167
+ cpos[2] = control_points[2];
1168
+ cpos[3] = control_points[3];
1169
+
1170
+ /* If the segment is flat enough we won't get any benefit by */
1171
+ /* splitting it further, so we can just stop splitting. */
1172
+ /* */
1173
+ /* Check the deviation of the Bezier curve and stop if it is */
1174
+ /* smaller than the pre-defined `threshold` value. */
1175
+ if ( FT_ABS( 2 * cpos[0].x - 3 * cpos[1].x + cpos[3].x ) < threshold &&
1176
+ FT_ABS( 2 * cpos[0].y - 3 * cpos[1].y + cpos[3].y ) < threshold &&
1177
+ FT_ABS( cpos[0].x - 3 * cpos[2].x + 2 * cpos[3].x ) < threshold &&
1178
+ FT_ABS( cpos[0].y - 3 * cpos[2].y + 2 * cpos[3].y ) < threshold )
1179
+ {
1180
+ split_cubic( cpos );
1181
+ goto Append;
1182
+ }
1183
+
1184
+ split_cubic( cpos );
1185
+
1186
+ /* If max number of splits is done */
1187
+ /* then stop and add the lines to */
1188
+ /* the list. */
1189
+ if ( max_splits <= 2 )
1190
+ goto Append;
1191
+
1192
+ /* Otherwise keep splitting. */
1193
+ FT_CALL( split_sdf_cubic( memory, &cpos[0], max_splits / 2, out ) );
1194
+ FT_CALL( split_sdf_cubic( memory, &cpos[3], max_splits / 2, out ) );
1195
+
1196
+ /* [NOTE]: This is not an efficient way of */
1197
+ /* splitting the curve. Check the deviation */
1198
+ /* instead and stop if the deviation is less */
1199
+ /* than a pixel. */
1200
+
1201
+ goto Exit;
1202
+
1203
+ Append:
1204
+ /* Do allocation and add the lines to the list. */
1205
+
1206
+ FT_CALL( sdf_edge_new( memory, &left) );
1207
+ FT_CALL( sdf_edge_new( memory, &right) );
1208
+
1209
+ left->start_pos = cpos[0];
1210
+ left->end_pos = cpos[3];
1211
+ left->edge_type = SDF_EDGE_LINE;
1212
+
1213
+ right->start_pos = cpos[3];
1214
+ right->end_pos = cpos[6];
1215
+ right->edge_type = SDF_EDGE_LINE;
1216
+
1217
+ left->next = right;
1218
+ right->next = (*out);
1219
+ *out = left;
1220
+
1221
+ Exit:
1222
+ return error;
1223
+ }
1224
+
1225
+
1226
+ /* Subdivide an entire shape into line segments */
1227
+ /* such that it doesn't look visually different */
1228
+ /* from the original curve. */
1229
+ static FT_Error
1230
+ split_sdf_shape( SDF_Shape* shape )
1231
+ {
1232
+ FT_Error error = FT_Err_Ok;
1233
+ FT_Memory memory;
1234
+
1235
+ SDF_Contour* contours;
1236
+ SDF_Contour* new_contours = NULL;
1237
+
1238
+
1239
+ if ( !shape || !shape->memory )
1240
+ {
1241
+ error = FT_THROW( Invalid_Argument );
1242
+ goto Exit;
1243
+ }
1244
+
1245
+ contours = shape->contours;
1246
+ memory = shape->memory;
1247
+
1248
+ /* for each contour */
1249
+ while ( contours )
1250
+ {
1251
+ SDF_Edge* edges = contours->edges;
1252
+ SDF_Edge* new_edges = NULL;
1253
+
1254
+ SDF_Contour* tempc;
1255
+
1256
+
1257
+ /* for each edge */
1258
+ while ( edges )
1259
+ {
1260
+ SDF_Edge* edge = edges;
1261
+ SDF_Edge* temp;
1262
+
1263
+ switch ( edge->edge_type )
1264
+ {
1265
+ case SDF_EDGE_LINE:
1266
+ /* Just create a duplicate edge in case */
1267
+ /* it is a line. We can use the same edge. */
1268
+ FT_CALL( sdf_edge_new( memory, &temp ) );
1269
+
1270
+ ft_memcpy( temp, edge, sizeof ( *edge ) );
1271
+
1272
+ temp->next = new_edges;
1273
+ new_edges = temp;
1274
+ break;
1275
+
1276
+ case SDF_EDGE_CONIC:
1277
+ /* Subdivide the curve and add it to the list. */
1278
+ {
1279
+ FT_26D6_Vec ctrls[3];
1280
+ FT_26D6 dx, dy;
1281
+ FT_UInt num_splits;
1282
+
1283
+
1284
+ ctrls[0] = edge->start_pos;
1285
+ ctrls[1] = edge->control_a;
1286
+ ctrls[2] = edge->end_pos;
1287
+
1288
+ dx = FT_ABS( ctrls[2].x + ctrls[0].x - 2 * ctrls[1].x );
1289
+ dy = FT_ABS( ctrls[2].y + ctrls[0].y - 2 * ctrls[1].y );
1290
+ if ( dx < dy )
1291
+ dx = dy;
1292
+
1293
+ /* Calculate the number of necessary bisections. Each */
1294
+ /* bisection causes a four-fold reduction of the deviation, */
1295
+ /* hence we bisect the Bezier curve until the deviation */
1296
+ /* becomes less than 1/8 of a pixel. For more details */
1297
+ /* check file `ftgrays.c`. */
1298
+ num_splits = 1;
1299
+ while ( dx > ONE_PIXEL / 8 )
1300
+ {
1301
+ dx >>= 2;
1302
+ num_splits <<= 1;
1303
+ }
1304
+
1305
+ error = split_sdf_conic( memory, ctrls, num_splits, &new_edges );
1306
+ }
1307
+ break;
1308
+
1309
+ case SDF_EDGE_CUBIC:
1310
+ /* Subdivide the curve and add it to the list. */
1311
+ {
1312
+ FT_26D6_Vec ctrls[4];
1313
+
1314
+
1315
+ ctrls[0] = edge->start_pos;
1316
+ ctrls[1] = edge->control_a;
1317
+ ctrls[2] = edge->control_b;
1318
+ ctrls[3] = edge->end_pos;
1319
+
1320
+ error = split_sdf_cubic( memory, ctrls, 32, &new_edges );
1321
+ }
1322
+ break;
1323
+
1324
+ default:
1325
+ error = FT_THROW( Invalid_Argument );
1326
+ }
1327
+
1328
+ if ( error != FT_Err_Ok )
1329
+ goto Exit;
1330
+
1331
+ edges = edges->next;
1332
+ }
1333
+
1334
+ /* add to the contours list */
1335
+ FT_CALL( sdf_contour_new( memory, &tempc ) );
1336
+
1337
+ tempc->next = new_contours;
1338
+ tempc->edges = new_edges;
1339
+ new_contours = tempc;
1340
+ new_edges = NULL;
1341
+
1342
+ /* deallocate the contour */
1343
+ tempc = contours;
1344
+ contours = contours->next;
1345
+
1346
+ sdf_contour_done( memory, &tempc );
1347
+ }
1348
+
1349
+ shape->contours = new_contours;
1350
+
1351
+ Exit:
1352
+ return error;
1353
+ }
1354
+
1355
+
1356
+ /**************************************************************************
1357
+ *
1358
+ * for debugging
1359
+ *
1360
+ */
1361
+
1362
+ #ifdef FT_DEBUG_LEVEL_TRACE
1363
+
1364
+ static void
1365
+ sdf_shape_dump( SDF_Shape* shape )
1366
+ {
1367
+ FT_UInt num_contours = 0;
1368
+
1369
+ FT_UInt total_edges = 0;
1370
+ FT_UInt total_lines = 0;
1371
+ FT_UInt total_conic = 0;
1372
+ FT_UInt total_cubic = 0;
1373
+
1374
+ SDF_Contour* contour_list;
1375
+
1376
+
1377
+ if ( !shape )
1378
+ {
1379
+ FT_TRACE5(( "sdf_shape_dump: null shape\n" ));
1380
+ return;
1381
+ }
1382
+
1383
+ contour_list = shape->contours;
1384
+
1385
+ FT_TRACE5(( "sdf_shape_dump (values are in 26.6 format):\n" ));
1386
+
1387
+ while ( contour_list )
1388
+ {
1389
+ FT_UInt num_edges = 0;
1390
+ SDF_Edge* edge_list;
1391
+ SDF_Contour* contour = contour_list;
1392
+
1393
+
1394
+ FT_TRACE5(( " Contour %d\n", num_contours ));
1395
+
1396
+ edge_list = contour->edges;
1397
+
1398
+ while ( edge_list )
1399
+ {
1400
+ SDF_Edge* edge = edge_list;
1401
+
1402
+
1403
+ FT_TRACE5(( " %3d: ", num_edges ));
1404
+
1405
+ switch ( edge->edge_type )
1406
+ {
1407
+ case SDF_EDGE_LINE:
1408
+ FT_TRACE5(( "Line: (%ld, %ld) -- (%ld, %ld)\n",
1409
+ edge->start_pos.x, edge->start_pos.y,
1410
+ edge->end_pos.x, edge->end_pos.y ));
1411
+ total_lines++;
1412
+ break;
1413
+
1414
+ case SDF_EDGE_CONIC:
1415
+ FT_TRACE5(( "Conic: (%ld, %ld) .. (%ld, %ld) .. (%ld, %ld)\n",
1416
+ edge->start_pos.x, edge->start_pos.y,
1417
+ edge->control_a.x, edge->control_a.y,
1418
+ edge->end_pos.x, edge->end_pos.y ));
1419
+ total_conic++;
1420
+ break;
1421
+
1422
+ case SDF_EDGE_CUBIC:
1423
+ FT_TRACE5(( "Cubic: (%ld, %ld) .. (%ld, %ld)"
1424
+ " .. (%ld, %ld) .. (%ld %ld)\n",
1425
+ edge->start_pos.x, edge->start_pos.y,
1426
+ edge->control_a.x, edge->control_a.y,
1427
+ edge->control_b.x, edge->control_b.y,
1428
+ edge->end_pos.x, edge->end_pos.y ));
1429
+ total_cubic++;
1430
+ break;
1431
+
1432
+ default:
1433
+ break;
1434
+ }
1435
+
1436
+ num_edges++;
1437
+ total_edges++;
1438
+ edge_list = edge_list->next;
1439
+ }
1440
+
1441
+ num_contours++;
1442
+ contour_list = contour_list->next;
1443
+ }
1444
+
1445
+ FT_TRACE5(( "\n" ));
1446
+ FT_TRACE5(( " total number of contours = %d\n", num_contours ));
1447
+ FT_TRACE5(( " total number of edges = %d\n", total_edges ));
1448
+ FT_TRACE5(( " |__lines = %d\n", total_lines ));
1449
+ FT_TRACE5(( " |__conic = %d\n", total_conic ));
1450
+ FT_TRACE5(( " |__cubic = %d\n", total_cubic ));
1451
+ }
1452
+
1453
+ #endif /* FT_DEBUG_LEVEL_TRACE */
1454
+
1455
+
1456
+ /**************************************************************************
1457
+ *
1458
+ * math functions
1459
+ *
1460
+ */
1461
+
1462
+ #if !USE_NEWTON_FOR_CONIC
1463
+
1464
+ /* [NOTE]: All the functions below down until rasterizer */
1465
+ /* can be avoided if we decide to subdivide the */
1466
+ /* curve into lines. */
1467
+
1468
+ /* This function uses Newton's iteration to find */
1469
+ /* the cube root of a fixed-point integer. */
1470
+ static FT_16D16
1471
+ cube_root( FT_16D16 val )
1472
+ {
1473
+ /* [IMPORTANT]: This function is not good as it may */
1474
+ /* not break, so use a lookup table instead. Or we */
1475
+ /* can use an algorithm similar to `square_root`. */
1476
+
1477
+ FT_Int v, g, c;
1478
+
1479
+
1480
+ if ( val == 0 ||
1481
+ val == -FT_INT_16D16( 1 ) ||
1482
+ val == FT_INT_16D16( 1 ) )
1483
+ return val;
1484
+
1485
+ v = val < 0 ? -val : val;
1486
+ g = square_root( v );
1487
+ c = 0;
1488
+
1489
+ while ( 1 )
1490
+ {
1491
+ c = FT_MulFix( FT_MulFix( g, g ), g ) - v;
1492
+ c = FT_DivFix( c, 3 * FT_MulFix( g, g ) );
1493
+
1494
+ g -= c;
1495
+
1496
+ if ( ( c < 0 ? -c : c ) < 30 )
1497
+ break;
1498
+ }
1499
+
1500
+ return val < 0 ? -g : g;
1501
+ }
1502
+
1503
+
1504
+ /* Calculate the perpendicular by using '1 - base^2'. */
1505
+ /* Then use arctan to compute the angle. */
1506
+ static FT_16D16
1507
+ arc_cos( FT_16D16 val )
1508
+ {
1509
+ FT_16D16 p;
1510
+ FT_16D16 b = val;
1511
+ FT_16D16 one = FT_INT_16D16( 1 );
1512
+
1513
+
1514
+ if ( b > one )
1515
+ b = one;
1516
+ if ( b < -one )
1517
+ b = -one;
1518
+
1519
+ p = one - FT_MulFix( b, b );
1520
+ p = square_root( p );
1521
+
1522
+ return FT_Atan2( b, p );
1523
+ }
1524
+
1525
+
1526
+ /* Compute roots of a quadratic polynomial, assign them to `out`, */
1527
+ /* and return number of real roots. */
1528
+ /* */
1529
+ /* The procedure can be found at */
1530
+ /* */
1531
+ /* https://mathworld.wolfram.com/QuadraticFormula.html */
1532
+ static FT_UShort
1533
+ solve_quadratic_equation( FT_26D6 a,
1534
+ FT_26D6 b,
1535
+ FT_26D6 c,
1536
+ FT_16D16 out[2] )
1537
+ {
1538
+ FT_16D16 discriminant = 0;
1539
+
1540
+
1541
+ a = FT_26D6_16D16( a );
1542
+ b = FT_26D6_16D16( b );
1543
+ c = FT_26D6_16D16( c );
1544
+
1545
+ if ( a == 0 )
1546
+ {
1547
+ if ( b == 0 )
1548
+ return 0;
1549
+ else
1550
+ {
1551
+ out[0] = FT_DivFix( -c, b );
1552
+
1553
+ return 1;
1554
+ }
1555
+ }
1556
+
1557
+ discriminant = FT_MulFix( b, b ) - 4 * FT_MulFix( a, c );
1558
+
1559
+ if ( discriminant < 0 )
1560
+ return 0;
1561
+ else if ( discriminant == 0 )
1562
+ {
1563
+ out[0] = FT_DivFix( -b, 2 * a );
1564
+
1565
+ return 1;
1566
+ }
1567
+ else
1568
+ {
1569
+ discriminant = square_root( discriminant );
1570
+
1571
+ out[0] = FT_DivFix( -b + discriminant, 2 * a );
1572
+ out[1] = FT_DivFix( -b - discriminant, 2 * a );
1573
+
1574
+ return 2;
1575
+ }
1576
+ }
1577
+
1578
+
1579
+ /* Compute roots of a cubic polynomial, assign them to `out`, */
1580
+ /* and return number of real roots. */
1581
+ /* */
1582
+ /* The procedure can be found at */
1583
+ /* */
1584
+ /* https://mathworld.wolfram.com/CubicFormula.html */
1585
+ static FT_UShort
1586
+ solve_cubic_equation( FT_26D6 a,
1587
+ FT_26D6 b,
1588
+ FT_26D6 c,
1589
+ FT_26D6 d,
1590
+ FT_16D16 out[3] )
1591
+ {
1592
+ FT_16D16 q = 0; /* intermediate */
1593
+ FT_16D16 r = 0; /* intermediate */
1594
+
1595
+ FT_16D16 a2 = b; /* x^2 coefficients */
1596
+ FT_16D16 a1 = c; /* x coefficients */
1597
+ FT_16D16 a0 = d; /* constant */
1598
+
1599
+ FT_16D16 q3 = 0;
1600
+ FT_16D16 r2 = 0;
1601
+ FT_16D16 a23 = 0;
1602
+ FT_16D16 a22 = 0;
1603
+ FT_16D16 a1x2 = 0;
1604
+
1605
+
1606
+ /* cutoff value for `a` to be a cubic, otherwise solve quadratic */
1607
+ if ( a == 0 || FT_ABS( a ) < 16 )
1608
+ return solve_quadratic_equation( b, c, d, out );
1609
+
1610
+ if ( d == 0 )
1611
+ {
1612
+ out[0] = 0;
1613
+
1614
+ return solve_quadratic_equation( a, b, c, out + 1 ) + 1;
1615
+ }
1616
+
1617
+ /* normalize the coefficients; this also makes them 16.16 */
1618
+ a2 = FT_DivFix( a2, a );
1619
+ a1 = FT_DivFix( a1, a );
1620
+ a0 = FT_DivFix( a0, a );
1621
+
1622
+ /* compute intermediates */
1623
+ a1x2 = FT_MulFix( a1, a2 );
1624
+ a22 = FT_MulFix( a2, a2 );
1625
+ a23 = FT_MulFix( a22, a2 );
1626
+
1627
+ q = ( 3 * a1 - a22 ) / 9;
1628
+ r = ( 9 * a1x2 - 27 * a0 - 2 * a23 ) / 54;
1629
+
1630
+ /* [BUG]: `q3` and `r2` still cause underflow. */
1631
+
1632
+ q3 = FT_MulFix( q, q );
1633
+ q3 = FT_MulFix( q3, q );
1634
+
1635
+ r2 = FT_MulFix( r, r );
1636
+
1637
+ if ( q3 < 0 && r2 < -q3 )
1638
+ {
1639
+ FT_16D16 t = 0;
1640
+
1641
+
1642
+ q3 = square_root( -q3 );
1643
+ t = FT_DivFix( r, q3 );
1644
+
1645
+ if ( t > ( 1 << 16 ) )
1646
+ t = ( 1 << 16 );
1647
+ if ( t < -( 1 << 16 ) )
1648
+ t = -( 1 << 16 );
1649
+
1650
+ t = arc_cos( t );
1651
+ a2 /= 3;
1652
+ q = 2 * square_root( -q );
1653
+
1654
+ out[0] = FT_MulFix( q, FT_Cos( t / 3 ) ) - a2;
1655
+ out[1] = FT_MulFix( q, FT_Cos( ( t + FT_ANGLE_PI * 2 ) / 3 ) ) - a2;
1656
+ out[2] = FT_MulFix( q, FT_Cos( ( t + FT_ANGLE_PI * 4 ) / 3 ) ) - a2;
1657
+
1658
+ return 3;
1659
+ }
1660
+
1661
+ else if ( r2 == -q3 )
1662
+ {
1663
+ FT_16D16 s = 0;
1664
+
1665
+
1666
+ s = cube_root( r );
1667
+ a2 /= -3;
1668
+
1669
+ out[0] = a2 + ( 2 * s );
1670
+ out[1] = a2 - s;
1671
+
1672
+ return 2;
1673
+ }
1674
+
1675
+ else
1676
+ {
1677
+ FT_16D16 s = 0;
1678
+ FT_16D16 t = 0;
1679
+ FT_16D16 dis = 0;
1680
+
1681
+
1682
+ if ( q3 == 0 )
1683
+ dis = FT_ABS( r );
1684
+ else
1685
+ dis = square_root( q3 + r2 );
1686
+
1687
+ s = cube_root( r + dis );
1688
+ t = cube_root( r - dis );
1689
+ a2 /= -3;
1690
+ out[0] = ( a2 + ( s + t ) );
1691
+
1692
+ return 1;
1693
+ }
1694
+ }
1695
+
1696
+ #endif /* !USE_NEWTON_FOR_CONIC */
1697
+
1698
+
1699
+ /*************************************************************************/
1700
+ /*************************************************************************/
1701
+ /** **/
1702
+ /** RASTERIZER **/
1703
+ /** **/
1704
+ /*************************************************************************/
1705
+ /*************************************************************************/
1706
+
1707
+ /**************************************************************************
1708
+ *
1709
+ * @Function:
1710
+ * resolve_corner
1711
+ *
1712
+ * @Description:
1713
+ * At some places on the grid two edges can give opposite directions;
1714
+ * this happens when the closest point is on one of the endpoint. In
1715
+ * that case we need to check the proper sign.
1716
+ *
1717
+ * This can be visualized by an example:
1718
+ *
1719
+ * ```
1720
+ * x
1721
+ *
1722
+ * o
1723
+ * ^ \
1724
+ * / \
1725
+ * / \
1726
+ * (a) / \ (b)
1727
+ * / \
1728
+ * / \
1729
+ * / v
1730
+ * ```
1731
+ *
1732
+ * Suppose `x` is the point whose shortest distance from an arbitrary
1733
+ * contour we want to find out. It is clear that `o` is the nearest
1734
+ * point on the contour. Now to determine the sign we do a cross
1735
+ * product of the shortest distance vector and the edge direction, i.e.,
1736
+ *
1737
+ * ```
1738
+ * => sign = cross(x - o, direction(a))
1739
+ * ```
1740
+ *
1741
+ * Using the right hand thumb rule we can see that the sign will be
1742
+ * positive.
1743
+ *
1744
+ * If we use `b', however, we have
1745
+ *
1746
+ * ```
1747
+ * => sign = cross(x - o, direction(b))
1748
+ * ```
1749
+ *
1750
+ * In this case the sign will be negative. To determine the correct
1751
+ * sign we thus divide the plane in two halves and check which plane the
1752
+ * point lies in.
1753
+ *
1754
+ * ```
1755
+ * |
1756
+ * x |
1757
+ * |
1758
+ * o
1759
+ * ^|\
1760
+ * / | \
1761
+ * / | \
1762
+ * (a) / | \ (b)
1763
+ * / | \
1764
+ * / \
1765
+ * / v
1766
+ * ```
1767
+ *
1768
+ * We can see that `x` lies in the plane of `a`, so we take the sign
1769
+ * determined by `a`. This test can be easily done by calculating the
1770
+ * orthogonality and taking the greater one.
1771
+ *
1772
+ * The orthogonality is simply the sinus of the two vectors (i.e.,
1773
+ * x - o) and the corresponding direction. We efficiently pre-compute
1774
+ * the orthogonality with the corresponding `get_min_distance_*`
1775
+ * functions.
1776
+ *
1777
+ * @Input:
1778
+ * sdf1 ::
1779
+ * First signed distance (can be any of `a` or `b`).
1780
+ *
1781
+ * sdf1 ::
1782
+ * Second signed distance (can be any of `a` or `b`).
1783
+ *
1784
+ * @Return:
1785
+ * The correct signed distance, which is computed by using the above
1786
+ * algorithm.
1787
+ *
1788
+ * @Note:
1789
+ * The function does not care about the actual distance, it simply
1790
+ * returns the signed distance which has a larger cross product. As a
1791
+ * consequence, this function should not be used if the two distances
1792
+ * are fairly apart. In that case simply use the signed distance with
1793
+ * a shorter absolute distance.
1794
+ *
1795
+ */
1796
+ static SDF_Signed_Distance
1797
+ resolve_corner( SDF_Signed_Distance sdf1,
1798
+ SDF_Signed_Distance sdf2 )
1799
+ {
1800
+ return FT_ABS( sdf1.cross ) > FT_ABS( sdf2.cross ) ? sdf1 : sdf2;
1801
+ }
1802
+
1803
+
1804
+ /**************************************************************************
1805
+ *
1806
+ * @Function:
1807
+ * get_min_distance_line
1808
+ *
1809
+ * @Description:
1810
+ * Find the shortest distance from the `line` segment to a given `point`
1811
+ * and assign it to `out`. Use it for line segments only.
1812
+ *
1813
+ * @Input:
1814
+ * line ::
1815
+ * The line segment to which the shortest distance is to be computed.
1816
+ *
1817
+ * point ::
1818
+ * Point from which the shortest distance is to be computed.
1819
+ *
1820
+ * @Output:
1821
+ * out ::
1822
+ * Signed distance from `point` to `line`.
1823
+ *
1824
+ * @Return:
1825
+ * FreeType error, 0 means success.
1826
+ *
1827
+ * @Note:
1828
+ * The `line' parameter must have an edge type of `SDF_EDGE_LINE`.
1829
+ *
1830
+ */
1831
+ static FT_Error
1832
+ get_min_distance_line( SDF_Edge* line,
1833
+ FT_26D6_Vec point,
1834
+ SDF_Signed_Distance* out )
1835
+ {
1836
+ /*
1837
+ * In order to calculate the shortest distance from a point to
1838
+ * a line segment, we do the following. Let's assume that
1839
+ *
1840
+ * ```
1841
+ * a = start point of the line segment
1842
+ * b = end point of the line segment
1843
+ * p = point from which shortest distance is to be calculated
1844
+ * ```
1845
+ *
1846
+ * (1) Write the parametric equation of the line.
1847
+ *
1848
+ * ```
1849
+ * point_on_line = a + (b - a) * t (t is the factor)
1850
+ * ```
1851
+ *
1852
+ * (2) Find the projection of point `p` on the line. The projection
1853
+ * will be perpendicular to the line, which allows us to get the
1854
+ * solution by making the dot product zero.
1855
+ *
1856
+ * ```
1857
+ * (point_on_line - a) . (p - point_on_line) = 0
1858
+ *
1859
+ * (point_on_line)
1860
+ * (a) x-------o----------------x (b)
1861
+ * |_|
1862
+ * |
1863
+ * |
1864
+ * (p)
1865
+ * ```
1866
+ *
1867
+ * (3) Simplification of the above equation yields the factor of
1868
+ * `point_on_line`:
1869
+ *
1870
+ * ```
1871
+ * t = ((p - a) . (b - a)) / |b - a|^2
1872
+ * ```
1873
+ *
1874
+ * (4) We clamp factor `t` between [0.0f, 1.0f] because `point_on_line`
1875
+ * can be outside of the line segment:
1876
+ *
1877
+ * ```
1878
+ * (point_on_line)
1879
+ * (a) x------------------------x (b) -----o---
1880
+ * |_|
1881
+ * |
1882
+ * |
1883
+ * (p)
1884
+ * ```
1885
+ *
1886
+ * (5) Finally, the distance we are interested in is
1887
+ *
1888
+ * ```
1889
+ * |point_on_line - p|
1890
+ * ```
1891
+ */
1892
+
1893
+ FT_Error error = FT_Err_Ok;
1894
+
1895
+ FT_Vector a; /* start position */
1896
+ FT_Vector b; /* end position */
1897
+ FT_Vector p; /* current point */
1898
+
1899
+ FT_26D6_Vec line_segment; /* `b` - `a` */
1900
+ FT_26D6_Vec p_sub_a; /* `p` - `a` */
1901
+
1902
+ FT_26D6 sq_line_length; /* squared length of `line_segment` */
1903
+ FT_16D16 factor; /* factor of the nearest point */
1904
+ FT_26D6 cross; /* used to determine sign */
1905
+
1906
+ FT_16D16_Vec nearest_point; /* `point_on_line` */
1907
+ FT_16D16_Vec nearest_vector; /* `p` - `nearest_point` */
1908
+
1909
+
1910
+ if ( !line || !out )
1911
+ {
1912
+ error = FT_THROW( Invalid_Argument );
1913
+ goto Exit;
1914
+ }
1915
+
1916
+ if ( line->edge_type != SDF_EDGE_LINE )
1917
+ {
1918
+ error = FT_THROW( Invalid_Argument );
1919
+ goto Exit;
1920
+ }
1921
+
1922
+ a = line->start_pos;
1923
+ b = line->end_pos;
1924
+ p = point;
1925
+
1926
+ line_segment.x = b.x - a.x;
1927
+ line_segment.y = b.y - a.y;
1928
+
1929
+ p_sub_a.x = p.x - a.x;
1930
+ p_sub_a.y = p.y - a.y;
1931
+
1932
+ sq_line_length = ( line_segment.x * line_segment.x ) / 64 +
1933
+ ( line_segment.y * line_segment.y ) / 64;
1934
+
1935
+ /* currently factor is 26.6 */
1936
+ factor = ( p_sub_a.x * line_segment.x ) / 64 +
1937
+ ( p_sub_a.y * line_segment.y ) / 64;
1938
+
1939
+ /* now factor is 16.16 */
1940
+ factor = FT_DivFix( factor, sq_line_length );
1941
+
1942
+ /* clamp the factor between 0.0 and 1.0 in fixed-point */
1943
+ if ( factor > FT_INT_16D16( 1 ) )
1944
+ factor = FT_INT_16D16( 1 );
1945
+ if ( factor < 0 )
1946
+ factor = 0;
1947
+
1948
+ nearest_point.x = FT_MulFix( FT_26D6_16D16( line_segment.x ),
1949
+ factor );
1950
+ nearest_point.y = FT_MulFix( FT_26D6_16D16( line_segment.y ),
1951
+ factor );
1952
+
1953
+ nearest_point.x = FT_26D6_16D16( a.x ) + nearest_point.x;
1954
+ nearest_point.y = FT_26D6_16D16( a.y ) + nearest_point.y;
1955
+
1956
+ nearest_vector.x = nearest_point.x - FT_26D6_16D16( p.x );
1957
+ nearest_vector.y = nearest_point.y - FT_26D6_16D16( p.y );
1958
+
1959
+ cross = FT_MulFix( nearest_vector.x, line_segment.y ) -
1960
+ FT_MulFix( nearest_vector.y, line_segment.x );
1961
+
1962
+ /* assign the output */
1963
+ out->sign = cross < 0 ? 1 : -1;
1964
+ out->distance = VECTOR_LENGTH_16D16( nearest_vector );
1965
+
1966
+ /* Instead of finding `cross` for checking corner we */
1967
+ /* directly set it here. This is more efficient */
1968
+ /* because if the distance is perpendicular we can */
1969
+ /* directly set it to 1. */
1970
+ if ( factor != 0 && factor != FT_INT_16D16( 1 ) )
1971
+ out->cross = FT_INT_16D16( 1 );
1972
+ else
1973
+ {
1974
+ /* [OPTIMIZATION]: Pre-compute this direction. */
1975
+ /* If not perpendicular then compute `cross`. */
1976
+ FT_Vector_NormLen( &line_segment );
1977
+ FT_Vector_NormLen( &nearest_vector );
1978
+
1979
+ out->cross = FT_MulFix( line_segment.x, nearest_vector.y ) -
1980
+ FT_MulFix( line_segment.y, nearest_vector.x );
1981
+ }
1982
+
1983
+ Exit:
1984
+ return error;
1985
+ }
1986
+
1987
+
1988
+ /**************************************************************************
1989
+ *
1990
+ * @Function:
1991
+ * get_min_distance_conic
1992
+ *
1993
+ * @Description:
1994
+ * Find the shortest distance from the `conic` Bezier curve to a given
1995
+ * `point` and assign it to `out`. Use it for conic/quadratic curves
1996
+ * only.
1997
+ *
1998
+ * @Input:
1999
+ * conic ::
2000
+ * The conic Bezier curve to which the shortest distance is to be
2001
+ * computed.
2002
+ *
2003
+ * point ::
2004
+ * Point from which the shortest distance is to be computed.
2005
+ *
2006
+ * @Output:
2007
+ * out ::
2008
+ * Signed distance from `point` to `conic`.
2009
+ *
2010
+ * @Return:
2011
+ * FreeType error, 0 means success.
2012
+ *
2013
+ * @Note:
2014
+ * The `conic` parameter must have an edge type of `SDF_EDGE_CONIC`.
2015
+ *
2016
+ */
2017
+
2018
+ #if !USE_NEWTON_FOR_CONIC
2019
+
2020
+ /*
2021
+ * The function uses an analytical method to find the shortest distance
2022
+ * which is faster than the Newton-Raphson method, but has underflows at
2023
+ * the moment. Use Newton's method if you can see artifacts in the SDF.
2024
+ */
2025
+ static FT_Error
2026
+ get_min_distance_conic( SDF_Edge* conic,
2027
+ FT_26D6_Vec point,
2028
+ SDF_Signed_Distance* out )
2029
+ {
2030
+ /*
2031
+ * The procedure to find the shortest distance from a point to a
2032
+ * quadratic Bezier curve is similar to the line segment algorithm. The
2033
+ * shortest distance is perpendicular to the Bezier curve; the only
2034
+ * difference from line is that there can be more than one
2035
+ * perpendicular, and we also have to check the endpoints, because the
2036
+ * perpendicular may not be the shortest.
2037
+ *
2038
+ * Let's assume that
2039
+ * ```
2040
+ * p0 = first endpoint
2041
+ * p1 = control point
2042
+ * p2 = second endpoint
2043
+ * p = point from which shortest distance is to be calculated
2044
+ * ```
2045
+ *
2046
+ * (1) The equation of a quadratic Bezier curve can be written as
2047
+ *
2048
+ * ```
2049
+ * B(t) = (1 - t)^2 * p0 + 2(1 - t)t * p1 + t^2 * p2
2050
+ * ```
2051
+ *
2052
+ * with `t` a factor in the range [0.0f, 1.0f]. This equation can
2053
+ * be rewritten as
2054
+ *
2055
+ * ```
2056
+ * B(t) = t^2 * (p0 - 2p1 + p2) + 2t * (p1 - p0) + p0
2057
+ * ```
2058
+ *
2059
+ * With
2060
+ *
2061
+ * ```
2062
+ * A = p0 - 2p1 + p2
2063
+ * B = p1 - p0
2064
+ * ```
2065
+ *
2066
+ * we have
2067
+ *
2068
+ * ```
2069
+ * B(t) = t^2 * A + 2t * B + p0
2070
+ * ```
2071
+ *
2072
+ * (2) The derivative of the last equation above is
2073
+ *
2074
+ * ```
2075
+ * B'(t) = 2 *(tA + B)
2076
+ * ```
2077
+ *
2078
+ * (3) To find the shortest distance from `p` to `B(t)` we find the
2079
+ * point on the curve at which the shortest distance vector (i.e.,
2080
+ * `B(t) - p`) and the direction (i.e., `B'(t)`) make 90 degrees.
2081
+ * In other words, we make the dot product zero.
2082
+ *
2083
+ * ```
2084
+ * (B(t) - p) . (B'(t)) = 0
2085
+ * (t^2 * A + 2t * B + p0 - p) . (2 * (tA + B)) = 0
2086
+ * ```
2087
+ *
2088
+ * After simplifying we get a cubic equation
2089
+ *
2090
+ * ```
2091
+ * at^3 + bt^2 + ct + d = 0
2092
+ * ```
2093
+ *
2094
+ * with
2095
+ *
2096
+ * ```
2097
+ * a = A.A
2098
+ * b = 3A.B
2099
+ * c = 2B.B + A.p0 - A.p
2100
+ * d = p0.B - p.B
2101
+ * ```
2102
+ *
2103
+ * (4) Now the roots of the equation can be computed using 'Cardano's
2104
+ * Cubic formula'; we clamp the roots in the range [0.0f, 1.0f].
2105
+ *
2106
+ * [note]: `B` and `B(t)` are different in the above equations.
2107
+ */
2108
+
2109
+ FT_Error error = FT_Err_Ok;
2110
+
2111
+ FT_26D6_Vec aA, bB; /* A, B in the above comment */
2112
+ FT_26D6_Vec nearest_point = { 0, 0 };
2113
+ /* point on curve nearest to `point` */
2114
+ FT_26D6_Vec direction; /* direction of curve at `nearest_point` */
2115
+
2116
+ FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */
2117
+ FT_26D6_Vec p; /* `point` to which shortest distance */
2118
+
2119
+ FT_26D6 a, b, c, d; /* cubic coefficients */
2120
+
2121
+ FT_16D16 roots[3] = { 0, 0, 0 }; /* real roots of the cubic eq. */
2122
+ FT_16D16 min_factor; /* factor at `nearest_point` */
2123
+ FT_16D16 cross; /* to determine the sign */
2124
+ FT_16D16 min = FT_INT_MAX; /* shortest squared distance */
2125
+
2126
+ FT_UShort num_roots; /* number of real roots of cubic */
2127
+ FT_UShort i;
2128
+
2129
+
2130
+ if ( !conic || !out )
2131
+ {
2132
+ error = FT_THROW( Invalid_Argument );
2133
+ goto Exit;
2134
+ }
2135
+
2136
+ if ( conic->edge_type != SDF_EDGE_CONIC )
2137
+ {
2138
+ error = FT_THROW( Invalid_Argument );
2139
+ goto Exit;
2140
+ }
2141
+
2142
+ p0 = conic->start_pos;
2143
+ p1 = conic->control_a;
2144
+ p2 = conic->end_pos;
2145
+ p = point;
2146
+
2147
+ /* compute substitution coefficients */
2148
+ aA.x = p0.x - 2 * p1.x + p2.x;
2149
+ aA.y = p0.y - 2 * p1.y + p2.y;
2150
+
2151
+ bB.x = p1.x - p0.x;
2152
+ bB.y = p1.y - p0.y;
2153
+
2154
+ /* compute cubic coefficients */
2155
+ a = VEC_26D6_DOT( aA, aA );
2156
+
2157
+ b = 3 * VEC_26D6_DOT( aA, bB );
2158
+
2159
+ c = 2 * VEC_26D6_DOT( bB, bB ) +
2160
+ VEC_26D6_DOT( aA, p0 ) -
2161
+ VEC_26D6_DOT( aA, p );
2162
+
2163
+ d = VEC_26D6_DOT( p0, bB ) -
2164
+ VEC_26D6_DOT( p, bB );
2165
+
2166
+ /* find the roots */
2167
+ num_roots = solve_cubic_equation( a, b, c, d, roots );
2168
+
2169
+ if ( num_roots == 0 )
2170
+ {
2171
+ roots[0] = 0;
2172
+ roots[1] = FT_INT_16D16( 1 );
2173
+ num_roots = 2;
2174
+ }
2175
+
2176
+ /* [OPTIMIZATION]: Check the roots, clamp them and discard */
2177
+ /* duplicate roots. */
2178
+
2179
+ /* convert these values to 16.16 for further computation */
2180
+ aA.x = FT_26D6_16D16( aA.x );
2181
+ aA.y = FT_26D6_16D16( aA.y );
2182
+
2183
+ bB.x = FT_26D6_16D16( bB.x );
2184
+ bB.y = FT_26D6_16D16( bB.y );
2185
+
2186
+ p0.x = FT_26D6_16D16( p0.x );
2187
+ p0.y = FT_26D6_16D16( p0.y );
2188
+
2189
+ p.x = FT_26D6_16D16( p.x );
2190
+ p.y = FT_26D6_16D16( p.y );
2191
+
2192
+ for ( i = 0; i < num_roots; i++ )
2193
+ {
2194
+ FT_16D16 t = roots[i];
2195
+ FT_16D16 t2 = 0;
2196
+ FT_16D16 dist = 0;
2197
+
2198
+ FT_16D16_Vec curve_point;
2199
+ FT_16D16_Vec dist_vector;
2200
+
2201
+ /*
2202
+ * Ideally we should discard the roots which are outside the range
2203
+ * [0.0, 1.0] and check the endpoints of the Bezier curve, but Behdad
2204
+ * Esfahbod proved the following lemma.
2205
+ *
2206
+ * Lemma:
2207
+ *
2208
+ * (1) If the closest point on the curve [0, 1] is to the endpoint at
2209
+ * `t` = 1 and the cubic has no real roots at `t` = 1 then the
2210
+ * cubic must have a real root at some `t` > 1.
2211
+ *
2212
+ * (2) Similarly, if the closest point on the curve [0, 1] is to the
2213
+ * endpoint at `t` = 0 and the cubic has no real roots at `t` = 0
2214
+ * then the cubic must have a real root at some `t` < 0.
2215
+ *
2216
+ * Now because of this lemma we only need to clamp the roots and that
2217
+ * will take care of the endpoints.
2218
+ *
2219
+ * For more details see
2220
+ *
2221
+ * https://lists.nongnu.org/archive/html/freetype-devel/2020-06/msg00147.html
2222
+ */
2223
+
2224
+ if ( t < 0 )
2225
+ t = 0;
2226
+ if ( t > FT_INT_16D16( 1 ) )
2227
+ t = FT_INT_16D16( 1 );
2228
+
2229
+ t2 = FT_MulFix( t, t );
2230
+
2231
+ /* B(t) = t^2 * A + 2t * B + p0 - p */
2232
+ curve_point.x = FT_MulFix( aA.x, t2 ) +
2233
+ 2 * FT_MulFix( bB.x, t ) + p0.x;
2234
+ curve_point.y = FT_MulFix( aA.y, t2 ) +
2235
+ 2 * FT_MulFix( bB.y, t ) + p0.y;
2236
+
2237
+ /* `curve_point` - `p` */
2238
+ dist_vector.x = curve_point.x - p.x;
2239
+ dist_vector.y = curve_point.y - p.y;
2240
+
2241
+ dist = VECTOR_LENGTH_16D16( dist_vector );
2242
+
2243
+ if ( dist < min )
2244
+ {
2245
+ min = dist;
2246
+ nearest_point = curve_point;
2247
+ min_factor = t;
2248
+ }
2249
+ }
2250
+
2251
+ /* B'(t) = 2 * (tA + B) */
2252
+ direction.x = 2 * FT_MulFix( aA.x, min_factor ) + 2 * bB.x;
2253
+ direction.y = 2 * FT_MulFix( aA.y, min_factor ) + 2 * bB.y;
2254
+
2255
+ /* determine the sign */
2256
+ cross = FT_MulFix( nearest_point.x - p.x, direction.y ) -
2257
+ FT_MulFix( nearest_point.y - p.y, direction.x );
2258
+
2259
+ /* assign the values */
2260
+ out->distance = min;
2261
+ out->sign = cross < 0 ? 1 : -1;
2262
+
2263
+ if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
2264
+ out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
2265
+ else
2266
+ {
2267
+ /* convert to nearest vector */
2268
+ nearest_point.x -= FT_26D6_16D16( p.x );
2269
+ nearest_point.y -= FT_26D6_16D16( p.y );
2270
+
2271
+ /* compute `cross` if not perpendicular */
2272
+ FT_Vector_NormLen( &direction );
2273
+ FT_Vector_NormLen( &nearest_point );
2274
+
2275
+ out->cross = FT_MulFix( direction.x, nearest_point.y ) -
2276
+ FT_MulFix( direction.y, nearest_point.x );
2277
+ }
2278
+
2279
+ Exit:
2280
+ return error;
2281
+ }
2282
+
2283
+ #else /* USE_NEWTON_FOR_CONIC */
2284
+
2285
+ /*
2286
+ * The function uses Newton's approximation to find the shortest distance,
2287
+ * which is a bit slower than the analytical method but doesn't cause
2288
+ * underflow.
2289
+ */
2290
+ static FT_Error
2291
+ get_min_distance_conic( SDF_Edge* conic,
2292
+ FT_26D6_Vec point,
2293
+ SDF_Signed_Distance* out )
2294
+ {
2295
+ /*
2296
+ * This method uses Newton-Raphson's approximation to find the shortest
2297
+ * distance from a point to a conic curve. It does not involve solving
2298
+ * any cubic equation, that is why there is no risk of underflow.
2299
+ *
2300
+ * Let's assume that
2301
+ *
2302
+ * ```
2303
+ * p0 = first endpoint
2304
+ * p1 = control point
2305
+ * p3 = second endpoint
2306
+ * p = point from which shortest distance is to be calculated
2307
+ * ```
2308
+ *
2309
+ * (1) The equation of a quadratic Bezier curve can be written as
2310
+ *
2311
+ * ```
2312
+ * B(t) = (1 - t)^2 * p0 + 2(1 - t)t * p1 + t^2 * p2
2313
+ * ```
2314
+ *
2315
+ * with `t` the factor in the range [0.0f, 1.0f]. The above
2316
+ * equation can be rewritten as
2317
+ *
2318
+ * ```
2319
+ * B(t) = t^2 * (p0 - 2p1 + p2) + 2t * (p1 - p0) + p0
2320
+ * ```
2321
+ *
2322
+ * With
2323
+ *
2324
+ * ```
2325
+ * A = p0 - 2p1 + p2
2326
+ * B = 2 * (p1 - p0)
2327
+ * ```
2328
+ *
2329
+ * we have
2330
+ *
2331
+ * ```
2332
+ * B(t) = t^2 * A + t * B + p0
2333
+ * ```
2334
+ *
2335
+ * (2) The derivative of the above equation is
2336
+ *
2337
+ * ```
2338
+ * B'(t) = 2t * A + B
2339
+ * ```
2340
+ *
2341
+ * (3) The second derivative of the above equation is
2342
+ *
2343
+ * ```
2344
+ * B''(t) = 2A
2345
+ * ```
2346
+ *
2347
+ * (4) The equation `P(t)` of the distance from point `p` to the curve
2348
+ * can be written as
2349
+ *
2350
+ * ```
2351
+ * P(t) = t^2 * A + t^2 * B + p0 - p
2352
+ * ```
2353
+ *
2354
+ * With
2355
+ *
2356
+ * ```
2357
+ * C = p0 - p
2358
+ * ```
2359
+ *
2360
+ * we have
2361
+ *
2362
+ * ```
2363
+ * P(t) = t^2 * A + t * B + C
2364
+ * ```
2365
+ *
2366
+ * (5) Finally, the equation of the angle between `B(t)` and `P(t)` can
2367
+ * be written as
2368
+ *
2369
+ * ```
2370
+ * Q(t) = P(t) . B'(t)
2371
+ * ```
2372
+ *
2373
+ * (6) Our task is to find a value of `t` such that the above equation
2374
+ * `Q(t)` becomes zero, that is, the point-to-curve vector makes
2375
+ * 90~degrees with the curve. We solve this with the Newton-Raphson
2376
+ * method.
2377
+ *
2378
+ * (7) We first assume an arbitrary value of factor `t`, which we then
2379
+ * improve.
2380
+ *
2381
+ * ```
2382
+ * t := Q(t) / Q'(t)
2383
+ * ```
2384
+ *
2385
+ * Putting the value of `Q(t)` from the above equation gives
2386
+ *
2387
+ * ```
2388
+ * t := P(t) . B'(t) / derivative(P(t) . B'(t))
2389
+ * t := P(t) . B'(t) /
2390
+ * (P'(t) . B'(t) + P(t) . B''(t))
2391
+ * ```
2392
+ *
2393
+ * Note that `P'(t)` is the same as `B'(t)` because the constant is
2394
+ * gone due to the derivative.
2395
+ *
2396
+ * (8) Finally we get the equation to improve the factor as
2397
+ *
2398
+ * ```
2399
+ * t := P(t) . B'(t) /
2400
+ * (B'(t) . B'(t) + P(t) . B''(t))
2401
+ * ```
2402
+ *
2403
+ * [note]: `B` and `B(t)` are different in the above equations.
2404
+ */
2405
+
2406
+ FT_Error error = FT_Err_Ok;
2407
+
2408
+ FT_26D6_Vec aA, bB, cC; /* A, B, C in the above comment */
2409
+ FT_26D6_Vec nearest_point = { 0, 0 };
2410
+ /* point on curve nearest to `point` */
2411
+ FT_26D6_Vec direction; /* direction of curve at `nearest_point` */
2412
+
2413
+ FT_26D6_Vec p0, p1, p2; /* control points of a conic curve */
2414
+ FT_26D6_Vec p; /* `point` to which shortest distance */
2415
+
2416
+ FT_16D16 min_factor = 0; /* factor at `nearest_point' */
2417
+ FT_16D16 cross; /* to determine the sign */
2418
+ FT_16D16 min = FT_INT_MAX; /* shortest squared distance */
2419
+
2420
+ FT_UShort iterations;
2421
+ FT_UShort steps;
2422
+
2423
+
2424
+ if ( !conic || !out )
2425
+ {
2426
+ error = FT_THROW( Invalid_Argument );
2427
+ goto Exit;
2428
+ }
2429
+
2430
+ if ( conic->edge_type != SDF_EDGE_CONIC )
2431
+ {
2432
+ error = FT_THROW( Invalid_Argument );
2433
+ goto Exit;
2434
+ }
2435
+
2436
+ p0 = conic->start_pos;
2437
+ p1 = conic->control_a;
2438
+ p2 = conic->end_pos;
2439
+ p = point;
2440
+
2441
+ /* compute substitution coefficients */
2442
+ aA.x = p0.x - 2 * p1.x + p2.x;
2443
+ aA.y = p0.y - 2 * p1.y + p2.y;
2444
+
2445
+ bB.x = 2 * ( p1.x - p0.x );
2446
+ bB.y = 2 * ( p1.y - p0.y );
2447
+
2448
+ cC.x = p0.x;
2449
+ cC.y = p0.y;
2450
+
2451
+ /* do Newton's iterations */
2452
+ for ( iterations = 0; iterations <= MAX_NEWTON_DIVISIONS; iterations++ )
2453
+ {
2454
+ FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_DIVISIONS;
2455
+ FT_16D16 factor2;
2456
+ FT_16D16 length;
2457
+
2458
+ FT_16D16_Vec curve_point; /* point on the curve */
2459
+ FT_16D16_Vec dist_vector; /* `curve_point` - `p` */
2460
+
2461
+ FT_26D6_Vec d1; /* first derivative */
2462
+ FT_26D6_Vec d2; /* second derivative */
2463
+
2464
+ FT_16D16 temp1;
2465
+ FT_16D16 temp2;
2466
+
2467
+
2468
+ for ( steps = 0; steps < MAX_NEWTON_STEPS; steps++ )
2469
+ {
2470
+ factor2 = FT_MulFix( factor, factor );
2471
+
2472
+ /* B(t) = t^2 * A + t * B + p0 */
2473
+ curve_point.x = FT_MulFix( aA.x, factor2 ) +
2474
+ FT_MulFix( bB.x, factor ) + cC.x;
2475
+ curve_point.y = FT_MulFix( aA.y, factor2 ) +
2476
+ FT_MulFix( bB.y, factor ) + cC.y;
2477
+
2478
+ /* convert to 16.16 */
2479
+ curve_point.x = FT_26D6_16D16( curve_point.x );
2480
+ curve_point.y = FT_26D6_16D16( curve_point.y );
2481
+
2482
+ /* P(t) in the comment */
2483
+ dist_vector.x = curve_point.x - FT_26D6_16D16( p.x );
2484
+ dist_vector.y = curve_point.y - FT_26D6_16D16( p.y );
2485
+
2486
+ length = VECTOR_LENGTH_16D16( dist_vector );
2487
+
2488
+ if ( length < min )
2489
+ {
2490
+ min = length;
2491
+ min_factor = factor;
2492
+ nearest_point = curve_point;
2493
+ }
2494
+
2495
+ /* This is Newton's approximation. */
2496
+ /* */
2497
+ /* t := P(t) . B'(t) / */
2498
+ /* (B'(t) . B'(t) + P(t) . B''(t)) */
2499
+
2500
+ /* B'(t) = 2tA + B */
2501
+ d1.x = FT_MulFix( aA.x, 2 * factor ) + bB.x;
2502
+ d1.y = FT_MulFix( aA.y, 2 * factor ) + bB.y;
2503
+
2504
+ /* B''(t) = 2A */
2505
+ d2.x = 2 * aA.x;
2506
+ d2.y = 2 * aA.y;
2507
+
2508
+ dist_vector.x /= 1024;
2509
+ dist_vector.y /= 1024;
2510
+
2511
+ /* temp1 = P(t) . B'(t) */
2512
+ temp1 = VEC_26D6_DOT( dist_vector, d1 );
2513
+
2514
+ /* temp2 = B'(t) . B'(t) + P(t) . B''(t) */
2515
+ temp2 = VEC_26D6_DOT( d1, d1 ) +
2516
+ VEC_26D6_DOT( dist_vector, d2 );
2517
+
2518
+ factor -= FT_DivFix( temp1, temp2 );
2519
+
2520
+ if ( factor < 0 || factor > FT_INT_16D16( 1 ) )
2521
+ break;
2522
+ }
2523
+ }
2524
+
2525
+ /* B'(t) = 2t * A + B */
2526
+ direction.x = 2 * FT_MulFix( aA.x, min_factor ) + bB.x;
2527
+ direction.y = 2 * FT_MulFix( aA.y, min_factor ) + bB.y;
2528
+
2529
+ /* determine the sign */
2530
+ cross = FT_MulFix( nearest_point.x - FT_26D6_16D16( p.x ),
2531
+ direction.y ) -
2532
+ FT_MulFix( nearest_point.y - FT_26D6_16D16( p.y ),
2533
+ direction.x );
2534
+
2535
+ /* assign the values */
2536
+ out->distance = min;
2537
+ out->sign = cross < 0 ? 1 : -1;
2538
+
2539
+ if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
2540
+ out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
2541
+ else
2542
+ {
2543
+ /* convert to nearest vector */
2544
+ nearest_point.x -= FT_26D6_16D16( p.x );
2545
+ nearest_point.y -= FT_26D6_16D16( p.y );
2546
+
2547
+ /* compute `cross` if not perpendicular */
2548
+ FT_Vector_NormLen( &direction );
2549
+ FT_Vector_NormLen( &nearest_point );
2550
+
2551
+ out->cross = FT_MulFix( direction.x, nearest_point.y ) -
2552
+ FT_MulFix( direction.y, nearest_point.x );
2553
+ }
2554
+
2555
+ Exit:
2556
+ return error;
2557
+ }
2558
+
2559
+
2560
+ #endif /* USE_NEWTON_FOR_CONIC */
2561
+
2562
+
2563
+ /**************************************************************************
2564
+ *
2565
+ * @Function:
2566
+ * get_min_distance_cubic
2567
+ *
2568
+ * @Description:
2569
+ * Find the shortest distance from the `cubic` Bezier curve to a given
2570
+ * `point` and assigns it to `out`. Use it for cubic curves only.
2571
+ *
2572
+ * @Input:
2573
+ * cubic ::
2574
+ * The cubic Bezier curve to which the shortest distance is to be
2575
+ * computed.
2576
+ *
2577
+ * point ::
2578
+ * Point from which the shortest distance is to be computed.
2579
+ *
2580
+ * @Output:
2581
+ * out ::
2582
+ * Signed distance from `point` to `cubic`.
2583
+ *
2584
+ * @Return:
2585
+ * FreeType error, 0 means success.
2586
+ *
2587
+ * @Note:
2588
+ * The function uses Newton's approximation to find the shortest
2589
+ * distance. Another way would be to divide the cubic into conic or
2590
+ * subdivide the curve into lines, but that is not implemented.
2591
+ *
2592
+ * The `cubic` parameter must have an edge type of `SDF_EDGE_CUBIC`.
2593
+ *
2594
+ */
2595
+ static FT_Error
2596
+ get_min_distance_cubic( SDF_Edge* cubic,
2597
+ FT_26D6_Vec point,
2598
+ SDF_Signed_Distance* out )
2599
+ {
2600
+ /*
2601
+ * The procedure to find the shortest distance from a point to a cubic
2602
+ * Bezier curve is similar to quadratic curve algorithm. The only
2603
+ * difference is that while calculating factor `t`, instead of a cubic
2604
+ * polynomial equation we have to find the roots of a 5th degree
2605
+ * polynomial equation. Solving this would require a significant amount
2606
+ * of time, and still the results may not be accurate. We are thus
2607
+ * going to directly approximate the value of `t` using the Newton-Raphson
2608
+ * method.
2609
+ *
2610
+ * Let's assume that
2611
+ *
2612
+ * ```
2613
+ * p0 = first endpoint
2614
+ * p1 = first control point
2615
+ * p2 = second control point
2616
+ * p3 = second endpoint
2617
+ * p = point from which shortest distance is to be calculated
2618
+ * ```
2619
+ *
2620
+ * (1) The equation of a cubic Bezier curve can be written as
2621
+ *
2622
+ * ```
2623
+ * B(t) = (1 - t)^3 * p0 + 3(1 - t)^2 t * p1 +
2624
+ * 3(1 - t)t^2 * p2 + t^3 * p3
2625
+ * ```
2626
+ *
2627
+ * The equation can be expanded and written as
2628
+ *
2629
+ * ```
2630
+ * B(t) = t^3 * (-p0 + 3p1 - 3p2 + p3) +
2631
+ * 3t^2 * (p0 - 2p1 + p2) + 3t * (-p0 + p1) + p0
2632
+ * ```
2633
+ *
2634
+ * With
2635
+ *
2636
+ * ```
2637
+ * A = -p0 + 3p1 - 3p2 + p3
2638
+ * B = 3(p0 - 2p1 + p2)
2639
+ * C = 3(-p0 + p1)
2640
+ * ```
2641
+ *
2642
+ * we have
2643
+ *
2644
+ * ```
2645
+ * B(t) = t^3 * A + t^2 * B + t * C + p0
2646
+ * ```
2647
+ *
2648
+ * (2) The derivative of the above equation is
2649
+ *
2650
+ * ```
2651
+ * B'(t) = 3t^2 * A + 2t * B + C
2652
+ * ```
2653
+ *
2654
+ * (3) The second derivative of the above equation is
2655
+ *
2656
+ * ```
2657
+ * B''(t) = 6t * A + 2B
2658
+ * ```
2659
+ *
2660
+ * (4) The equation `P(t)` of the distance from point `p` to the curve
2661
+ * can be written as
2662
+ *
2663
+ * ```
2664
+ * P(t) = t^3 * A + t^2 * B + t * C + p0 - p
2665
+ * ```
2666
+ *
2667
+ * With
2668
+ *
2669
+ * ```
2670
+ * D = p0 - p
2671
+ * ```
2672
+ *
2673
+ * we have
2674
+ *
2675
+ * ```
2676
+ * P(t) = t^3 * A + t^2 * B + t * C + D
2677
+ * ```
2678
+ *
2679
+ * (5) Finally the equation of the angle between `B(t)` and `P(t)` can
2680
+ * be written as
2681
+ *
2682
+ * ```
2683
+ * Q(t) = P(t) . B'(t)
2684
+ * ```
2685
+ *
2686
+ * (6) Our task is to find a value of `t` such that the above equation
2687
+ * `Q(t)` becomes zero, that is, the point-to-curve vector makes
2688
+ * 90~degree with curve. We solve this with the Newton-Raphson
2689
+ * method.
2690
+ *
2691
+ * (7) We first assume an arbitrary value of factor `t`, which we then
2692
+ * improve.
2693
+ *
2694
+ * ```
2695
+ * t := Q(t) / Q'(t)
2696
+ * ```
2697
+ *
2698
+ * Putting the value of `Q(t)` from the above equation gives
2699
+ *
2700
+ * ```
2701
+ * t := P(t) . B'(t) / derivative(P(t) . B'(t))
2702
+ * t := P(t) . B'(t) /
2703
+ * (P'(t) . B'(t) + P(t) . B''(t))
2704
+ * ```
2705
+ *
2706
+ * Note that `P'(t)` is the same as `B'(t)` because the constant is
2707
+ * gone due to the derivative.
2708
+ *
2709
+ * (8) Finally we get the equation to improve the factor as
2710
+ *
2711
+ * ```
2712
+ * t := P(t) . B'(t) /
2713
+ * (B'(t) . B'( t ) + P(t) . B''(t))
2714
+ * ```
2715
+ *
2716
+ * [note]: `B` and `B(t)` are different in the above equations.
2717
+ */
2718
+
2719
+ FT_Error error = FT_Err_Ok;
2720
+
2721
+ FT_26D6_Vec aA, bB, cC, dD; /* A, B, C, D in the above comment */
2722
+ FT_16D16_Vec nearest_point = { 0, 0 };
2723
+ /* point on curve nearest to `point` */
2724
+ FT_16D16_Vec direction; /* direction of curve at `nearest_point` */
2725
+
2726
+ FT_26D6_Vec p0, p1, p2, p3; /* control points of a cubic curve */
2727
+ FT_26D6_Vec p; /* `point` to which shortest distance */
2728
+
2729
+ FT_16D16 min_factor = 0; /* factor at shortest distance */
2730
+ FT_16D16 min_factor_sq = 0; /* factor at shortest distance */
2731
+ FT_16D16 cross; /* to determine the sign */
2732
+ FT_16D16 min = FT_INT_MAX; /* shortest distance */
2733
+
2734
+ FT_UShort iterations;
2735
+ FT_UShort steps;
2736
+
2737
+
2738
+ if ( !cubic || !out )
2739
+ {
2740
+ error = FT_THROW( Invalid_Argument );
2741
+ goto Exit;
2742
+ }
2743
+
2744
+ if ( cubic->edge_type != SDF_EDGE_CUBIC )
2745
+ {
2746
+ error = FT_THROW( Invalid_Argument );
2747
+ goto Exit;
2748
+ }
2749
+
2750
+ p0 = cubic->start_pos;
2751
+ p1 = cubic->control_a;
2752
+ p2 = cubic->control_b;
2753
+ p3 = cubic->end_pos;
2754
+ p = point;
2755
+
2756
+ /* compute substitution coefficients */
2757
+ aA.x = -p0.x + 3 * ( p1.x - p2.x ) + p3.x;
2758
+ aA.y = -p0.y + 3 * ( p1.y - p2.y ) + p3.y;
2759
+
2760
+ bB.x = 3 * ( p0.x - 2 * p1.x + p2.x );
2761
+ bB.y = 3 * ( p0.y - 2 * p1.y + p2.y );
2762
+
2763
+ cC.x = 3 * ( p1.x - p0.x );
2764
+ cC.y = 3 * ( p1.y - p0.y );
2765
+
2766
+ dD.x = p0.x;
2767
+ dD.y = p0.y;
2768
+
2769
+ for ( iterations = 0; iterations <= MAX_NEWTON_DIVISIONS; iterations++ )
2770
+ {
2771
+ FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_DIVISIONS;
2772
+
2773
+ FT_16D16 factor2; /* factor^2 */
2774
+ FT_16D16 factor3; /* factor^3 */
2775
+ FT_16D16 length;
2776
+
2777
+ FT_16D16_Vec curve_point; /* point on the curve */
2778
+ FT_16D16_Vec dist_vector; /* `curve_point' - `p' */
2779
+
2780
+ FT_26D6_Vec d1; /* first derivative */
2781
+ FT_26D6_Vec d2; /* second derivative */
2782
+
2783
+ FT_16D16 temp1;
2784
+ FT_16D16 temp2;
2785
+
2786
+
2787
+ for ( steps = 0; steps < MAX_NEWTON_STEPS; steps++ )
2788
+ {
2789
+ factor2 = FT_MulFix( factor, factor );
2790
+ factor3 = FT_MulFix( factor2, factor );
2791
+
2792
+ /* B(t) = t^3 * A + t^2 * B + t * C + D */
2793
+ curve_point.x = FT_MulFix( aA.x, factor3 ) +
2794
+ FT_MulFix( bB.x, factor2 ) +
2795
+ FT_MulFix( cC.x, factor ) + dD.x;
2796
+ curve_point.y = FT_MulFix( aA.y, factor3 ) +
2797
+ FT_MulFix( bB.y, factor2 ) +
2798
+ FT_MulFix( cC.y, factor ) + dD.y;
2799
+
2800
+ /* convert to 16.16 */
2801
+ curve_point.x = FT_26D6_16D16( curve_point.x );
2802
+ curve_point.y = FT_26D6_16D16( curve_point.y );
2803
+
2804
+ /* P(t) in the comment */
2805
+ dist_vector.x = curve_point.x - FT_26D6_16D16( p.x );
2806
+ dist_vector.y = curve_point.y - FT_26D6_16D16( p.y );
2807
+
2808
+ length = VECTOR_LENGTH_16D16( dist_vector );
2809
+
2810
+ if ( length < min )
2811
+ {
2812
+ min = length;
2813
+ min_factor = factor;
2814
+ min_factor_sq = factor2;
2815
+ nearest_point = curve_point;
2816
+ }
2817
+
2818
+ /* This the Newton's approximation. */
2819
+ /* */
2820
+ /* t := P(t) . B'(t) / */
2821
+ /* (B'(t) . B'(t) + P(t) . B''(t)) */
2822
+
2823
+ /* B'(t) = 3t^2 * A + 2t * B + C */
2824
+ d1.x = FT_MulFix( aA.x, 3 * factor2 ) +
2825
+ FT_MulFix( bB.x, 2 * factor ) + cC.x;
2826
+ d1.y = FT_MulFix( aA.y, 3 * factor2 ) +
2827
+ FT_MulFix( bB.y, 2 * factor ) + cC.y;
2828
+
2829
+ /* B''(t) = 6t * A + 2B */
2830
+ d2.x = FT_MulFix( aA.x, 6 * factor ) + 2 * bB.x;
2831
+ d2.y = FT_MulFix( aA.y, 6 * factor ) + 2 * bB.y;
2832
+
2833
+ dist_vector.x /= 1024;
2834
+ dist_vector.y /= 1024;
2835
+
2836
+ /* temp1 = P(t) . B'(t) */
2837
+ temp1 = VEC_26D6_DOT( dist_vector, d1 );
2838
+
2839
+ /* temp2 = B'(t) . B'(t) + P(t) . B''(t) */
2840
+ temp2 = VEC_26D6_DOT( d1, d1 ) +
2841
+ VEC_26D6_DOT( dist_vector, d2 );
2842
+
2843
+ factor -= FT_DivFix( temp1, temp2 );
2844
+
2845
+ if ( factor < 0 || factor > FT_INT_16D16( 1 ) )
2846
+ break;
2847
+ }
2848
+ }
2849
+
2850
+ /* B'(t) = 3t^2 * A + 2t * B + C */
2851
+ direction.x = FT_MulFix( aA.x, 3 * min_factor_sq ) +
2852
+ FT_MulFix( bB.x, 2 * min_factor ) + cC.x;
2853
+ direction.y = FT_MulFix( aA.y, 3 * min_factor_sq ) +
2854
+ FT_MulFix( bB.y, 2 * min_factor ) + cC.y;
2855
+
2856
+ /* determine the sign */
2857
+ cross = FT_MulFix( nearest_point.x - FT_26D6_16D16( p.x ),
2858
+ direction.y ) -
2859
+ FT_MulFix( nearest_point.y - FT_26D6_16D16( p.y ),
2860
+ direction.x );
2861
+
2862
+ /* assign the values */
2863
+ out->distance = min;
2864
+ out->sign = cross < 0 ? 1 : -1;
2865
+
2866
+ if ( min_factor != 0 && min_factor != FT_INT_16D16( 1 ) )
2867
+ out->cross = FT_INT_16D16( 1 ); /* the two are perpendicular */
2868
+ else
2869
+ {
2870
+ /* convert to nearest vector */
2871
+ nearest_point.x -= FT_26D6_16D16( p.x );
2872
+ nearest_point.y -= FT_26D6_16D16( p.y );
2873
+
2874
+ /* compute `cross` if not perpendicular */
2875
+ FT_Vector_NormLen( &direction );
2876
+ FT_Vector_NormLen( &nearest_point );
2877
+
2878
+ out->cross = FT_MulFix( direction.x, nearest_point.y ) -
2879
+ FT_MulFix( direction.y, nearest_point.x );
2880
+ }
2881
+
2882
+ Exit:
2883
+ return error;
2884
+ }
2885
+
2886
+
2887
+ /**************************************************************************
2888
+ *
2889
+ * @Function:
2890
+ * sdf_edge_get_min_distance
2891
+ *
2892
+ * @Description:
2893
+ * Find shortest distance from `point` to any type of `edge`. It checks
2894
+ * the edge type and then calls the relevant `get_min_distance_*`
2895
+ * function.
2896
+ *
2897
+ * @Input:
2898
+ * edge ::
2899
+ * An edge to which the shortest distance is to be computed.
2900
+ *
2901
+ * point ::
2902
+ * Point from which the shortest distance is to be computed.
2903
+ *
2904
+ * @Output:
2905
+ * out ::
2906
+ * Signed distance from `point` to `edge`.
2907
+ *
2908
+ * @Return:
2909
+ * FreeType error, 0 means success.
2910
+ *
2911
+ */
2912
+ static FT_Error
2913
+ sdf_edge_get_min_distance( SDF_Edge* edge,
2914
+ FT_26D6_Vec point,
2915
+ SDF_Signed_Distance* out )
2916
+ {
2917
+ FT_Error error = FT_Err_Ok;
2918
+
2919
+
2920
+ if ( !edge || !out )
2921
+ {
2922
+ error = FT_THROW( Invalid_Argument );
2923
+ goto Exit;
2924
+ }
2925
+
2926
+ /* edge-specific distance calculation */
2927
+ switch ( edge->edge_type )
2928
+ {
2929
+ case SDF_EDGE_LINE:
2930
+ get_min_distance_line( edge, point, out );
2931
+ break;
2932
+
2933
+ case SDF_EDGE_CONIC:
2934
+ get_min_distance_conic( edge, point, out );
2935
+ break;
2936
+
2937
+ case SDF_EDGE_CUBIC:
2938
+ get_min_distance_cubic( edge, point, out );
2939
+ break;
2940
+
2941
+ default:
2942
+ error = FT_THROW( Invalid_Argument );
2943
+ }
2944
+
2945
+ Exit:
2946
+ return error;
2947
+ }
2948
+
2949
+
2950
+ /* `sdf_generate' is not used at the moment */
2951
+ #if 0
2952
+
2953
+ #error "DO NOT USE THIS!"
2954
+ #error "The function still outputs 16-bit data, which might cause memory"
2955
+ #error "corruption. If required I will add this later."
2956
+
2957
+ /**************************************************************************
2958
+ *
2959
+ * @Function:
2960
+ * sdf_contour_get_min_distance
2961
+ *
2962
+ * @Description:
2963
+ * Iterate over all edges that make up the contour, find the shortest
2964
+ * distance from a point to this contour, and assigns result to `out`.
2965
+ *
2966
+ * @Input:
2967
+ * contour ::
2968
+ * A contour to which the shortest distance is to be computed.
2969
+ *
2970
+ * point ::
2971
+ * Point from which the shortest distance is to be computed.
2972
+ *
2973
+ * @Output:
2974
+ * out ::
2975
+ * Signed distance from the `point' to the `contour'.
2976
+ *
2977
+ * @Return:
2978
+ * FreeType error, 0 means success.
2979
+ *
2980
+ * @Note:
2981
+ * The function does not return a signed distance for each edge which
2982
+ * makes up the contour, it simply returns the shortest of all the
2983
+ * edges.
2984
+ *
2985
+ */
2986
+ static FT_Error
2987
+ sdf_contour_get_min_distance( SDF_Contour* contour,
2988
+ FT_26D6_Vec point,
2989
+ SDF_Signed_Distance* out )
2990
+ {
2991
+ FT_Error error = FT_Err_Ok;
2992
+ SDF_Signed_Distance min_dist = max_sdf;
2993
+ SDF_Edge* edge_list;
2994
+
2995
+
2996
+ if ( !contour || !out )
2997
+ {
2998
+ error = FT_THROW( Invalid_Argument );
2999
+ goto Exit;
3000
+ }
3001
+
3002
+ edge_list = contour->edges;
3003
+
3004
+ /* iterate over all the edges manually */
3005
+ while ( edge_list )
3006
+ {
3007
+ SDF_Signed_Distance current_dist = max_sdf;
3008
+ FT_16D16 diff;
3009
+
3010
+
3011
+ FT_CALL( sdf_edge_get_min_distance( edge_list,
3012
+ point,
3013
+ &current_dist ) );
3014
+
3015
+ if ( current_dist.distance >= 0 )
3016
+ {
3017
+ diff = current_dist.distance - min_dist.distance;
3018
+
3019
+
3020
+ if ( FT_ABS( diff ) < CORNER_CHECK_EPSILON )
3021
+ min_dist = resolve_corner( min_dist, current_dist );
3022
+ else if ( diff < 0 )
3023
+ min_dist = current_dist;
3024
+ }
3025
+ else
3026
+ FT_TRACE0(( "sdf_contour_get_min_distance: Overflow.\n" ));
3027
+
3028
+ edge_list = edge_list->next;
3029
+ }
3030
+
3031
+ *out = min_dist;
3032
+
3033
+ Exit:
3034
+ return error;
3035
+ }
3036
+
3037
+
3038
+ /**************************************************************************
3039
+ *
3040
+ * @Function:
3041
+ * sdf_generate
3042
+ *
3043
+ * @Description:
3044
+ * This is the main function that is responsible for generating signed
3045
+ * distance fields. The function does not align or compute the size of
3046
+ * `bitmap`; therefore the calling application must set up `bitmap`
3047
+ * properly and transform the `shape' appropriately in advance.
3048
+ *
3049
+ * Currently we check all pixels against all contours and all edges.
3050
+ *
3051
+ * @Input:
3052
+ * internal_params ::
3053
+ * Internal parameters and properties required by the rasterizer. See
3054
+ * @SDF_Params for more.
3055
+ *
3056
+ * shape ::
3057
+ * A complete shape which is used to generate SDF.
3058
+ *
3059
+ * spread ::
3060
+ * Maximum distances to be allowed in the output bitmap.
3061
+ *
3062
+ * @Output:
3063
+ * bitmap ::
3064
+ * The output bitmap which will contain the SDF information.
3065
+ *
3066
+ * @Return:
3067
+ * FreeType error, 0 means success.
3068
+ *
3069
+ */
3070
+ static FT_Error
3071
+ sdf_generate( const SDF_Params internal_params,
3072
+ const SDF_Shape* shape,
3073
+ FT_UInt spread,
3074
+ const FT_Bitmap* bitmap )
3075
+ {
3076
+ FT_Error error = FT_Err_Ok;
3077
+
3078
+ FT_UInt width = 0;
3079
+ FT_UInt rows = 0;
3080
+ FT_UInt x = 0; /* used to loop in x direction, i.e., width */
3081
+ FT_UInt y = 0; /* used to loop in y direction, i.e., rows */
3082
+ FT_UInt sp_sq = 0; /* `spread` [* `spread`] as a 16.16 fixed value */
3083
+
3084
+ FT_Short* buffer;
3085
+
3086
+
3087
+ if ( !shape || !bitmap )
3088
+ {
3089
+ error = FT_THROW( Invalid_Argument );
3090
+ goto Exit;
3091
+ }
3092
+
3093
+ if ( spread < MIN_SPREAD || spread > MAX_SPREAD )
3094
+ {
3095
+ error = FT_THROW( Invalid_Argument );
3096
+ goto Exit;
3097
+ }
3098
+
3099
+ width = bitmap->width;
3100
+ rows = bitmap->rows;
3101
+ buffer = (FT_Short*)bitmap->buffer;
3102
+
3103
+ if ( USE_SQUARED_DISTANCES )
3104
+ sp_sq = FT_INT_16D16( spread * spread );
3105
+ else
3106
+ sp_sq = FT_INT_16D16( spread );
3107
+
3108
+ if ( width == 0 || rows == 0 )
3109
+ {
3110
+ FT_TRACE0(( "sdf_generate:"
3111
+ " Cannot render glyph with width/height == 0\n" ));
3112
+ FT_TRACE0(( " "
3113
+ " (width, height provided [%d, %d])\n",
3114
+ width, rows ));
3115
+
3116
+ error = FT_THROW( Cannot_Render_Glyph );
3117
+ goto Exit;
3118
+ }
3119
+
3120
+ /* loop over all rows */
3121
+ for ( y = 0; y < rows; y++ )
3122
+ {
3123
+ /* loop over all pixels of a row */
3124
+ for ( x = 0; x < width; x++ )
3125
+ {
3126
+ /* `grid_point` is the current pixel position; */
3127
+ /* our task is to find the shortest distance */
3128
+ /* from this point to the entire shape. */
3129
+ FT_26D6_Vec grid_point = zero_vector;
3130
+ SDF_Signed_Distance min_dist = max_sdf;
3131
+ SDF_Contour* contour_list;
3132
+
3133
+ FT_UInt index;
3134
+ FT_Short value;
3135
+
3136
+
3137
+ grid_point.x = FT_INT_26D6( x );
3138
+ grid_point.y = FT_INT_26D6( y );
3139
+
3140
+ /* This `grid_point' is at the corner, but we */
3141
+ /* use the center of the pixel. */
3142
+ grid_point.x += FT_INT_26D6( 1 ) / 2;
3143
+ grid_point.y += FT_INT_26D6( 1 ) / 2;
3144
+
3145
+ contour_list = shape->contours;
3146
+
3147
+ /* iterate over all contours manually */
3148
+ while ( contour_list )
3149
+ {
3150
+ SDF_Signed_Distance current_dist = max_sdf;
3151
+
3152
+
3153
+ FT_CALL( sdf_contour_get_min_distance( contour_list,
3154
+ grid_point,
3155
+ &current_dist ) );
3156
+
3157
+ if ( current_dist.distance < min_dist.distance )
3158
+ min_dist = current_dist;
3159
+
3160
+ contour_list = contour_list->next;
3161
+ }
3162
+
3163
+ /* [OPTIMIZATION]: if (min_dist > sp_sq) then simply clamp */
3164
+ /* the value to spread to avoid square_root */
3165
+
3166
+ /* clamp the values to spread */
3167
+ if ( min_dist.distance > sp_sq )
3168
+ min_dist.distance = sp_sq;
3169
+
3170
+ /* square_root the values and fit in a 6.10 fixed-point */
3171
+ if ( USE_SQUARED_DISTANCES )
3172
+ min_dist.distance = square_root( min_dist.distance );
3173
+
3174
+ if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
3175
+ min_dist.sign = -min_dist.sign;
3176
+ if ( internal_params.flip_sign )
3177
+ min_dist.sign = -min_dist.sign;
3178
+
3179
+ min_dist.distance /= 64; /* convert from 16.16 to 22.10 */
3180
+
3181
+ value = min_dist.distance & 0x0000FFFF; /* truncate to 6.10 */
3182
+ value *= min_dist.sign;
3183
+
3184
+ if ( internal_params.flip_y )
3185
+ index = y * width + x;
3186
+ else
3187
+ index = ( rows - y - 1 ) * width + x;
3188
+
3189
+ buffer[index] = value;
3190
+ }
3191
+ }
3192
+
3193
+ Exit:
3194
+ return error;
3195
+ }
3196
+
3197
+ #endif /* 0 */
3198
+
3199
+
3200
+ /**************************************************************************
3201
+ *
3202
+ * @Function:
3203
+ * sdf_generate_bounding_box
3204
+ *
3205
+ * @Description:
3206
+ * This function does basically the same thing as `sdf_generate` above
3207
+ * but more efficiently.
3208
+ *
3209
+ * Instead of checking all pixels against all edges, we loop over all
3210
+ * edges and only check pixels around the control box of the edge; the
3211
+ * control box is increased by the spread in all directions. Anything
3212
+ * outside of the control box that exceeds `spread` doesn't need to be
3213
+ * computed.
3214
+ *
3215
+ * Lastly, to determine the sign of unchecked pixels, we do a single
3216
+ * pass of all rows starting with a '+' sign and flipping when we come
3217
+ * across a '-' sign and continue. This also eliminates the possibility
3218
+ * of overflow because we only check the proximity of the curve.
3219
+ * Therefore we can use squared distanced safely.
3220
+ *
3221
+ * @Input:
3222
+ * internal_params ::
3223
+ * Internal parameters and properties required by the rasterizer.
3224
+ * See @SDF_Params for more.
3225
+ *
3226
+ * shape ::
3227
+ * A complete shape which is used to generate SDF.
3228
+ *
3229
+ * spread ::
3230
+ * Maximum distances to be allowed in the output bitmap.
3231
+ *
3232
+ * @Output:
3233
+ * bitmap ::
3234
+ * The output bitmap which will contain the SDF information.
3235
+ *
3236
+ * @Return:
3237
+ * FreeType error, 0 means success.
3238
+ *
3239
+ */
3240
+ static FT_Error
3241
+ sdf_generate_bounding_box( const SDF_Params internal_params,
3242
+ const SDF_Shape* shape,
3243
+ FT_UInt spread,
3244
+ const FT_Bitmap* bitmap )
3245
+ {
3246
+ FT_Error error = FT_Err_Ok;
3247
+ FT_Memory memory = NULL;
3248
+
3249
+ FT_Int width, rows, i, j;
3250
+ FT_Int sp_sq; /* max value to check */
3251
+
3252
+ SDF_Contour* contours; /* list of all contours */
3253
+ FT_SDFFormat* buffer; /* the bitmap buffer */
3254
+
3255
+ /* This buffer has the same size in indices as the */
3256
+ /* bitmap buffer. When we check a pixel position for */
3257
+ /* a shortest distance we keep it in this buffer. */
3258
+ /* This way we can find out which pixel is set, */
3259
+ /* and also determine the signs properly. */
3260
+ SDF_Signed_Distance* dists = NULL;
3261
+
3262
+ const FT_16D16 fixed_spread = (FT_16D16)FT_INT_16D16( spread );
3263
+
3264
+
3265
+ if ( !shape || !bitmap )
3266
+ {
3267
+ error = FT_THROW( Invalid_Argument );
3268
+ goto Exit;
3269
+ }
3270
+
3271
+ if ( spread < MIN_SPREAD || spread > MAX_SPREAD )
3272
+ {
3273
+ error = FT_THROW( Invalid_Argument );
3274
+ goto Exit;
3275
+ }
3276
+
3277
+ memory = shape->memory;
3278
+ if ( !memory )
3279
+ {
3280
+ error = FT_THROW( Invalid_Argument );
3281
+ goto Exit;
3282
+ }
3283
+
3284
+ if ( FT_ALLOC( dists,
3285
+ bitmap->width * bitmap->rows * sizeof ( *dists ) ) )
3286
+ goto Exit;
3287
+
3288
+ contours = shape->contours;
3289
+ width = (FT_Int)bitmap->width;
3290
+ rows = (FT_Int)bitmap->rows;
3291
+ buffer = (FT_SDFFormat*)bitmap->buffer;
3292
+
3293
+ if ( USE_SQUARED_DISTANCES )
3294
+ sp_sq = FT_INT_16D16( (FT_Int)( spread * spread ) );
3295
+ else
3296
+ sp_sq = fixed_spread;
3297
+
3298
+ if ( width == 0 || rows == 0 )
3299
+ {
3300
+ FT_TRACE0(( "sdf_generate:"
3301
+ " Cannot render glyph with width/height == 0\n" ));
3302
+ FT_TRACE0(( " "
3303
+ " (width, height provided [%d, %d])", width, rows ));
3304
+
3305
+ error = FT_THROW( Cannot_Render_Glyph );
3306
+ goto Exit;
3307
+ }
3308
+
3309
+ /* loop over all contours */
3310
+ while ( contours )
3311
+ {
3312
+ SDF_Edge* edges = contours->edges;
3313
+
3314
+
3315
+ /* loop over all edges */
3316
+ while ( edges )
3317
+ {
3318
+ FT_CBox cbox;
3319
+ FT_Int x, y;
3320
+
3321
+
3322
+ /* get the control box and increase it by `spread' */
3323
+ cbox = get_control_box( *edges );
3324
+
3325
+ cbox.xMin = ( cbox.xMin - 63 ) / 64 - ( FT_Pos )spread;
3326
+ cbox.xMax = ( cbox.xMax + 63 ) / 64 + ( FT_Pos )spread;
3327
+ cbox.yMin = ( cbox.yMin - 63 ) / 64 - ( FT_Pos )spread;
3328
+ cbox.yMax = ( cbox.yMax + 63 ) / 64 + ( FT_Pos )spread;
3329
+
3330
+ /* now loop over the pixels in the control box. */
3331
+ for ( y = cbox.yMin; y < cbox.yMax; y++ )
3332
+ {
3333
+ for ( x = cbox.xMin; x < cbox.xMax; x++ )
3334
+ {
3335
+ FT_26D6_Vec grid_point = zero_vector;
3336
+ SDF_Signed_Distance dist = max_sdf;
3337
+ FT_UInt index = 0;
3338
+ FT_16D16 diff = 0;
3339
+
3340
+
3341
+ if ( x < 0 || x >= width )
3342
+ continue;
3343
+ if ( y < 0 || y >= rows )
3344
+ continue;
3345
+
3346
+ grid_point.x = FT_INT_26D6( x );
3347
+ grid_point.y = FT_INT_26D6( y );
3348
+
3349
+ /* This `grid_point` is at the corner, but we */
3350
+ /* use the center of the pixel. */
3351
+ grid_point.x += FT_INT_26D6( 1 ) / 2;
3352
+ grid_point.y += FT_INT_26D6( 1 ) / 2;
3353
+
3354
+ FT_CALL( sdf_edge_get_min_distance( edges,
3355
+ grid_point,
3356
+ &dist ) );
3357
+
3358
+ if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
3359
+ dist.sign = -dist.sign;
3360
+
3361
+ /* ignore if the distance is greater than spread; */
3362
+ /* otherwise it creates artifacts due to the wrong sign */
3363
+ if ( dist.distance > sp_sq )
3364
+ continue;
3365
+
3366
+ /* take the square root of the distance if required */
3367
+ if ( USE_SQUARED_DISTANCES )
3368
+ dist.distance = square_root( dist.distance );
3369
+
3370
+ if ( internal_params.flip_y )
3371
+ index = (FT_UInt)( y * width + x );
3372
+ else
3373
+ index = (FT_UInt)( ( rows - y - 1 ) * width + x );
3374
+
3375
+ /* check whether the pixel is set or not */
3376
+ if ( dists[index].sign == 0 )
3377
+ dists[index] = dist;
3378
+ else
3379
+ {
3380
+ diff = FT_ABS( dists[index].distance - dist.distance );
3381
+
3382
+ if ( diff <= CORNER_CHECK_EPSILON )
3383
+ dists[index] = resolve_corner( dists[index], dist );
3384
+ else if ( dists[index].distance > dist.distance )
3385
+ dists[index] = dist;
3386
+ }
3387
+ }
3388
+ }
3389
+
3390
+ edges = edges->next;
3391
+ }
3392
+
3393
+ contours = contours->next;
3394
+ }
3395
+
3396
+ /* final pass */
3397
+ for ( j = 0; j < rows; j++ )
3398
+ {
3399
+ /* We assume the starting pixel of each row is outside. */
3400
+ FT_Char current_sign = -1;
3401
+ FT_UInt index;
3402
+
3403
+
3404
+ if ( internal_params.overload_sign != 0 )
3405
+ current_sign = internal_params.overload_sign < 0 ? -1 : 1;
3406
+
3407
+ for ( i = 0; i < width; i++ )
3408
+ {
3409
+ index = (FT_UInt)( j * width + i );
3410
+
3411
+ /* if the pixel is not set */
3412
+ /* its shortest distance is more than `spread` */
3413
+ if ( dists[index].sign == 0 )
3414
+ dists[index].distance = fixed_spread;
3415
+ else
3416
+ current_sign = dists[index].sign;
3417
+
3418
+ /* clamp the values */
3419
+ if ( dists[index].distance > fixed_spread )
3420
+ dists[index].distance = fixed_spread;
3421
+
3422
+ /* flip sign if required */
3423
+ dists[index].distance *= internal_params.flip_sign ? -current_sign
3424
+ : current_sign;
3425
+
3426
+ /* concatenate to appropriate format */
3427
+ buffer[index] = map_fixed_to_sdf( dists[index].distance,
3428
+ fixed_spread );
3429
+ }
3430
+ }
3431
+
3432
+ Exit:
3433
+ FT_FREE( dists );
3434
+ return error;
3435
+ }
3436
+
3437
+
3438
+ /**************************************************************************
3439
+ *
3440
+ * @Function:
3441
+ * sdf_generate_subdivision
3442
+ *
3443
+ * @Description:
3444
+ * Subdivide the shape into a number of straight lines, then use the
3445
+ * above `sdf_generate_bounding_box` function to generate the SDF.
3446
+ *
3447
+ * Note: After calling this function `shape` no longer has the original
3448
+ * edges, it only contains lines.
3449
+ *
3450
+ * @Input:
3451
+ * internal_params ::
3452
+ * Internal parameters and properties required by the rasterizer.
3453
+ * See @SDF_Params for more.
3454
+ *
3455
+ * shape ::
3456
+ * A complete shape which is used to generate SDF.
3457
+ *
3458
+ * spread ::
3459
+ * Maximum distances to be allowed inthe output bitmap.
3460
+ *
3461
+ * @Output:
3462
+ * bitmap ::
3463
+ * The output bitmap which will contain the SDF information.
3464
+ *
3465
+ * @Return:
3466
+ * FreeType error, 0 means success.
3467
+ *
3468
+ */
3469
+ static FT_Error
3470
+ sdf_generate_subdivision( const SDF_Params internal_params,
3471
+ SDF_Shape* shape,
3472
+ FT_UInt spread,
3473
+ const FT_Bitmap* bitmap )
3474
+ {
3475
+ /*
3476
+ * Thanks to Alexei for providing the idea of this optimization.
3477
+ *
3478
+ * We take advantage of two facts.
3479
+ *
3480
+ * (1) Computing the shortest distance from a point to a line segment is
3481
+ * very fast.
3482
+ * (2) We don't have to compute the shortest distance for the entire
3483
+ * two-dimensional grid.
3484
+ *
3485
+ * Both ideas lead to the following optimization.
3486
+ *
3487
+ * (1) Split the outlines into a number of line segments.
3488
+ *
3489
+ * (2) For each line segment, only process its neighborhood.
3490
+ *
3491
+ * (3) Compute the closest distance to the line only for neighborhood
3492
+ * grid points.
3493
+ *
3494
+ * This greatly reduces the number of grid points to check.
3495
+ */
3496
+
3497
+ FT_Error error = FT_Err_Ok;
3498
+
3499
+
3500
+ FT_CALL( split_sdf_shape( shape ) );
3501
+ FT_CALL( sdf_generate_bounding_box( internal_params,
3502
+ shape, spread, bitmap ) );
3503
+
3504
+ Exit:
3505
+ return error;
3506
+ }
3507
+
3508
+
3509
+ /**************************************************************************
3510
+ *
3511
+ * @Function:
3512
+ * sdf_generate_with_overlaps
3513
+ *
3514
+ * @Description:
3515
+ * This function can be used to generate SDF for glyphs with overlapping
3516
+ * contours. The function generates SDF for contours separately on
3517
+ * separate bitmaps (to generate SDF it uses
3518
+ * `sdf_generate_subdivision`). At the end it simply combines all the
3519
+ * SDF into the output bitmap; this fixes all the signs and removes
3520
+ * overlaps.
3521
+ *
3522
+ * @Input:
3523
+ * internal_params ::
3524
+ * Internal parameters and properties required by the rasterizer. See
3525
+ * @SDF_Params for more.
3526
+ *
3527
+ * shape ::
3528
+ * A complete shape which is used to generate SDF.
3529
+ *
3530
+ * spread ::
3531
+ * Maximum distances to be allowed in the output bitmap.
3532
+ *
3533
+ * @Output:
3534
+ * bitmap ::
3535
+ * The output bitmap which will contain the SDF information.
3536
+ *
3537
+ * @Return:
3538
+ * FreeType error, 0 means success.
3539
+ *
3540
+ * @Note:
3541
+ * The function cannot generate a proper SDF for glyphs with
3542
+ * self-intersecting contours because we cannot separate them into two
3543
+ * separate bitmaps. In case of self-intersecting contours it is
3544
+ * necessary to remove the overlaps before generating the SDF.
3545
+ *
3546
+ */
3547
+ static FT_Error
3548
+ sdf_generate_with_overlaps( SDF_Params internal_params,
3549
+ SDF_Shape* shape,
3550
+ FT_UInt spread,
3551
+ const FT_Bitmap* bitmap )
3552
+ {
3553
+ FT_Error error = FT_Err_Ok;
3554
+
3555
+ FT_Int num_contours; /* total number of contours */
3556
+ FT_Int i, j; /* iterators */
3557
+ FT_Int width, rows; /* width and rows of the bitmap */
3558
+ FT_Bitmap* bitmaps; /* separate bitmaps for contours */
3559
+
3560
+ SDF_Contour* contour; /* temporary variable to iterate */
3561
+ SDF_Contour* temp_contour; /* temporary contour */
3562
+ SDF_Contour* head; /* head of the contour list */
3563
+ SDF_Shape temp_shape; /* temporary shape */
3564
+
3565
+ FT_Memory memory; /* to allocate memory */
3566
+ FT_SDFFormat* t; /* target bitmap buffer */
3567
+ FT_Bool flip_sign; /* flip sign? */
3568
+
3569
+ /* orientation of all the separate contours */
3570
+ SDF_Contour_Orientation* orientations;
3571
+
3572
+
3573
+ bitmaps = NULL;
3574
+ orientations = NULL;
3575
+ head = NULL;
3576
+
3577
+ if ( !shape || !bitmap || !shape->memory )
3578
+ return FT_THROW( Invalid_Argument );
3579
+
3580
+ /* Disable `flip_sign` to avoid extra complication */
3581
+ /* during the combination phase. */
3582
+ flip_sign = internal_params.flip_sign;
3583
+ internal_params.flip_sign = 0;
3584
+
3585
+ contour = shape->contours;
3586
+ memory = shape->memory;
3587
+ temp_shape.memory = memory;
3588
+ width = (FT_Int)bitmap->width;
3589
+ rows = (FT_Int)bitmap->rows;
3590
+ num_contours = 0;
3591
+
3592
+ /* find the number of contours in the shape */
3593
+ while ( contour )
3594
+ {
3595
+ num_contours++;
3596
+ contour = contour->next;
3597
+ }
3598
+
3599
+ /* allocate the bitmaps to generate SDF for separate contours */
3600
+ if ( FT_ALLOC( bitmaps,
3601
+ (FT_UInt)num_contours * sizeof ( *bitmaps ) ) )
3602
+ goto Exit;
3603
+
3604
+ /* allocate array to hold orientation for all contours */
3605
+ if ( FT_ALLOC( orientations,
3606
+ (FT_UInt)num_contours * sizeof ( *orientations ) ) )
3607
+ goto Exit;
3608
+
3609
+ contour = shape->contours;
3610
+
3611
+ /* Iterate over all contours and generate SDF separately. */
3612
+ for ( i = 0; i < num_contours; i++ )
3613
+ {
3614
+ /* initialize the corresponding bitmap */
3615
+ FT_Bitmap_Init( &bitmaps[i] );
3616
+
3617
+ bitmaps[i].width = bitmap->width;
3618
+ bitmaps[i].rows = bitmap->rows;
3619
+ bitmaps[i].pitch = bitmap->pitch;
3620
+ bitmaps[i].num_grays = bitmap->num_grays;
3621
+ bitmaps[i].pixel_mode = bitmap->pixel_mode;
3622
+
3623
+ /* allocate memory for the buffer */
3624
+ if ( FT_ALLOC( bitmaps[i].buffer,
3625
+ bitmap->rows * (FT_UInt)bitmap->pitch ) )
3626
+ goto Exit;
3627
+
3628
+ /* determine the orientation */
3629
+ orientations[i] = get_contour_orientation( contour );
3630
+
3631
+ /* The `overload_sign` property is specific to */
3632
+ /* `sdf_generate_bounding_box`. This basically */
3633
+ /* overloads the default sign of the outside */
3634
+ /* pixels, which is necessary for */
3635
+ /* counter-clockwise contours. */
3636
+ if ( orientations[i] == SDF_ORIENTATION_CCW &&
3637
+ internal_params.orientation == FT_ORIENTATION_FILL_RIGHT )
3638
+ internal_params.overload_sign = 1;
3639
+ else if ( orientations[i] == SDF_ORIENTATION_CW &&
3640
+ internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
3641
+ internal_params.overload_sign = 1;
3642
+ else
3643
+ internal_params.overload_sign = 0;
3644
+
3645
+ /* Make `contour->next` NULL so that there is */
3646
+ /* one contour in the list. Also hold the next */
3647
+ /* contour in a temporary variable so as to */
3648
+ /* restore the original value. */
3649
+ temp_contour = contour->next;
3650
+ contour->next = NULL;
3651
+
3652
+ /* Use `temp_shape` to hold the new contour. */
3653
+ /* Now, `temp_shape` has only one contour. */
3654
+ temp_shape.contours = contour;
3655
+
3656
+ /* finally generate the SDF */
3657
+ FT_CALL( sdf_generate_subdivision( internal_params,
3658
+ &temp_shape,
3659
+ spread,
3660
+ &bitmaps[i] ) );
3661
+
3662
+ /* Restore the original `next` variable. */
3663
+ contour->next = temp_contour;
3664
+
3665
+ /* Since `split_sdf_shape` deallocated the original */
3666
+ /* contours list we need to assign the new value to */
3667
+ /* the shape's contour. */
3668
+ temp_shape.contours->next = head;
3669
+ head = temp_shape.contours;
3670
+
3671
+ /* Simply flip the orientation in case of post-script fonts */
3672
+ /* so as to avoid modificatons in the combining phase. */
3673
+ if ( internal_params.orientation == FT_ORIENTATION_FILL_LEFT )
3674
+ {
3675
+ if ( orientations[i] == SDF_ORIENTATION_CW )
3676
+ orientations[i] = SDF_ORIENTATION_CCW;
3677
+ else if ( orientations[i] == SDF_ORIENTATION_CCW )
3678
+ orientations[i] = SDF_ORIENTATION_CW;
3679
+ }
3680
+
3681
+ contour = contour->next;
3682
+ }
3683
+
3684
+ /* assign the new contour list to `shape->contours` */
3685
+ shape->contours = head;
3686
+
3687
+ /* cast the output bitmap buffer */
3688
+ t = (FT_SDFFormat*)bitmap->buffer;
3689
+
3690
+ /* Iterate over all pixels and combine all separate */
3691
+ /* contours. These are the rules for combining: */
3692
+ /* */
3693
+ /* (1) For all clockwise contours, compute the largest */
3694
+ /* value. Name this as `val_c`. */
3695
+ /* (2) For all counter-clockwise contours, compute the */
3696
+ /* smallest value. Name this as `val_ac`. */
3697
+ /* (3) Now, finally use the smaller value of `val_c' */
3698
+ /* and `val_ac'. */
3699
+ for ( j = 0; j < rows; j++ )
3700
+ {
3701
+ for ( i = 0; i < width; i++ )
3702
+ {
3703
+ FT_Int id = j * width + i; /* index of current pixel */
3704
+ FT_Int c; /* contour iterator */
3705
+
3706
+ FT_SDFFormat val_c = 0; /* max clockwise value */
3707
+ FT_SDFFormat val_ac = UCHAR_MAX; /* min counter-clockwise val */
3708
+
3709
+
3710
+ /* iterate through all the contours */
3711
+ for ( c = 0; c < num_contours; c++ )
3712
+ {
3713
+ /* current contour value */
3714
+ FT_SDFFormat temp = ( (FT_SDFFormat*)bitmaps[c].buffer )[id];
3715
+
3716
+
3717
+ if ( orientations[c] == SDF_ORIENTATION_CW )
3718
+ val_c = FT_MAX( val_c, temp ); /* clockwise */
3719
+ else
3720
+ val_ac = FT_MIN( val_ac, temp ); /* counter-clockwise */
3721
+ }
3722
+
3723
+ /* Finally find the smaller of the two and assign to output. */
3724
+ /* Also apply `flip_sign` if set. */
3725
+ t[id] = FT_MIN( val_c, val_ac );
3726
+
3727
+ if ( flip_sign )
3728
+ t[id] = invert_sign( t[id] );
3729
+ }
3730
+ }
3731
+
3732
+ Exit:
3733
+ /* deallocate orientations array */
3734
+ if ( orientations )
3735
+ FT_FREE( orientations );
3736
+
3737
+ /* deallocate temporary bitmaps */
3738
+ if ( bitmaps )
3739
+ {
3740
+ if ( num_contours == 0 )
3741
+ error = FT_THROW( Raster_Corrupted );
3742
+ else
3743
+ {
3744
+ for ( i = 0; i < num_contours; i++ )
3745
+ FT_FREE( bitmaps[i].buffer );
3746
+
3747
+ FT_FREE( bitmaps );
3748
+ }
3749
+ }
3750
+
3751
+ /* restore the `flip_sign` property */
3752
+ internal_params.flip_sign = flip_sign;
3753
+
3754
+ return error;
3755
+ }
3756
+
3757
+
3758
+ /**************************************************************************
3759
+ *
3760
+ * interface functions
3761
+ *
3762
+ */
3763
+
3764
+ static FT_Error
3765
+ sdf_raster_new( void* memory_, /* FT_Memory */
3766
+ FT_Raster* araster_ ) /* SDF_PRaster* */
3767
+ {
3768
+ FT_Memory memory = (FT_Memory)memory_;
3769
+ SDF_PRaster* araster = (SDF_PRaster*)araster_;
3770
+
3771
+
3772
+ FT_Error error;
3773
+ SDF_PRaster raster = NULL;
3774
+
3775
+
3776
+ if ( !FT_NEW( raster ) )
3777
+ raster->memory = memory;
3778
+
3779
+ *araster = raster;
3780
+
3781
+ return error;
3782
+ }
3783
+
3784
+
3785
+ static void
3786
+ sdf_raster_reset( FT_Raster raster,
3787
+ unsigned char* pool_base,
3788
+ unsigned long pool_size )
3789
+ {
3790
+ FT_UNUSED( raster );
3791
+ FT_UNUSED( pool_base );
3792
+ FT_UNUSED( pool_size );
3793
+ }
3794
+
3795
+
3796
+ static FT_Error
3797
+ sdf_raster_set_mode( FT_Raster raster,
3798
+ unsigned long mode,
3799
+ void* args )
3800
+ {
3801
+ FT_UNUSED( raster );
3802
+ FT_UNUSED( mode );
3803
+ FT_UNUSED( args );
3804
+
3805
+ return FT_Err_Ok;
3806
+ }
3807
+
3808
+
3809
+ static FT_Error
3810
+ sdf_raster_render( FT_Raster raster,
3811
+ const FT_Raster_Params* params )
3812
+ {
3813
+ FT_Error error = FT_Err_Ok;
3814
+ SDF_TRaster* sdf_raster = (SDF_TRaster*)raster;
3815
+ FT_Outline* outline = NULL;
3816
+ const SDF_Raster_Params* sdf_params = (const SDF_Raster_Params*)params;
3817
+
3818
+ FT_Memory memory = NULL;
3819
+ SDF_Shape* shape = NULL;
3820
+ SDF_Params internal_params;
3821
+
3822
+
3823
+ /* check for valid arguments */
3824
+ if ( !sdf_raster || !sdf_params )
3825
+ {
3826
+ error = FT_THROW( Invalid_Argument );
3827
+ goto Exit;
3828
+ }
3829
+
3830
+ outline = (FT_Outline*)sdf_params->root.source;
3831
+
3832
+ /* check whether outline is valid */
3833
+ if ( !outline )
3834
+ {
3835
+ error = FT_THROW( Invalid_Outline );
3836
+ goto Exit;
3837
+ }
3838
+
3839
+ /* if the outline is empty, return */
3840
+ if ( outline->n_points == 0 || outline->n_contours == 0 )
3841
+ goto Exit;
3842
+
3843
+ /* check whether the outline has valid fields */
3844
+ if ( !outline->contours || !outline->points )
3845
+ {
3846
+ error = FT_THROW( Invalid_Outline );
3847
+ goto Exit;
3848
+ }
3849
+
3850
+ /* check whether spread is set properly */
3851
+ if ( sdf_params->spread > MAX_SPREAD ||
3852
+ sdf_params->spread < MIN_SPREAD )
3853
+ {
3854
+ FT_TRACE0(( "sdf_raster_render:"
3855
+ " The `spread' field of `SDF_Raster_Params' is invalid,\n" ));
3856
+ FT_TRACE0(( " "
3857
+ " the value of this field must be within [%d, %d].\n",
3858
+ MIN_SPREAD, MAX_SPREAD ));
3859
+ FT_TRACE0(( " "
3860
+ " Also, you must pass `SDF_Raster_Params' instead of\n" ));
3861
+ FT_TRACE0(( " "
3862
+ " the default `FT_Raster_Params' while calling\n" ));
3863
+ FT_TRACE0(( " "
3864
+ " this function and set the fields properly.\n" ));
3865
+
3866
+ error = FT_THROW( Invalid_Argument );
3867
+ goto Exit;
3868
+ }
3869
+
3870
+ memory = sdf_raster->memory;
3871
+ if ( !memory )
3872
+ {
3873
+ FT_TRACE0(( "sdf_raster_render:"
3874
+ " Raster not setup properly,\n" ));
3875
+ FT_TRACE0(( " "
3876
+ " unable to find memory handle.\n" ));
3877
+
3878
+ error = FT_THROW( Invalid_Handle );
3879
+ goto Exit;
3880
+ }
3881
+
3882
+ /* set up the parameters */
3883
+ internal_params.orientation = FT_Outline_Get_Orientation( outline );
3884
+ internal_params.flip_sign = sdf_params->flip_sign;
3885
+ internal_params.flip_y = sdf_params->flip_y;
3886
+ internal_params.overload_sign = 0;
3887
+
3888
+ FT_CALL( sdf_shape_new( memory, &shape ) );
3889
+
3890
+ FT_CALL( sdf_outline_decompose( outline, shape ) );
3891
+
3892
+ if ( sdf_params->overlaps )
3893
+ FT_CALL( sdf_generate_with_overlaps( internal_params,
3894
+ shape, sdf_params->spread,
3895
+ sdf_params->root.target ) );
3896
+ else
3897
+ FT_CALL( sdf_generate_subdivision( internal_params,
3898
+ shape, sdf_params->spread,
3899
+ sdf_params->root.target ) );
3900
+
3901
+ if ( shape )
3902
+ sdf_shape_done( &shape );
3903
+
3904
+ Exit:
3905
+ return error;
3906
+ }
3907
+
3908
+
3909
+ static void
3910
+ sdf_raster_done( FT_Raster raster )
3911
+ {
3912
+ FT_Memory memory = (FT_Memory)((SDF_TRaster*)raster)->memory;
3913
+
3914
+
3915
+ FT_FREE( raster );
3916
+ }
3917
+
3918
+
3919
+ FT_DEFINE_RASTER_FUNCS(
3920
+ ft_sdf_raster,
3921
+
3922
+ FT_GLYPH_FORMAT_OUTLINE,
3923
+
3924
+ (FT_Raster_New_Func) sdf_raster_new, /* raster_new */
3925
+ (FT_Raster_Reset_Func) sdf_raster_reset, /* raster_reset */
3926
+ (FT_Raster_Set_Mode_Func)sdf_raster_set_mode, /* raster_set_mode */
3927
+ (FT_Raster_Render_Func) sdf_raster_render, /* raster_render */
3928
+ (FT_Raster_Done_Func) sdf_raster_done /* raster_done */
3929
+ )
3930
+
3931
+
3932
+ /* END */