gfx/skia/trunk/include/utils/SkLuaCanvas.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/utils/SkLuaCanvas.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +/*
     1.5 + * Copyright 2013 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkLuaCanvas_DEFINED
    1.12 +#define SkLuaCanvas_DEFINED
    1.13 +
    1.14 +#include "SkCanvas.h"
    1.15 +#include "SkString.h"
    1.16 +
    1.17 +struct lua_State;
    1.18 +
    1.19 +class SkLuaCanvas : public SkCanvas {
    1.20 +public:
    1.21 +    void pushThis();
    1.22 +
    1.23 +    SkLuaCanvas(int width, int height, lua_State*, const char function[]);
    1.24 +    virtual ~SkLuaCanvas();
    1.25 +
    1.26 +    virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
    1.27 +    virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
    1.28 +                            const SkPaint& paint) SK_OVERRIDE;
    1.29 +    virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    1.30 +    virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    1.31 +    virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
    1.32 +    virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
    1.33 +    virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
    1.34 +                            const SkPaint* paint) SK_OVERRIDE;
    1.35 +    virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
    1.36 +                                      const SkRect& dst, const SkPaint* paint,
    1.37 +                                      DrawBitmapRectFlags flags) SK_OVERRIDE;
    1.38 +    virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
    1.39 +                                  const SkPaint* paint) SK_OVERRIDE;
    1.40 +    virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
    1.41 +                            const SkPaint* paint) SK_OVERRIDE;
    1.42 +    virtual void drawText(const void* text, size_t byteLength, SkScalar x,
    1.43 +                          SkScalar y, const SkPaint& paint) SK_OVERRIDE;
    1.44 +    virtual void drawPosText(const void* text, size_t byteLength,
    1.45 +                             const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE;
    1.46 +    virtual void drawPosTextH(const void* text, size_t byteLength,
    1.47 +                              const SkScalar xpos[], SkScalar constY,
    1.48 +                              const SkPaint& paint) SK_OVERRIDE;
    1.49 +    virtual void drawTextOnPath(const void* text, size_t byteLength,
    1.50 +                                const SkPath& path, const SkMatrix* matrix,
    1.51 +                                const SkPaint& paint) SK_OVERRIDE;
    1.52 +    virtual void drawPicture(SkPicture&) SK_OVERRIDE;
    1.53 +    virtual void drawVertices(VertexMode vmode, int vertexCount,
    1.54 +                              const SkPoint vertices[], const SkPoint texs[],
    1.55 +                              const SkColor colors[], SkXfermode* xmode,
    1.56 +                              const uint16_t indices[], int indexCount,
    1.57 +                              const SkPaint& paint) SK_OVERRIDE;
    1.58 +    virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
    1.59 +
    1.60 +protected:
    1.61 +    virtual void willSave(SaveFlags) SK_OVERRIDE;
    1.62 +    virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
    1.63 +    virtual void willRestore() SK_OVERRIDE;
    1.64 +
    1.65 +    virtual void didTranslate(SkScalar, SkScalar) SK_OVERRIDE;
    1.66 +    virtual void didScale(SkScalar, SkScalar) SK_OVERRIDE;
    1.67 +    virtual void didRotate(SkScalar) SK_OVERRIDE;
    1.68 +    virtual void didSkew(SkScalar, SkScalar) SK_OVERRIDE;
    1.69 +    virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
    1.70 +    virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
    1.71 +
    1.72 +    virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
    1.73 +
    1.74 +    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.75 +    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.76 +    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    1.77 +    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
    1.78 +
    1.79 +private:
    1.80 +    lua_State*  fL;
    1.81 +    SkString    fFunc;
    1.82 +
    1.83 +    void sendverb(const char verb[]);
    1.84 +
    1.85 +    typedef SkCanvas INHERITED;
    1.86 +};
    1.87 +
    1.88 +#endif

mercurial