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

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: less dense again (me, not the code) 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
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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 * the glyphs. If not NULL, must be at least a large 876 * the glyphs. If not NULL, must be at least a large
877 * as the number of unichars in the specified text. 877 * as the number of unichars in the specified text.
878 * @param bounds If not null, returns the bounds for each of 878 * @param bounds If not null, returns the bounds for each of
879 * character, relative to (0, 0) 879 * character, relative to (0, 0)
880 * @return the number of unichars in the specified text. 880 * @return the number of unichars in the specified text.
881 */ 881 */
882 int getTextWidths(const void* text, size_t byteLength, SkScalar widths[], 882 int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
883 SkRect bounds[] = NULL) const; 883 SkRect bounds[] = NULL) const;
884 884
885 /** Return the path (outline) for the specified text. 885 /** Return the path (outline) for the specified text.
886 Note: just like SkCanvas::drawText, this will respect the Align setting 886 * Note: just like SkCanvas::drawText, this will respect the Align setting
887 in the paint. 887 * in the paint.
888 */ 888 *
889 * @param text the text
890 * @param length number of bytes of text
891 * @param x The x-coordinate of the origin of the text.
892 * @param y The y-coordinate of the origin of the text.
893 * @param path The outline of the text.
894 */
889 void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y, 895 void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
890 SkPath* path) const; 896 SkPath* path) const;
891 897
898 /** Return the path (outline) for the specified text.
899 * Note: just like SkCanvas::drawText, this will respect the Align setting
900 * in the paint.
901 *
902 * @param text the text
903 * @param length number of bytes of text
904 * @param pos array of positions, used to position each character
905 * @param path The outline of the text.
906 */
892 void getPosTextPath(const void* text, size_t length, 907 void getPosTextPath(const void* text, size_t length,
893 const SkPoint pos[], SkPath* path) const; 908 const SkPoint pos[], SkPath* path) const;
894 909
910 /** Return the number of intervals that intersect the intercept along the ax is of the advance.
911 * This permits constructing an underline that skips the descenders.
912 *
913 * @param text the text
914 * @param length number of bytes of text
915 * @param x The x-coordinate of the origin of the text.
916 * @param y The y-coordinate of the origin of the text.
917 * @param bounds The lower and upper line parallel to the advance.
918 * @param array If not null, the found intersections.
919 *
920 * @return The number of intersections.
921 */
922 int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
923 const SkScalar bounds[2], SkScalar* array) const;
f(malita) 2016/02/08 14:20:27 It's a bit unclear how to size 'array' effectively
caryclark 2016/02/09 19:10:57 Done.
924
925 /** Return the number of intervals that intersect the intercept along the ax is of the advance.
926 * This permits constructing an underline that skips the descenders.
927 *
928 * @param text the text
929 * @param length number of bytes of text
930 * @param pos array of positions, used to position each character
931 * @param bounds The lower and upper line parallel to the advance.
932 * @param array If not null, the glyph bounds contained by the advan ce parallel lines.
933 *
934 * @return The number of glyph bounds.
935 */
936 int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[ ],
937 const SkScalar bounds[2], SkScalar* array) const;
938
895 /** 939 /**
896 * Return a rectangle that represents the union of the bounds of all 940 * Return a rectangle that represents the union of the bounds of all
897 * of the glyphs, but each one positioned at (0,0). This may be conservativ ely large, and 941 * of the glyphs, but each one positioned at (0,0). This may be conservativ ely large, and
898 * will not take into account any hinting, but will respect any text-scale- x or text-skew-x 942 * will not take into account any hinting, but will respect any text-scale- x or text-skew-x
899 * on this paint. 943 * on this paint.
900 */ 944 */
901 SkRect getFontBounds() const; 945 SkRect getFontBounds() const;
902 946
903 // returns true if the paint's settings (e.g. xfermode + alpha) resolve to 947 // returns true if the paint's settings (e.g. xfermode + alpha) resolve to
904 // mean that we need not draw at all (e.g. SrcOver + 0-alpha) 948 // 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
1082 friend class SkCanvas; 1126 friend class SkCanvas;
1083 friend class SkDraw; 1127 friend class SkDraw;
1084 friend class SkPDFDevice; 1128 friend class SkPDFDevice;
1085 friend class GrAtlasTextBlob; 1129 friend class GrAtlasTextBlob;
1086 friend class GrAtlasTextContext; 1130 friend class GrAtlasTextContext;
1087 friend class GrStencilAndCoverTextContext; 1131 friend class GrStencilAndCoverTextContext;
1088 friend class GrPathRendering; 1132 friend class GrPathRendering;
1089 friend class GrTextUtils; 1133 friend class GrTextUtils;
1090 friend class GrGLPathRendering; 1134 friend class GrGLPathRendering;
1091 friend class SkScalerContext; 1135 friend class SkScalerContext;
1092 friend class SkTextToPathIter; 1136 friend class SkTextBaseIter;
1093 friend class SkCanonicalizePaint; 1137 friend class SkCanonicalizePaint;
1094 }; 1138 };
1095 1139
1096 #endif 1140 #endif
OLDNEW
« no previous file with comments | « gm/texteffects.cpp ('k') | src/core/SkGlyph.h » ('j') | src/core/SkGlyph.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698