blob: 90379f9f6b0cb1a8cd57932c3a407b446aaa1856 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +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.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000010#ifndef SkPDFDevice_DEFINED
11#define SkPDFDevice_DEFINED
12
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +000013#include "SkCanvas.h"
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000014#include "SkDevice.h"
vandebo@chromium.orga5180862010-10-26 19:48:49 +000015#include "SkPaint.h"
16#include "SkPath.h"
vandebo@chromium.org238be8c2012-07-13 20:06:02 +000017#include "SkRect.h"
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000018#include "SkRefCnt.h"
19#include "SkStream.h"
epoger@google.comb58772f2013-03-08 09:09:10 +000020#include "SkTDArray.h"
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000021#include "SkTScopedPtr.h"
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000022
23class SkPDFArray;
24class SkPDFDevice;
25class SkPDFDict;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000026class SkPDFFont;
vandebo@chromium.org6112c212011-05-13 03:50:38 +000027class SkPDFFormXObject;
vandebo@chromium.org98594282011-07-25 22:34:12 +000028class SkPDFGlyphSetMap;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000029class SkPDFGraphicState;
30class SkPDFObject;
vandebo@chromium.orgda912d62011-03-08 18:31:02 +000031class SkPDFShader;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000032class SkPDFStream;
33
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000034// Private classes.
35struct ContentEntry;
36struct GraphicStateEntry;
epoger@google.comb58772f2013-03-08 09:09:10 +000037struct NamedDestination;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000038
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000039/** \class SkPDFDevice
40
41 The drawing context for the PDF backend.
42*/
43class SkPDFDevice : public SkDevice {
44public:
45 /** Create a PDF drawing context with the given width and height.
46 * 72 points/in means letter paper is 612x792.
ctguil@chromium.org15261292011-04-29 17:54:16 +000047 * @param pageSize Page size in points.
48 * @param contentSize The content size of the page in points. This will be
49 * combined with the initial transform to determine the drawing area
50 * (as reported by the width and height methods). Anything outside
51 * of the drawing area will be clipped.
vandebo@chromium.org75f97e42011-04-11 23:24:18 +000052 * @param initialTransform The initial transform to apply to the page.
53 * This may be useful to, for example, move the origin in and
54 * over a bit to account for a margin, scale the canvas,
55 * or apply a rotation. Note1: the SkPDFDevice also applies
56 * a scale+translate transform to move the origin from the
57 * bottom left (PDF default) to the top left. Note2: drawDevice
58 * (used by layer restore) draws the device after this initial
reed@google.comcde92112011-07-06 20:00:52 +000059 * transform is applied, so the PDF device does an
vandebo@chromium.org75f97e42011-04-11 23:24:18 +000060 * inverse scale+translate to accommodate the one that SkPDFDevice
61 * always does.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000062 */
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +000063 // TODO(vandebo): The sizes should be SkSize and not SkISize.
ctguil@chromium.org15261292011-04-29 17:54:16 +000064 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
65 const SkMatrix& initialTransform);
66 SK_API virtual ~SkPDFDevice();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000067
reed@google.com982cb872011-12-07 18:34:08 +000068 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE;
vandebo@chromium.org35fc62b2010-10-26 19:47:30 +000069
reed@google.com982cb872011-12-07 18:34:08 +000070 virtual void clear(SkColor color) SK_OVERRIDE;
vandebo@chromium.org77bcaa32011-04-15 20:57:37 +000071
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000072 /** These are called inside the per-device-layer loop for each draw call.
73 When these are called, we have already applied any saveLayer operations,
74 and are handling any looping from the paint, and any effects from the
75 DrawFilter.
76 */
reed@google.com982cb872011-12-07 18:34:08 +000077 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000078 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
79 size_t count, const SkPoint[],
reed@google.com982cb872011-12-07 18:34:08 +000080 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000081 virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint);
vandebo@chromium.orgff390322011-05-17 18:58:44 +000082 virtual void drawPath(const SkDraw&, const SkPath& origpath,
vandebo@chromium.org02cc5aa2011-01-25 22:06:29 +000083 const SkPaint& paint, const SkMatrix* prePathMatrix,
reed@google.com982cb872011-12-07 18:34:08 +000084 bool pathIsMutable) SK_OVERRIDE;
edisonn@google.com2ae67e72013-02-12 01:06:38 +000085 virtual void drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
86 const SkRect* src, const SkRect& dst,
87 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000088 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
reed@android.comf2b98d62010-12-20 18:26:13 +000089 const SkIRect* srcRectOrNull,
reed@google.com982cb872011-12-07 18:34:08 +000090 const SkMatrix& matrix, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000091 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, int x, int y,
reed@google.com982cb872011-12-07 18:34:08 +000092 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000093 virtual void drawText(const SkDraw&, const void* text, size_t len,
reed@google.com982cb872011-12-07 18:34:08 +000094 SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000095 virtual void drawPosText(const SkDraw&, const void* text, size_t len,
96 const SkScalar pos[], SkScalar constY,
reed@google.com982cb872011-12-07 18:34:08 +000097 int scalarsPerPos, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000098 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
99 const SkPath& path, const SkMatrix* matrix,
reed@google.com982cb872011-12-07 18:34:08 +0000100 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000101 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode,
102 int vertexCount, const SkPoint verts[],
103 const SkPoint texs[], const SkColor colors[],
104 SkXfermode* xmode, const uint16_t indices[],
reed@google.com982cb872011-12-07 18:34:08 +0000105 int indexCount, const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000106 virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
reed@google.com982cb872011-12-07 18:34:08 +0000107 const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000108
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000109 virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
110 virtual void onDetachFromCanvas() SK_OVERRIDE;
111
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000112 enum DrawingArea {
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000113 kContent_DrawingArea, // Drawing area for the page content.
114 kMargin_DrawingArea, // Drawing area for the margin content.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000115 };
116
117 /** Sets the drawing area for the device. Subsequent draw calls are directed
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000118 * to the specific drawing area (margin or content). The default drawing
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000119 * area is the content drawing area.
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000120 *
121 * Currently if margin content is drawn and then a complex (for PDF) xfer
122 * mode is used, like SrcIn, Clear, etc, the margin content will get
123 * clipped. A simple way to avoid the bug is to always draw the margin
124 * content last.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000125 */
epoger@google.com17b78942011-08-26 14:40:38 +0000126 SK_API void setDrawingArea(DrawingArea drawingArea);
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000127
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000128 // PDF specific methods.
129
reed@google.com1feb3302011-07-20 18:43:19 +0000130 /** Returns the resource dictionary for this device.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000131 */
reed@google.com1feb3302011-07-20 18:43:19 +0000132 SK_API SkPDFDict* getResourceDict();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000133
vandebo@chromium.orga5180862010-10-26 19:48:49 +0000134 /** Get the list of resources (PDF objects) used on this page.
edisonn@google.com5bd26d32013-02-28 14:01:44 +0000135 * @param resourceList A list to append the resources to.
vandebo@chromium.org188838c2012-03-09 22:16:58 +0000136 * @param recursive If recursive is true, get the resources of the
137 * device's resources recursively. (Useful for adding
138 * objects to the catalog.)
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000139 */
edisonn@google.com5bd26d32013-02-28 14:01:44 +0000140 SK_API void getResources(SkTDArray<SkPDFObject*>* resourceList,
vandebo@chromium.org188838c2012-03-09 22:16:58 +0000141 bool recursive) const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000142
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000143 /** Get the fonts used on this device.
144 */
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000145 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const;
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000146
epoger@google.comb58772f2013-03-08 09:09:10 +0000147 /** Add our named destinations to the supplied dictionary.
148 * @param dict Dictionary to add destinations to.
149 * @param page The PDF object representing the page for this device.
150 */
151 void appendDestinations(SkPDFDict* dict, SkPDFObject* page);
152
reed@google.com2a006c12012-09-19 17:05:55 +0000153 /** Returns a copy of the media box for this device. The caller is required
154 * to unref() this when it is finished.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000155 */
reed@google.com2a006c12012-09-19 17:05:55 +0000156 SK_API SkPDFArray* copyMediaBox() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000157
reed@google.com2a006c12012-09-19 17:05:55 +0000158 /** Get the annotations from this page, or NULL if there are none.
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000159 */
reed@google.com2a006c12012-09-19 17:05:55 +0000160 SK_API SkPDFArray* getAnnotations() const { return fAnnotations; }
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000161
vandebo@chromium.orgc2a9b7f2011-02-24 23:22:30 +0000162 /** Returns a SkStream with the page contents. The caller is responsible
163 for a reference to the returned value.
reed@google.com5667afc2011-06-27 14:42:15 +0000164 DEPRECATED: use copyContentToData()
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000165 */
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000166 SK_API SkStream* content() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000167
reed@google.com5667afc2011-06-27 14:42:15 +0000168 /** Returns a SkStream with the page contents. The caller is responsible
169 * for calling data->unref() when it is finished.
170 */
171 SK_API SkData* copyContentToData() const;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000172
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000173 SK_API const SkMatrix& initialTransform() const {
174 return fInitialTransform;
175 }
vandebo@chromium.org61d26782011-05-24 23:02:07 +0000176
vandebo@chromium.org98594282011-07-25 22:34:12 +0000177 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font
178 * that shows on this device.
179 */
180 const SkPDFGlyphSetMap& getFontGlyphUsage() const {
181 return *(fFontGlyphUsage.get());
182 }
vandebo@chromium.org74b46192012-01-28 01:45:11 +0000183
bsalomon@google.comc6980972011-11-02 19:57:21 +0000184protected:
reed@google.com982cb872011-12-07 18:34:08 +0000185 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y,
186 SkCanvas::Config8888) SK_OVERRIDE;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000187
reed@google.comb55deeb2012-01-06 14:43:09 +0000188 virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
189
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000190private:
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000191 // TODO(vandebo): push most of SkPDFDevice's state into a core object in
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000192 // order to get the right access levels without using friend.
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000193 friend class ScopedContentEntry;
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000194
ctguil@chromium.org15261292011-04-29 17:54:16 +0000195 SkISize fPageSize;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000196 SkISize fContentSize;
vandebo@chromium.org75f97e42011-04-11 23:24:18 +0000197 SkMatrix fInitialTransform;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000198 SkClipStack fExistingClipStack;
199 SkRegion fExistingClipRegion;
reed@google.com2a006c12012-09-19 17:05:55 +0000200 SkPDFArray* fAnnotations;
reed@google.comfc641d02012-09-20 17:52:20 +0000201 SkPDFDict* fResourceDict;
epoger@google.comb58772f2013-03-08 09:09:10 +0000202 SkTDArray<NamedDestination*> fNamedDestinations;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000203
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000204 SkTDArray<SkPDFGraphicState*> fGraphicStateResources;
205 SkTDArray<SkPDFObject*> fXObjectResources;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +0000206 SkTDArray<SkPDFFont*> fFontResources;
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000207 SkTDArray<SkPDFObject*> fShaderResources;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000208
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000209 SkTScopedPtr<ContentEntry> fContentEntries;
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000210 ContentEntry* fLastContentEntry;
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000211 SkTScopedPtr<ContentEntry> fMarginContentEntries;
212 ContentEntry* fLastMarginContentEntry;
213 DrawingArea fDrawingArea;
214
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000215 const SkClipStack* fClipStack;
216
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000217 // Accessor and setter functions based on the current DrawingArea.
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000218 SkTScopedPtr<ContentEntry>* getContentEntries();
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000219 ContentEntry* getLastContentEntry();
220 void setLastContentEntry(ContentEntry* contentEntry);
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000221
vandebo@chromium.org98594282011-07-25 22:34:12 +0000222 // Glyph ids used for each font on this device.
223 SkTScopedPtr<SkPDFGlyphSetMap> fFontGlyphUsage;
224
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000225 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack,
226 const SkRegion& existingClipRegion);
227
bsalomon@google.come97f0852011-06-17 13:10:25 +0000228 // override from SkDevice
vandebo@chromium.org98594282011-07-25 22:34:12 +0000229 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
230 int width, int height,
bsalomon@google.come97f0852011-06-17 13:10:25 +0000231 bool isOpaque,
reed@google.com982cb872011-12-07 18:34:08 +0000232 Usage usage) SK_OVERRIDE;
bsalomon@google.come97f0852011-06-17 13:10:25 +0000233
vandebo@chromium.org77bcaa32011-04-15 20:57:37 +0000234 void init();
vandebo@chromium.org98594282011-07-25 22:34:12 +0000235 void cleanUp(bool clearFontUsage);
reed@google.comfc641d02012-09-20 17:52:20 +0000236 SkPDFFormXObject* createFormXObjectFromDevice();
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000237
vandebo@chromium.org466f3d62011-05-18 23:06:29 +0000238 // Clear the passed clip from all existing content entries.
239 void clearClipFromContent(const SkClipStack* clipStack,
240 const SkRegion& clipRegion);
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000241 void drawFormXObjectWithClip(SkPDFFormXObject* form,
242 const SkClipStack* clipStack,
243 const SkRegion& clipRegion,
244 bool invertClip);
vandebo@chromium.org466f3d62011-05-18 23:06:29 +0000245
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000246 // If the paint or clip is such that we shouldn't draw anything, this
247 // returns NULL and does not create a content entry.
248 // setUpContentEntry and finishContentEntry can be used directly, but
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000249 // the preferred method is to use the ScopedContentEntry helper class.
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000250 ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
251 const SkRegion& clipRegion,
252 const SkMatrix& matrix,
253 const SkPaint& paint,
254 bool hasText,
reed@google.comfc641d02012-09-20 17:52:20 +0000255 SkPDFFormXObject** dst);
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000256 void finishContentEntry(SkXfermode::Mode xfermode,
257 SkPDFFormXObject* dst);
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000258 bool isContentEmpty();
259
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000260 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix,
261 const SkClipStack& clipStack,
262 const SkRegion& clipRegion,
263 const SkPaint& paint,
264 bool hasText,
265 GraphicStateEntry* entry);
vandebo@chromium.org6112c212011-05-13 03:50:38 +0000266 int addGraphicStateResource(SkPDFGraphicState* gs);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000267
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000268 void updateFont(const SkPaint& paint, uint16_t glyphID,
269 ContentEntry* contentEntry);
ctguil@chromium.org9db86bb2011-03-04 21:43:27 +0000270 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID);
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000271
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000272 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000273 void internalDrawBitmap(const SkMatrix& matrix,
vandebo@chromium.org78dad542011-05-11 18:46:03 +0000274 const SkClipStack* clipStack,
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000275 const SkRegion& clipRegion,
276 const SkBitmap& bitmap,
277 const SkIRect* srcRect,
278 const SkPaint& paint);
279
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000280 /** Helper method for copyContentToData. It is responsible for copying the
281 * list of content entries |entry| to |data|.
282 */
283 void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000284
epoger@google.comb58772f2013-03-08 09:09:10 +0000285 bool handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
286 const SkPaint& paint);
287 bool handlePointAnnotation(const SkPoint* points, size_t count,
288 const SkMatrix& matrix, const SkPaint& paint);
289 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix);
290 void handleLinkToURL(SkData* urlData, const SkRect& r,
291 const SkMatrix& matrix);
292 void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
293 const SkMatrix& matrix);
294 void defineNamedDestination(SkData* nameData, const SkPoint& point,
295 const SkMatrix& matrix);
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000296
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000297 typedef SkDevice INHERITED;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000298};
299
300#endif