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

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

Issue 1654883003: add helper to create fancy underlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: correct comment to multiply by two Created 4 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 | « gm/texteffects.cpp ('k') | src/core/SkGlyph.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 SkPaint_DEFINED 8 #ifndef SkPaint_DEFINED
9 #define SkPaint_DEFINED 9 #define SkPaint_DEFINED
10 10
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 * the glyphs. If not NULL, must be at least a large 878 * the glyphs. If not NULL, must be at least a large
879 * as the number of unichars in the specified text. 879 * as the number of unichars in the specified text.
880 * @param bounds If not null, returns the bounds for each of 880 * @param bounds If not null, returns the bounds for each of
881 * character, relative to (0, 0) 881 * character, relative to (0, 0)
882 * @return the number of unichars in the specified text. 882 * @return the number of unichars in the specified text.
883 */ 883 */
884 int getTextWidths(const void* text, size_t byteLength, SkScalar widths[], 884 int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
885 SkRect bounds[] = NULL) const; 885 SkRect bounds[] = NULL) const;
886 886
887 /** Return the path (outline) for the specified text. 887 /** Return the path (outline) for the specified text.
888 Note: just like SkCanvas::drawText, this will respect the Align setting 888 * Note: just like SkCanvas::drawText, this will respect the Align setting
889 in the paint. 889 * in the paint.
890 */ 890 *
891 * @param text the text
892 * @param length number of bytes of text
893 * @param x The x-coordinate of the origin of the text.
894 * @param y The y-coordinate of the origin of the text.
895 * @param path The outline of the text.
896 */
891 void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y, 897 void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
892 SkPath* path) const; 898 SkPath* path) const;
893 899
900 /** Return the path (outline) for the specified text.
901 * Note: just like SkCanvas::drawText, this will respect the Align setting
902 * in the paint.
903 *
904 * @param text the text
905 * @param length number of bytes of text
906 * @param pos array of positions, used to position each character
907 * @param path The outline of the text.
908 */
894 void getPosTextPath(const void* text, size_t length, 909 void getPosTextPath(const void* text, size_t length,
895 const SkPoint pos[], SkPath* path) const; 910 const SkPoint pos[], SkPath* path) const;
896 911
912 /** Return the number of intervals that intersect the intercept along the ax is of the advance.
913 * The return count is zero or a multiple of two, and is at most the number of glyphs * 2 in
914 * the string. The caller may pass nullptr for intervals to determine the s ize of the interval
915 * array, or may conservatively pre-allocate an array with length * 2 entri es. The computed
916 * intervals are cached by glyph to improve performance for multiple calls.
917 * This permits constructing an underline that skips the descenders.
918 *
919 * @param text the text
920 * @param length number of bytes of text
921 * @param x The x-coordinate of the origin of the text.
922 * @param y The y-coordinate of the origin of the text.
923 * @param bounds The lower and upper line parallel to the advance.
924 * @param array If not null, the found intersections.
925 *
926 * @return The number of intersections, which may be zero.
927 */
928 int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
929 const SkScalar bounds[2], SkScalar* intervals) const;
930
931 /** Return the number of intervals that intersect the intercept along the ax is of the advance.
932 * The return count is zero or a multiple of two, and is at most the number of glyphs * 2 in
933 * string. The caller may pass nullptr for intervals to determine the size of the interval
934 * array, or may conservatively pre-allocate an array with length * 2 entri es. The computed
935 * intervals are cached by glyph to improve performance for multiple calls.
936 * This permits constructing an underline that skips the descenders.
937 *
938 * @param text the text
939 * @param length number of bytes of text
940 * @param pos array of positions, used to position each character
941 * @param bounds The lower and upper line parallel to the advance.
942 * @param array If not null, the glyph bounds contained by the advan ce parallel lines.
943 *
944 * @return The number of intersections, which may be zero.
945 */
946 int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[ ],
947 const SkScalar bounds[2], SkScalar* intervals) cons t;
948
897 /** 949 /**
898 * Return a rectangle that represents the union of the bounds of all 950 * Return a rectangle that represents the union of the bounds of all
899 * of the glyphs, but each one positioned at (0,0). This may be conservativ ely large, and 951 * of the glyphs, but each one positioned at (0,0). This may be conservativ ely large, and
900 * will not take into account any hinting, but will respect any text-scale- x or text-skew-x 952 * will not take into account any hinting, but will respect any text-scale- x or text-skew-x
901 * on this paint. 953 * on this paint.
902 */ 954 */
903 SkRect getFontBounds() const; 955 SkRect getFontBounds() const;
904 956
905 // returns true if the paint's settings (e.g. xfermode + alpha) resolve to 957 // returns true if the paint's settings (e.g. xfermode + alpha) resolve to
906 // mean that we need not draw at all (e.g. SrcOver + 0-alpha) 958 // mean that we need not draw at all (e.g. SrcOver + 0-alpha)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 friend class SkCanvas; 1136 friend class SkCanvas;
1085 friend class SkDraw; 1137 friend class SkDraw;
1086 friend class SkPDFDevice; 1138 friend class SkPDFDevice;
1087 friend class GrAtlasTextBlob; 1139 friend class GrAtlasTextBlob;
1088 friend class GrAtlasTextContext; 1140 friend class GrAtlasTextContext;
1089 friend class GrStencilAndCoverTextContext; 1141 friend class GrStencilAndCoverTextContext;
1090 friend class GrPathRendering; 1142 friend class GrPathRendering;
1091 friend class GrTextUtils; 1143 friend class GrTextUtils;
1092 friend class GrGLPathRendering; 1144 friend class GrGLPathRendering;
1093 friend class SkScalerContext; 1145 friend class SkScalerContext;
1094 friend class SkTextToPathIter; 1146 friend class SkTextBaseIter;
1095 friend class SkCanonicalizePaint; 1147 friend class SkCanonicalizePaint;
1096 }; 1148 };
1097 1149
1098 #endif 1150 #endif
OLDNEW
« no previous file with comments | « gm/texteffects.cpp ('k') | src/core/SkGlyph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698