| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkJSONCanvas_DEFINED | 8 #ifndef SkJSONCanvas_DEFINED |
| 9 #define SkJSONCanvas_DEFINED | 9 #define SkJSONCanvas_DEFINED |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #define SKJSONCANVAS_ATTRIBUTE_COORDS "coords" | 51 #define SKJSONCANVAS_ATTRIBUTE_COORDS "coords" |
| 52 #define SKJSONCANVAS_ATTRIBUTE_BOUNDS "bounds" | 52 #define SKJSONCANVAS_ATTRIBUTE_BOUNDS "bounds" |
| 53 #define SKJSONCANVAS_ATTRIBUTE_PAINT "paint" | 53 #define SKJSONCANVAS_ATTRIBUTE_PAINT "paint" |
| 54 #define SKJSONCANVAS_ATTRIBUTE_OUTER "outer" | 54 #define SKJSONCANVAS_ATTRIBUTE_OUTER "outer" |
| 55 #define SKJSONCANVAS_ATTRIBUTE_INNER "inner" | 55 #define SKJSONCANVAS_ATTRIBUTE_INNER "inner" |
| 56 #define SKJSONCANVAS_ATTRIBUTE_MODE "mode" | 56 #define SKJSONCANVAS_ATTRIBUTE_MODE "mode" |
| 57 #define SKJSONCANVAS_ATTRIBUTE_POINTS "points" | 57 #define SKJSONCANVAS_ATTRIBUTE_POINTS "points" |
| 58 #define SKJSONCANVAS_ATTRIBUTE_PATH "path" | 58 #define SKJSONCANVAS_ATTRIBUTE_PATH "path" |
| 59 #define SKJSONCANVAS_ATTRIBUTE_TEXT "text" | 59 #define SKJSONCANVAS_ATTRIBUTE_TEXT "text" |
| 60 #define SKJSONCANVAS_ATTRIBUTE_COLOR "color" | 60 #define SKJSONCANVAS_ATTRIBUTE_COLOR "color" |
| 61 #define SKJSONCANVAS_ATTRIBUTE_ALPHA "alpha" |
| 61 #define SKJSONCANVAS_ATTRIBUTE_STYLE "style" | 62 #define SKJSONCANVAS_ATTRIBUTE_STYLE "style" |
| 62 #define SKJSONCANVAS_ATTRIBUTE_STROKEWIDTH "strokeWidth" | 63 #define SKJSONCANVAS_ATTRIBUTE_STROKEWIDTH "strokeWidth" |
| 63 #define SKJSONCANVAS_ATTRIBUTE_STROKEMITER "strokeMiter" | 64 #define SKJSONCANVAS_ATTRIBUTE_STROKEMITER "strokeMiter" |
| 64 #define SKJSONCANVAS_ATTRIBUTE_CAP "cap" | 65 #define SKJSONCANVAS_ATTRIBUTE_CAP "cap" |
| 65 #define SKJSONCANVAS_ATTRIBUTE_ANTIALIAS "antiAlias" | 66 #define SKJSONCANVAS_ATTRIBUTE_ANTIALIAS "antiAlias" |
| 66 #define SKJSONCANVAS_ATTRIBUTE_REGION "region" | 67 #define SKJSONCANVAS_ATTRIBUTE_REGION "region" |
| 67 #define SKJSONCANVAS_ATTRIBUTE_REGIONOP "op" | 68 #define SKJSONCANVAS_ATTRIBUTE_REGIONOP "op" |
| 68 #define SKJSONCANVAS_ATTRIBUTE_EDGESTYLE "edgeStyle" | 69 #define SKJSONCANVAS_ATTRIBUTE_EDGESTYLE "edgeStyle" |
| 69 #define SKJSONCANVAS_ATTRIBUTE_DEVICEREGION "deviceRegion" | 70 #define SKJSONCANVAS_ATTRIBUTE_DEVICEREGION "deviceRegion" |
| 70 #define SKJSONCANVAS_ATTRIBUTE_BLUR "blur" | 71 #define SKJSONCANVAS_ATTRIBUTE_BLUR "blur" |
| 71 #define SKJSONCANVAS_ATTRIBUTE_SIGMA "sigma" | 72 #define SKJSONCANVAS_ATTRIBUTE_SIGMA "sigma" |
| 72 #define SKJSONCANVAS_ATTRIBUTE_QUALITY "quality" | 73 #define SKJSONCANVAS_ATTRIBUTE_QUALITY "quality" |
| 73 #define SKJSONCANVAS_ATTRIBUTE_TEXTALIGN "textAlign" | 74 #define SKJSONCANVAS_ATTRIBUTE_TEXTALIGN "textAlign" |
| 74 #define SKJSONCANVAS_ATTRIBUTE_TEXTSIZE "textSize" | 75 #define SKJSONCANVAS_ATTRIBUTE_TEXTSIZE "textSize" |
| 75 #define SKJSONCANVAS_ATTRIBUTE_TEXTSCALEX "textScaleX" | 76 #define SKJSONCANVAS_ATTRIBUTE_TEXTSCALEX "textScaleX" |
| 76 #define SKJSONCANVAS_ATTRIBUTE_TEXTSKEWX "textSkewX" | 77 #define SKJSONCANVAS_ATTRIBUTE_TEXTSKEWX "textSkewX" |
| 77 #define SKJSONCANVAS_ATTRIBUTE_DASHING "dashing" | 78 #define SKJSONCANVAS_ATTRIBUTE_DASHING "dashing" |
| 78 #define SKJSONCANVAS_ATTRIBUTE_INTERVALS "intervals" | 79 #define SKJSONCANVAS_ATTRIBUTE_INTERVALS "intervals" |
| 79 #define SKJSONCANVAS_ATTRIBUTE_PHASE "phase" | 80 #define SKJSONCANVAS_ATTRIBUTE_PHASE "phase" |
| 80 #define SKJSONCANVAS_ATTRIBUTE_FILLTYPE "fillType" | 81 #define SKJSONCANVAS_ATTRIBUTE_FILLTYPE "fillType" |
| 81 #define SKJSONCANVAS_ATTRIBUTE_VERBS "verbs" | 82 #define SKJSONCANVAS_ATTRIBUTE_VERBS "verbs" |
| 82 #define SKJSONCANVAS_ATTRIBUTE_NAME "name" | 83 #define SKJSONCANVAS_ATTRIBUTE_NAME "name" |
| 83 #define SKJSONCANVAS_ATTRIBUTE_BYTES "bytes" | 84 #define SKJSONCANVAS_ATTRIBUTE_BYTES "bytes" |
| 84 #define SKJSONCANVAS_ATTRIBUTE_SHADER "shader" | 85 #define SKJSONCANVAS_ATTRIBUTE_SHADER "shader" |
| 85 #define SKJSONCANVAS_ATTRIBUTE_PATHEFFECT "pathEffect" | 86 #define SKJSONCANVAS_ATTRIBUTE_PATHEFFECT "pathEffect" |
| 86 #define SKJSONCANVAS_ATTRIBUTE_MASKFILTER "maskFilter" | 87 #define SKJSONCANVAS_ATTRIBUTE_MASKFILTER "maskFilter" |
| 87 #define SKJSONCANVAS_ATTRIBUTE_XFERMODE "xfermode" | 88 #define SKJSONCANVAS_ATTRIBUTE_XFERMODE "xfermode" |
| 88 #define SKJSONCANVAS_ATTRIBUTE_BACKDROP "backdrop" | 89 #define SKJSONCANVAS_ATTRIBUTE_BACKDROP "backdrop" |
| 90 #define SKJSONCANVAS_ATTRIBUTE_IMAGEFILTER "imagefilter" |
| 89 #define SKJSONCANVAS_ATTRIBUTE_IMAGE "image" | 91 #define SKJSONCANVAS_ATTRIBUTE_IMAGE "image" |
| 90 #define SKJSONCANVAS_ATTRIBUTE_BITMAP "bitmap" | 92 #define SKJSONCANVAS_ATTRIBUTE_BITMAP "bitmap" |
| 91 #define SKJSONCANVAS_ATTRIBUTE_SRC "src" | 93 #define SKJSONCANVAS_ATTRIBUTE_SRC "src" |
| 92 #define SKJSONCANVAS_ATTRIBUTE_DST "dst" | 94 #define SKJSONCANVAS_ATTRIBUTE_DST "dst" |
| 93 #define SKJSONCANVAS_ATTRIBUTE_STRICT "strict" | 95 #define SKJSONCANVAS_ATTRIBUTE_STRICT "strict" |
| 94 #define SKJSONCANVAS_ATTRIBUTE_DESCRIPTION "description" | 96 #define SKJSONCANVAS_ATTRIBUTE_DESCRIPTION "description" |
| 95 | 97 |
| 96 #define SKJSONCANVAS_VERB_MOVE "move" | 98 #define SKJSONCANVAS_VERB_MOVE "move" |
| 97 #define SKJSONCANVAS_VERB_LINE "line" | 99 #define SKJSONCANVAS_VERB_LINE "line" |
| 98 #define SKJSONCANVAS_VERB_QUAD "quad" | 100 #define SKJSONCANVAS_VERB_QUAD "quad" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 129 | 131 |
| 130 #define SKJSONCANVAS_FILLTYPE_WINDING "winding" | 132 #define SKJSONCANVAS_FILLTYPE_WINDING "winding" |
| 131 #define SKJSONCANVAS_FILLTYPE_EVENODD "evenOdd" | 133 #define SKJSONCANVAS_FILLTYPE_EVENODD "evenOdd" |
| 132 #define SKJSONCANVAS_FILLTYPE_INVERSEWINDING "inverseWinding" | 134 #define SKJSONCANVAS_FILLTYPE_INVERSEWINDING "inverseWinding" |
| 133 #define SKJSONCANVAS_FILLTYPE_INVERSEEVENODD "inverseEvenOdd" | 135 #define SKJSONCANVAS_FILLTYPE_INVERSEEVENODD "inverseEvenOdd" |
| 134 | 136 |
| 135 #define SKJSONCANVAS_CAP_BUTT "butt" | 137 #define SKJSONCANVAS_CAP_BUTT "butt" |
| 136 #define SKJSONCANVAS_CAP_ROUND "round" | 138 #define SKJSONCANVAS_CAP_ROUND "round" |
| 137 #define SKJSONCANVAS_CAP_SQUARE "square" | 139 #define SKJSONCANVAS_CAP_SQUARE "square" |
| 138 | 140 |
| 141 #define SKJSONCANVAS_COLORTYPE_ARGB4444 "ARGB4444" |
| 142 #define SKJSONCANVAS_COLORTYPE_RGBA8888 "RGBA8888" |
| 143 #define SKJSONCANVAS_COLORTYPE_BGRA8888 "BGRA8888" |
| 144 #define SKJSONCANVAS_COLORTYPE_565 "565" |
| 145 #define SKJSONCANVAS_COLORTYPE_GRAY8 "Gray8" |
| 146 #define SKJSONCANVAS_COLORTYPE_INDEX8 "Index8" |
| 147 #define SKJSONCANVAS_COLORTYPE_ALPHA8 "Alpha8" |
| 148 |
| 149 #define SKJSONCANVAS_ALPHATYPE_OPAQUE "opaque" |
| 150 #define SKJSONCANVAS_ALPHATYPE_PREMUL "premul" |
| 151 #define SKJSONCANVAS_ALPHATYPE_UNPREMUL "unpremul" |
| 152 |
| 139 /* | 153 /* |
| 140 * Implementation of SkCanvas which writes JSON when drawn to. The JSON describe
s all of the draw | 154 * Implementation of SkCanvas which writes JSON when drawn to. The JSON describe
s all of the draw |
| 141 * commands issued to the canvas, and can later be turned back into draw command
s using | 155 * commands issued to the canvas, and can later be turned back into draw command
s using |
| 142 * SkJSONRenderer. Be sure to call finish() when you are done drawing. | 156 * SkJSONRenderer. Be sure to call finish() when you are done drawing. |
| 143 */ | 157 */ |
| 144 class SkJSONCanvas : public SkCanvas { | 158 class SkJSONCanvas : public SkCanvas { |
| 145 public: | 159 public: |
| 146 /* Create a canvas which writes to the specified output stream. */ | 160 /* Create a canvas which writes to the specified output stream. */ |
| 147 SkJSONCanvas(int width, int height, SkWStream& out, bool sendBinaries = fals
e); | 161 SkJSONCanvas(int width, int height, SkWStream& out, bool sendBinaries = fals
e); |
| 148 | 162 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 SkWStream& fOut; | 267 SkWStream& fOut; |
| 254 SkMatrix fLastMatrix; | 268 SkMatrix fLastMatrix; |
| 255 Json::Value fRoot; | 269 Json::Value fRoot; |
| 256 Json::Value fCommands; | 270 Json::Value fCommands; |
| 257 bool fSendBinaries; | 271 bool fSendBinaries; |
| 258 | 272 |
| 259 typedef SkCanvas INHERITED; | 273 typedef SkCanvas INHERITED; |
| 260 }; | 274 }; |
| 261 | 275 |
| 262 #endif | 276 #endif |
| OLD | NEW |