blob: b25698bea8758b89d267901886788b29972b7336 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000010#ifndef SkPDFUtils_DEFINED
11#define SkPDFUtils_DEFINED
12
vandebo@chromium.orgf71b2102011-04-04 19:46:31 +000013#include "SkPath.h"
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000014
15class SkMatrix;
16class SkPath;
17class SkPDFArray;
vandebo@chromium.org8989d312011-05-18 22:10:09 +000018struct SkRect;
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000019
vandebo@chromium.orgf71b2102011-04-04 19:46:31 +000020#if 0
21#define PRINT_NOT_IMPL(str) fprintf(stderr, str)
22#else
23#define PRINT_NOT_IMPL(str)
24#endif
25
26#define NOT_IMPLEMENTED(condition, assert) \
27 do { \
28 if (condition) { \
29 PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \
30 SkDEBUGCODE(SkASSERT(!assert);) \
31 } \
32 } while(0)
33
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000034class SkPDFUtils {
35public:
36 static SkPDFArray* MatrixToArray(const SkMatrix& matrix);
vandebo@chromium.org75f97e42011-04-11 23:24:18 +000037 static void AppendTransform(const SkMatrix& matrix, SkWStream* content);
vandebo@chromium.orgcae5fba2011-03-28 19:03:50 +000038
39 static void MoveTo(SkScalar x, SkScalar y, SkWStream* content);
40 static void AppendLine(SkScalar x, SkScalar y, SkWStream* content);
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000041 static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y,
42 SkScalar ctl2X, SkScalar ctl2Y,
vandebo@chromium.orgcae5fba2011-03-28 19:03:50 +000043 SkScalar dstX, SkScalar dstY, SkWStream* content);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000044 static void AppendRectangle(const SkRect& rect, SkWStream* content);
vandebo@chromium.orgcae5fba2011-03-28 19:03:50 +000045 static void EmitPath(const SkPath& path, SkWStream* content);
46 static void ClosePath(SkWStream* content);
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000047 static void PaintPath(SkPaint::Style style, SkPath::FillType fill,
vandebo@chromium.orgcae5fba2011-03-28 19:03:50 +000048 SkWStream* content);
49 static void StrokePath(SkWStream* content);
vandebo@chromium.org6112c212011-05-13 03:50:38 +000050 static void DrawFormXObject(int objectIndex, SkWStream* content);
51 static void ApplyGraphicState(int objectIndex, SkWStream* content);
ctguil@chromium.orgf966fd32011-03-04 21:47:04 +000052};
53
54#endif