aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDistanceFieldGen.h
blob: 3d2ec23b75de31460a23290dcc603491b0064da2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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