OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 /** Replace the current matrix with a copy of the specified matrix. | 445 /** Replace the current matrix with a copy of the specified matrix. |
446 @param matrix The matrix that will be copied into the current matrix. | 446 @param matrix The matrix that will be copied into the current matrix. |
447 */ | 447 */ |
448 void setMatrix(const SkMatrix& matrix); | 448 void setMatrix(const SkMatrix& matrix); |
449 | 449 |
450 /** Helper for setMatrix(identity). Sets the current matrix to identity. | 450 /** Helper for setMatrix(identity). Sets the current matrix to identity. |
451 */ | 451 */ |
452 void resetMatrix(); | 452 void resetMatrix(); |
453 | 453 |
454 /** Set the current draw depth of the canvas. | |
455 @param z The SkScalar depth; it's tracked in the save/restore stack. | |
456 Negative into screen, positive out of screen. | |
457 Defaults to 0. | |
458 */ | |
459 void translateZ(SkScalar z); | |
460 | |
461 /** | 454 /** |
462 * Modify the current clip with the specified rectangle. | 455 * Modify the current clip with the specified rectangle. |
463 * @param rect The rect to combine with the current clip | 456 * @param rect The rect to combine with the current clip |
464 * @param op The region op to apply to the current clip | 457 * @param op The region op to apply to the current clip |
465 * @param doAntiAlias true if the clip should be antialiased | 458 * @param doAntiAlias true if the clip should be antialiased |
466 */ | 459 */ |
467 void clipRect(const SkRect& rect, | 460 void clipRect(const SkRect& rect, |
468 SkRegion::Op op = SkRegion::kIntersect_Op, | 461 SkRegion::Op op = SkRegion::kIntersect_Op, |
469 bool doAntiAlias = false); | 462 bool doAntiAlias = false); |
470 | 463 |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 const SkPaint* paint, | 1253 const SkPaint* paint, |
1261 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); | 1254 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); |
1262 | 1255 |
1263 // expose minimum amount of information necessary for transitional refactori
ng | 1256 // expose minimum amount of information necessary for transitional refactori
ng |
1264 /** | 1257 /** |
1265 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. | 1258 * Returns CTM and clip bounds, translated from canvas coordinates to top la
yer coordinates. |
1266 */ | 1259 */ |
1267 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); | 1260 void temporary_internal_describeTopLayer(SkMatrix* matrix, SkIRect* clip_bou
nds); |
1268 | 1261 |
1269 protected: | 1262 protected: |
1270 /** Returns the current (cumulative) draw depth of the canvas. | |
1271 */ | |
1272 SkScalar getZ() const; | |
1273 | |
1274 /** After calling saveLayer(), there can be any number of devices that make | 1263 /** After calling saveLayer(), there can be any number of devices that make |
1275 up the top-most drawing area. LayerIter can be used to iterate through | 1264 up the top-most drawing area. LayerIter can be used to iterate through |
1276 those devices. Note that the iterator is only valid until the next API | 1265 those devices. Note that the iterator is only valid until the next API |
1277 call made on the canvas. Ownership of all pointers in the iterator stays | 1266 call made on the canvas. Ownership of all pointers in the iterator stays |
1278 with the canvas, so none of them should be modified or deleted. | 1267 with the canvas, so none of them should be modified or deleted. |
1279 */ | 1268 */ |
1280 class LayerIter /*: SkNoncopyable*/ { | 1269 class LayerIter /*: SkNoncopyable*/ { |
1281 public: | 1270 public: |
1282 /** Initialize iterator with canvas, and set values for 1st device */ | 1271 /** Initialize iterator with canvas, and set values for 1st device */ |
1283 LayerIter(SkCanvas*, bool skipEmptyClips); | 1272 LayerIter(SkCanvas*, bool skipEmptyClips); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 | 1318 |
1330 virtual void willSave() {} | 1319 virtual void willSave() {} |
1331 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1320 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
1332 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1321 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
1333 return kFullLayer_SaveLayerStrategy; | 1322 return kFullLayer_SaveLayerStrategy; |
1334 } | 1323 } |
1335 virtual void willRestore() {} | 1324 virtual void willRestore() {} |
1336 virtual void didRestore() {} | 1325 virtual void didRestore() {} |
1337 virtual void didConcat(const SkMatrix&) {} | 1326 virtual void didConcat(const SkMatrix&) {} |
1338 virtual void didSetMatrix(const SkMatrix&) {} | 1327 virtual void didSetMatrix(const SkMatrix&) {} |
1339 virtual void didTranslateZ(SkScalar) {} | |
1340 | 1328 |
1341 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); | 1329 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); |
1342 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1330 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
1343 | 1331 |
1344 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1332 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
1345 SkScalar y, const SkPaint& paint); | 1333 SkScalar y, const SkPaint& paint); |
1346 | 1334 |
1347 virtual void onDrawPosText(const void* text, size_t byteLength, | 1335 virtual void onDrawPosText(const void* text, size_t byteLength, |
1348 const SkPoint pos[], const SkPaint& paint); | 1336 const SkPoint pos[], const SkPaint& paint); |
1349 | 1337 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 | 1605 |
1618 class SkCanvasClipVisitor { | 1606 class SkCanvasClipVisitor { |
1619 public: | 1607 public: |
1620 virtual ~SkCanvasClipVisitor(); | 1608 virtual ~SkCanvasClipVisitor(); |
1621 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1609 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1622 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1610 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1623 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1611 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1624 }; | 1612 }; |
1625 | 1613 |
1626 #endif | 1614 #endif |
OLD | NEW |