michael@0: /* michael@0: * Copyright 2008, The Android Open Source Project michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * * Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * * Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY michael@0: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR michael@0: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR michael@0: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, michael@0: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, michael@0: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR michael@0: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY michael@0: * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE michael@0: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: */ michael@0: michael@0: #ifndef SkANP_DEFINED michael@0: #define SkANP_DEFINED michael@0: michael@0: #include "android_npapi.h" michael@0: #include "SkCanvas.h" michael@0: #include "SkMatrix.h" michael@0: #include "SkPaint.h" michael@0: #include "SkPath.h" michael@0: #include "SkTypeface.h" michael@0: michael@0: struct ANPMatrix : SkMatrix { michael@0: }; michael@0: michael@0: struct ANPPath : SkPath { michael@0: }; michael@0: michael@0: struct ANPPaint : SkPaint { michael@0: }; michael@0: michael@0: struct ANPTypeface : SkTypeface { michael@0: }; michael@0: michael@0: struct ANPCanvas { michael@0: SkCanvas* skcanvas; michael@0: michael@0: // draw into the specified bitmap michael@0: explicit ANPCanvas(const SkBitmap& bm) { michael@0: skcanvas = new SkCanvas(bm); michael@0: } michael@0: michael@0: // redirect all drawing to the specific SkCanvas michael@0: explicit ANPCanvas(SkCanvas* other) { michael@0: skcanvas = other; michael@0: skcanvas->ref(); michael@0: } michael@0: michael@0: ~ANPCanvas() { michael@0: skcanvas->unref(); michael@0: } michael@0: }; michael@0: michael@0: class SkANP { michael@0: public: michael@0: static SkRect* SetRect(SkRect* dst, const ANPRectF& src); michael@0: static SkIRect* SetRect(SkIRect* dst, const ANPRectI& src); michael@0: static ANPRectI* SetRect(ANPRectI* dst, const SkIRect& src); michael@0: static ANPRectF* SetRect(ANPRectF* dst, const SkRect& src); michael@0: static SkBitmap* SetBitmap(SkBitmap* dst, const ANPBitmap& src); michael@0: static bool SetBitmap(ANPBitmap* dst, const SkBitmap& src); michael@0: michael@0: static void InitEvent(ANPEvent* event, ANPEventType et); michael@0: }; michael@0: michael@0: #endif