Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: include/effects/SkPaintImageFilter.h

Issue 1556553002: Implement an SkPaint-based image filter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: More randomness for paths and for rasterizer's paint Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/effects/SkPaintImageFilter.h
diff --git a/include/effects/SkPaintImageFilter.h b/include/effects/SkPaintImageFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..eee3630f31020e5ec977599f322d2928ab00fa9c
--- /dev/null
+++ b/include/effects/SkPaintImageFilter.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPaintImageFilter_DEFINED
+#define SkPaintImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkPaint.h"
+
+class SK_API SkPaintImageFilter : public SkImageFilter {
+public:
+ /** Create a new image filter which fills the given rectangle using the
+ * given paint. 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 paint Paint to use when filling the rect.
+ * @param rect Rectangle of output pixels. If NULL or a given crop edge is
+ * not specified, the source primitive's bounds are used
+ * instead.
+ */
+ static SkImageFilter* Create(const SkPaint& paint, const CropRect* rect = NULL);
+
+ bool canComputeFastBounds() const override;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPaintImageFilter)
+
+protected:
+ void flatten(SkWriteBuffer&) const override;
+ bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result,
+ SkIPoint* loc) const override;
+
+private:
+ SkPaintImageFilter(const SkPaint& paint, const CropRect* rect);
+
+ SkPaint fPaint;
+
+ typedef SkImageFilter INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698