2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkRectShaderImageFilter_DEFINED
9 #define SkRectShaderImageFilter_DEFINED
11 #include "SkImageFilter.h"
16 class SK_API SkRectShaderImageFilter : public SkImageFilter {
18 /** Create a new image filter which fills the given rectangle with pixels
19 * produced by the given SkShader. If no rectangle is specified, an output
20 * is produced with the same bounds as the input primitive (even though
21 * the input primitive's pixels are not used for processing).
22 * @param s Shader to call for processing. Cannot be NULL. Will be
23 * ref'ed by the new image filter.
24 * @param rect Rectangle of output pixels in which to apply the shader.
25 * If NULL or a given crop edge is not specified, the source
26 * primitive's bounds are used instead.
28 SK_ATTR_DEPRECATED("use Create(SkShader*, const CropRect*)")
29 static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect);
31 static SkRectShaderImageFilter* Create(SkShader* s, const CropRect* rect = NULL, uint32_t uniqueID = 0);
32 virtual ~SkRectShaderImageFilter();
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter)
37 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
38 SkRectShaderImageFilter(SkReadBuffer& buffer);
40 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
42 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
43 SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
46 SkRectShaderImageFilter(SkShader* s, const CropRect* rect, uint32_t uniqueID = 0);
49 typedef SkImageFilter INHERITED;