aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDistanceFieldGen.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-10 19:38:51 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-10 19:38:51 +0000
commitbf998240837d8798e0b257416ce8832250b64af6 (patch)
tree124e4abe8d57f6d1655844de9802cab884272402 /src/core/SkDistanceFieldGen.h
parentbfce48e0bca2c92eca55f31511a3d6def1b5309f (diff)
Add new module for distance field generation.
This improves the speed over the previous method by 10x+, and makes using distance fields practical. BUG=skia:2173 R=bsalomon@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/178543007 git-svn-id: http://skia.googlecode.com/svn/trunk@13729 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkDistanceFieldGen.h')
-rwxr-xr-xsrc/core/SkDistanceFieldGen.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/SkDistanceFieldGen.h b/src/core/SkDistanceFieldGen.h
new file mode 100755
index 0000000000..3d2ec23b75
--- /dev/null
+++ b/src/core/SkDistanceFieldGen.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkDistanceFieldGen_DEFINED
+#define SkDistanceFieldGen_DEFINED
+
+/** Given 8-bit mask data, generate the associated distance field
+
+ * @param distanceField The distance field to be generated. Should already be allocated
+ * by the client with the padding below.
+ * @param image 8-bit mask we're using to generate the distance field.
+ * @param w Width of the image.
+ * @param h Height of the image.
+ * @param distanceMagnitude Largest possible absolute value for the distance. The distance field
+ * will be padded to w + 2*distanceMagnitude, h + 2*distanceMagnitude.
+ */
+bool SkGenerateDistanceFieldFromImage(unsigned char* distanceField,
+ const unsigned char* image,
+ int w, int h,
+ int distanceMagnitude);
+
+#endif