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

Side by Side Diff: site/user/tips.md

Issue 1918833003: Documentation: FAQ: drop shadow (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-25 (Monday) 13:08:33 EDT Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Tips & FAQ 1 Tips & FAQ
2 ========== 2 ==========
3 3
4 + [Gyp Options](#gypdefines) 4 + [Gyp Options](#gypdefines)
5 + [Bitmap Subsetting](#bitmap-subsetting) 5 + [Bitmap Subsetting](#bitmap-subsetting)
6 + [Capture a `.skp` file on a web page in Chromium](#skp-capture) 6 + [Capture a `.skp` file on a web page in Chromium](#skp-capture)
7 + [How to add hardware acceleration in Skia](#hw-acceleration) 7 + [How to add hardware acceleration in Skia](#hw-acceleration)
8 + [Does Skia support Font hinting?](#font-hinting) 8 + [Does Skia support Font hinting?](#font-hinting)
9 + [Does Skia shape text (kerning)?](#kerning) 9 + [Does Skia shape text (kerning)?](#kerning)
10 + [How do I add drop shadow on text?](#text-shadow)
10 11
11 * * * 12 * * *
12 13
13 <span id="gypdefines"></span> 14 <span id="gypdefines"></span>
14 15
15 Gyp Options 16 Gyp Options
16 ----------- 17 -----------
17 18
18 When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can 19 When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can
19 be used to change Skia’s compile-time settings, using a 20 be used to change Skia’s compile-time settings, using a
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 <span id="kerning"></span> 160 <span id="kerning"></span>
160 161
161 Does Skia shape text (kerning)? 162 Does Skia shape text (kerning)?
162 ------------------------------- 163 -------------------------------
163 164
164 No. Skia provides interfaces to draw glyphs, but does not implement a 165 No. Skia provides interfaces to draw glyphs, but does not implement a
165 text shaper. Skia's client's often use 166 text shaper. Skia's client's often use
166 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to 167 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to
167 generate the glyphs and their positions, including kerning. 168 generate the glyphs and their positions, including kerning.
168 169
170 * * *
171
172 <span id="text-shadow"></span>
173
174 How do I add drop shadow on text?
175 ---------------------------------
176
177 <!--?prettify lang=cc?-->
178
179 void draw(SkCanvas* canvas) {
180 const char text[] = "Skia";
181 const SkScalar radius = 2.0f;
182 const SkScalar xDrop = 2.0f;
183 const SkScalar yDrop = 2.0f;
184 const SkScalar x = 8.0f;
185 const SkScalar y = 52.0f;
186 const SkScalar textSize = 48.0f;
187 const uint8_t blurAlpha = 127;
188 canvas->drawColor(SK_ColorWHITE);
189 SkPaint paint;
190 paint.setAntiAlias(true);
191 paint.setTextSize(textSize);
192 SkPaint blur(paint);
193 blur.setAlpha(blurAlpha);
194 blur.setMaskFilter(SkBlurMaskFilter::Make(
195 kNormal_SkBlurStyle,
196 SkBlurMaskFilter::ConvertRadiusToSigma(radius), 0));
197 canvas->drawText(text, strlen(text), x + xDrop, y + yDrop, blur);
198 canvas->drawText(text, strlen(text), x, y, paint);
199 }
200
201 <a href='https://fiddle.skia.org/c/@text_shadow'><img src='https://fiddle.skia.o rg/i/@text_shadow_raster.png'></a>
202
169 <div style="margin-bottom:99%"></div> 203 <div style="margin-bottom:99%"></div>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698