Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: include/core/SkCanvas.h

Issue 933483002: add Method param to drawTextOnPath, supporting SVG spec Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkClipStack.h" 14 #include "SkClipStack.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkRegion.h" 18 #include "SkRegion.h"
19 #include "SkSurfaceProps.h" 19 #include "SkSurfaceProps.h"
20 #include "SkXfermode.h" 20 #include "SkXfermode.h"
21 21
22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
23 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM
24 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_ARG
25 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD \
26 SkCanvas::TextOnPathMethod method = SkCanvas::kStretch_TextOnPathMethod;
27 #else
28 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM SkCanvas::TextOnPath Method method,
29 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_ARG method,
30 #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD
31 #endif
32
22 class SkBaseDevice; 33 class SkBaseDevice;
23 class SkCanvasClipVisitor; 34 class SkCanvasClipVisitor;
24 class SkDraw; 35 class SkDraw;
25 class SkDrawable; 36 class SkDrawable;
26 class SkDrawFilter; 37 class SkDrawFilter;
27 class SkImage; 38 class SkImage;
28 class SkMetaData; 39 class SkMetaData;
29 class SkPicture; 40 class SkPicture;
30 class SkRRect; 41 class SkRRect;
31 class SkSurface; 42 class SkSurface;
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 The origin is interpreted by the Align setting in the paint. 913 The origin is interpreted by the Align setting in the paint.
903 @param text The text to be drawn 914 @param text The text to be drawn
904 @param byteLength The number of bytes to read from the text parameter 915 @param byteLength The number of bytes to read from the text parameter
905 @param xpos Array of x-positions, used to position each character 916 @param xpos Array of x-positions, used to position each character
906 @param constY The shared Y coordinate for all of the positions 917 @param constY The shared Y coordinate for all of the positions
907 @param paint The paint used for the text (e.g. color, size, style) 918 @param paint The paint used for the text (e.g. color, size, style)
908 */ 919 */
909 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY, 920 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY,
910 const SkPaint& paint); 921 const SkPaint& paint);
911 922
923 #ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
912 /** Draw the text, with origin at (x,y), using the specified paint, along 924 /** Draw the text, with origin at (x,y), using the specified paint, along
913 the specified path. The paint's Align setting determins where along the 925 the specified path. The paint's Align setting determins where along the
914 path to start the text. 926 path to start the text.
915 @param text The text to be drawn 927 @param text The text to be drawn
916 @param byteLength The number of bytes to read from the text parameter 928 @param byteLength The number of bytes to read from the text parameter
917 @param path The path the text should follow for its baseline 929 @param path The path the text should follow for its baseline
918 @param hOffset The distance along the path to add to the text's 930 @param trangentOffset The distance along the path to add to the text's
919 starting position 931 starting position
920 @param vOffset The distance above(-) or below(+) the path to 932 @param normalOffset The distance above(-) or below(+) the path to
921 position the text 933 position the text
922 @param paint The paint used for the text 934 @param paint The paint used for the text
923 */ 935 */
924 void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& pat h, SkScalar hOffset, 936 void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& pat h,
925 SkScalar vOffset, const SkPaint& paint); 937 SkScalar trangentOffset, SkScalar normalOffset, const SkPaint& paint);
926 938
927 /** Draw the text, with origin at (x,y), using the specified paint, along 939 /** Draw the text, with origin at (x,y), using the specified paint, along
928 the specified path. The paint's Align setting determins where along the 940 the specified path. The paint's Align setting determins where along the
929 path to start the text. 941 path to start the text.
930 @param text The text to be drawn 942 @param text The text to be drawn
931 @param byteLength The number of bytes to read from the text parameter 943 @param byteLength The number of bytes to read from the text parameter
932 @param path The path the text should follow for its baseline 944 @param path The path the text should follow for its baseline
933 @param matrix (may be null) Applied to the text before it is 945 @param matrix (may be null) Applied to the text before it is
934 mapped onto the path 946 mapped onto the path
935 @param paint The paint used for the text 947 @param paint The paint used for the text
936 */ 948 */
937 void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 949 void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
938 const SkMatrix* matrix, const SkPaint& paint); 950 const SkMatrix* matrix, const SkPaint& paint);
951 #endif
952
953 enum TextOnPathMethod {
954 kStretch_TextOnPathMethod, //!< warp the shape of each glyph to match t he path
955 kAlign_TextOnPathMethod //!< rotate each glyph to align with the pat h's direction
956 };
957
958 /**
959 * Draw the text, with origin at (x,y), using the specified paint, along
960 * the specified path. The paint's Align setting determins where along the
961 * path to start the text.
962 * @param text The text to be drawn
963 * @param byteLength The number of bytes to read from the text parameter
964 * @param path The path the text should follow for its baseline
965 * @param matrix (may be null) Applied to the text before it is mappe d onto the path
966 * @param method How to orient/warp each glyph along the path.
967 * @param paint The paint used for the text
968 */
969 void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
970 const SkMatrix* matrix, TextOnPathMethod, const SkPaint& paint);
939 971
940 /** Draw the text blob, offset by (x,y), using the specified paint. 972 /** Draw the text blob, offset by (x,y), using the specified paint.
941 @param blob The text blob to be drawn 973 @param blob The text blob to be drawn
942 @param x The x-offset of the text being drawn 974 @param x The x-offset of the text being drawn
943 @param y The y-offset of the text being drawn 975 @param y The y-offset of the text being drawn
944 @param paint The paint used for the text (e.g. color, size, style) 976 @param paint The paint used for the text (e.g. color, size, style)
945 */ 977 */
946 void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPa int& paint); 978 void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPa int& paint);
947 979
948 /** Draw the picture into this canvas. This method effective brackets the 980 /** Draw the picture into this canvas. This method effective brackets the
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 1213
1182 virtual void onDrawPosText(const void* text, size_t byteLength, 1214 virtual void onDrawPosText(const void* text, size_t byteLength,
1183 const SkPoint pos[], const SkPaint& paint); 1215 const SkPoint pos[], const SkPaint& paint);
1184 1216
1185 virtual void onDrawPosTextH(const void* text, size_t byteLength, 1217 virtual void onDrawPosTextH(const void* text, size_t byteLength,
1186 const SkScalar xpos[], SkScalar constY, 1218 const SkScalar xpos[], SkScalar constY,
1187 const SkPaint& paint); 1219 const SkPaint& paint);
1188 1220
1189 virtual void onDrawTextOnPath(const void* text, size_t byteLength, 1221 virtual void onDrawTextOnPath(const void* text, size_t byteLength,
1190 const SkPath& path, const SkMatrix* matrix, 1222 const SkPath& path, const SkMatrix* matrix,
1223 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM
1191 const SkPaint& paint); 1224 const SkPaint& paint);
1192 1225
1193 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 1226 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
1194 const SkPaint& paint); 1227 const SkPaint& paint);
1195 1228
1196 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 1229 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
1197 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint); 1230 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
1198 1231
1199 virtual void onDrawDrawable(SkDrawable*); 1232 virtual void onDrawDrawable(SkDrawable*);
1200 1233
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 1533
1501 class SkCanvasClipVisitor { 1534 class SkCanvasClipVisitor {
1502 public: 1535 public:
1503 virtual ~SkCanvasClipVisitor(); 1536 virtual ~SkCanvasClipVisitor();
1504 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1537 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1505 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1538 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1506 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1539 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1507 }; 1540 };
1508 1541
1509 #endif 1542 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698