Created
October 12, 2015 18:49
-
-
Save HalCanary/903fd6757568d1cb9426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2015 Google Inc. | |
* | |
* Use of this source code is governed by a BSD-style license that can be | |
* found in the LICENSE file. | |
*/ | |
#ifndef SkEffects_DEFINED | |
#define SkEffects_DEFINED | |
#include "SkColor.h" | |
#include "SkImageFilter.h" | |
#include "SkScalar.h" | |
#include "SkXfermode.h" | |
class SkColorFilter; | |
class SkMaskFilter; | |
namespace SkColorFilterImageFilter { | |
SK_API SkImageFilter* Create(SkColorFilter* cf, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkModeColorFilter { | |
SK_API SkColorFilter* Create(SkColor color, SkXfermode::Mode mode); | |
} | |
namespace SkBlurImageFilter { | |
SK_API SkImageFilter* Create(SkScalar sigmaX, | |
SkScalar sigmaY, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkDropShadowImageFilter { | |
enum ShadowMode { | |
kDrawShadowAndForeground_ShadowMode, | |
kDrawShadowOnly_ShadowMode, | |
kLast_ShadowMode = kDrawShadowOnly_ShadowMode | |
}; | |
const int kShadowModeCount = kLast_ShadowMode + 1; | |
SK_API SkImageFilter* Create(SkScalar dx, | |
SkScalar dy, | |
SkScalar sigmaX, | |
SkScalar sigmaY, | |
SkColor color, | |
SkDropShadowImageFilterLLShadowMode shadowMode, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkMergeImageFilter { | |
SK_API SkImageFilter* Create(SkImageFilter* first, | |
SkImageFilter* second, | |
SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
SK_API SkImageFilter* Create(SkImageFilter* filters[], | |
int count, | |
const SkXfermode::Mode modes[] = NULL, | |
const CropRect* cropRect = NULL); | |
} | |
namespace SkDilateImageFilter { | |
SK_API SkImageFilter* Create(int radiusX, | |
int radiusY, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkErodeImageFilter { | |
SK_API SkImageFilter* Create(int radiusX, | |
int radiusY, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkOffsetImageFilter { | |
SK_API SkImageFilter* Create(SkScalar dx, | |
SkScalar dy, | |
SkImageFilter* input = NULL, | |
const SkImageFilter::CropRect* cropRect = NULL); | |
} | |
namespace SkPictureImageFilter { | |
/** | |
* Refs the passed-in picture. | |
*/ | |
SK_API SkImageFilter* Create(const SkPicture* picture); | |
/** | |
* Refs the passed-in picture. cropRect can be used to crop or expand | |
* the destination rect when the picture is drawn. (No scaling is | |
* implied by the dest rect; only the CTM is applied.) | |
*/ | |
SK_API SkImageFilter* Create(const SkPicture* picture, | |
const SkRect& cropRect); | |
/** | |
* Refs the passed-in picture. The picture is rasterized at a | |
* resolution that matches the local coordinate space. If the picture | |
* needs to be resampled for drawing it into the destination canvas, | |
* bilinear filtering will be used. cropRect can be used to crop or | |
* expand the destination rect when the picture is drawn. (No scaling | |
* is implied by the dest rect; only the CTM is applied.) | |
*/ | |
SK_API SkImageFilter* CreateForLocalSpace(const SkPicture* picture, | |
const SkRect& cropRect, | |
SkFilterQuality filterQuality); | |
} | |
namespace SkPixelXorXfermode { | |
SK_API SkXfermode* Create(SkColor opColor); | |
} | |
namespace SkRectShaderImageFilter { | |
/** Create a new image filter which fills the given rectangle with | |
* pixels produced by the given SkShader. If no rectangle is | |
* specified, an output is produced with the same bounds as the input | |
* primitive (even though the input primitive's pixels are not used | |
* for processing). | |
* @param s Shader to call for processing. Cannot be NULL. Will be | |
* ref'ed by the new image filter. | |
* @param rect Rectangle of output pixels in which to apply the | |
* shader. If NULL or a given crop edge is not | |
* specified, the source primitive's bounds are used | |
* instead. | |
*/ | |
SK_ATTR_DEPRECATED("use Create(SkShader*, const CropRect*)") | |
SK_API SkImageFilter* Create(SkShader* s, const SkRect& rect); | |
SK_API SkImageFilter* Create(SkShader* s, | |
const SkImageFilter::CropRect* rect = NULL); | |
} | |
namespace SkTableMaskFilter { | |
/** Utility that sets the gamma table */ | |
SK_API void MakeGammaTable(uint8_t table[256], SkScalar gamma); | |
/** Utility that creates a clipping table: clamps values below min to 0 | |
and above max to 255, and rescales the remaining into 0..255 */ | |
SK_API void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max); | |
SK_API SkMaskFilter* Create(const uint8_t table[256]); | |
SK_API SkMaskFilter* CreateGamma(SkScalar gamma); | |
SK_API SkMaskFilter* CreateClip(uint8_t min, uint8_t max); | |
} | |
namespace SkDownSampleImageFilter { | |
/** Fun mode that scales down (only) and then scales back up to look | |
pixelated */ | |
SK_API SkImageFilter* Create(SkScalar scale, SkImageFilter* input = NULL); | |
} | |
namespace SkTileImageFilter { | |
/** Create a tile image filter | |
@param src Defines the pixels to tile | |
@param dst Defines the pixels where tiles are drawn | |
@param input Input from which the subregion defined by srcRect will be tiled | |
*/ | |
SK_API SkImageFilter* Create(const SkRect& src, | |
const SkRect& dst, | |
SkImageFilter* input); | |
} | |
#endif // SkEffects_DEFINED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment