1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/pdf/SkPDFUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2011 Google Inc. 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 SkPDFUtils_DEFINED 1.14 +#define SkPDFUtils_DEFINED 1.15 + 1.16 +#include "SkPaint.h" 1.17 +#include "SkPath.h" 1.18 + 1.19 +class SkMatrix; 1.20 +class SkPath; 1.21 +class SkPDFArray; 1.22 +struct SkRect; 1.23 +class SkWStream; 1.24 + 1.25 +#if 0 1.26 +#define PRINT_NOT_IMPL(str) fprintf(stderr, str) 1.27 +#else 1.28 +#define PRINT_NOT_IMPL(str) 1.29 +#endif 1.30 + 1.31 +#define NOT_IMPLEMENTED(condition, assert) \ 1.32 + do { \ 1.33 + if ((bool)(condition)) { \ 1.34 + PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ 1.35 + SkDEBUGCODE(SkASSERT(!assert);) \ 1.36 + } \ 1.37 + } while (0) 1.38 + 1.39 +class SkPDFUtils { 1.40 +public: 1.41 + static SkPDFArray* RectToArray(const SkRect& rect); 1.42 + static SkPDFArray* MatrixToArray(const SkMatrix& matrix); 1.43 + static void AppendTransform(const SkMatrix& matrix, SkWStream* content); 1.44 + 1.45 + static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); 1.46 + static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); 1.47 + static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, 1.48 + SkScalar ctl2X, SkScalar ctl2Y, 1.49 + SkScalar dstX, SkScalar dstY, SkWStream* content); 1.50 + static void AppendRectangle(const SkRect& rect, SkWStream* content); 1.51 + static void EmitPath(const SkPath& path, SkPaint::Style paintStyle, 1.52 + SkWStream* content); 1.53 + static void ClosePath(SkWStream* content); 1.54 + static void PaintPath(SkPaint::Style style, SkPath::FillType fill, 1.55 + SkWStream* content); 1.56 + static void StrokePath(SkWStream* content); 1.57 + static void DrawFormXObject(int objectIndex, SkWStream* content); 1.58 + static void ApplyGraphicState(int objectIndex, SkWStream* content); 1.59 + static void ApplyPattern(int objectIndex, SkWStream* content); 1.60 +}; 1.61 + 1.62 +#endif