diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-11 15:57:40 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-11 15:57:40 +0000 |
commit | 8065ec50f1937c1562810bfe2b216abfb98362b3 (patch) | |
tree | 410a1a945d66d437d7317ffc29f21dde92f515c4 /src/core/SkDistanceFieldGen.h | |
parent | c5c748c14797ae49ba73999a63e3b07315c888e1 (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
Committed: http://code.google.com/p/skia/source/detail?r=13729
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@13740 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkDistanceFieldGen.h')
-rwxr-xr-x | src/core/SkDistanceFieldGen.h | 25 |
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 |