gfx/skia/trunk/include/core/SkComposeShader.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/core/SkComposeShader.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2006 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#ifndef SkComposeShader_DEFINED
    1.14 +#define SkComposeShader_DEFINED
    1.15 +
    1.16 +#include "SkShader.h"
    1.17 +
    1.18 +class SkXfermode;
    1.19 +
    1.20 +///////////////////////////////////////////////////////////////////////////////////////////
    1.21 +
    1.22 +/** \class SkComposeShader
    1.23 +    This subclass of shader returns the coposition of two other shaders, combined by
    1.24 +    a xfermode.
    1.25 +*/
    1.26 +class SK_API SkComposeShader : public SkShader {
    1.27 +public:
    1.28 +    /** Create a new compose shader, given shaders A, B, and a combining xfermode mode.
    1.29 +        When the xfermode is called, it will be given the result from shader A as its
    1.30 +        "dst", and the result of from shader B as its "src".
    1.31 +        mode->xfer32(sA_result, sB_result, ...)
    1.32 +        @param shaderA  The colors from this shader are seen as the "dst" by the xfermode
    1.33 +        @param shaderB  The colors from this shader are seen as the "src" by the xfermode
    1.34 +        @param mode     The xfermode that combines the colors from the two shaders. If mode
    1.35 +                        is null, then SRC_OVER is assumed.
    1.36 +    */
    1.37 +    SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL);
    1.38 +    virtual ~SkComposeShader();
    1.39 +
    1.40 +    virtual bool setContext(const SkBitmap&, const SkPaint&,
    1.41 +                            const SkMatrix&) SK_OVERRIDE;
    1.42 +    virtual void endContext() SK_OVERRIDE;
    1.43 +    virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
    1.44 +
    1.45 +    SK_TO_STRING_OVERRIDE()
    1.46 +    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader)
    1.47 +
    1.48 +protected:
    1.49 +    SkComposeShader(SkReadBuffer& );
    1.50 +    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    1.51 +
    1.52 +private:
    1.53 +
    1.54 +    SkShader*   fShaderA;
    1.55 +    SkShader*   fShaderB;
    1.56 +    SkXfermode* fMode;
    1.57 +
    1.58 +    typedef SkShader INHERITED;
    1.59 +};
    1.60 +
    1.61 +#endif

mercurial