diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/effects/SkMagnifierImageFilter.h | 37 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 17 |
2 files changed, 54 insertions, 0 deletions
diff --git a/include/effects/SkMagnifierImageFilter.h b/include/effects/SkMagnifierImageFilter.h new file mode 100644 index 0000000000..144fdb42ca --- /dev/null +++ b/include/effects/SkMagnifierImageFilter.h @@ -0,0 +1,37 @@ +/* + * Copyright 2012 The Android Open Source Project + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +#ifndef SkMagnifierImageFilter_DEFINED +#define SkMagnifierImageFilter_DEFINED + +#include "SkRect.h" +#include "SkImageFilter.h" + +class SK_API SkMagnifierImageFilter : public SkImageFilter { +public: + SkMagnifierImageFilter(SkRect srcRect, SkScalar inset); + + virtual bool asNewCustomStage(GrCustomStage** stage, + GrTexture* texture) const SK_OVERRIDE; + + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter) + +protected: + explicit SkMagnifierImageFilter(SkFlattenableReadBuffer& buffer); + virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; + + virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, + SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; + +private: + SkRect fSrcRect; + SkScalar fInset; + typedef SkImageFilter INHERITED; +}; + +#endif diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 6252cc29f8..52dafd0597 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -605,6 +605,23 @@ public: float sigmaX, float sigmaY); /** + * Zooms a subset of the texture to a larger size with a nice edge. + * The inner rectangle is a simple scaling of the texture by a factor of + * |zoom|. The outer |inset| pixels transition from the background texture + * to the zoomed coordinate system at a rate of + * (distance_to_edge / inset) ^2, producing a rounded lens effect. + * @param srcTexture The source texture to be zoomed. + * @param dstRect The destination rectangle. + * @param srcRect The source rectangle. Must be smaller than + * dstRect + * @param inset Number of pixels to blend along the edges. + * @return the zoomed texture, which is dstTexture. + */ + GrTexture* zoom(GrTexture* srcTexture, + const SkRect& dstRect, const SkRect& srcRect, float inset); + + + /** * This enum is used with the function below, applyMorphology. */ enum MorphologyType { |