MCPcopy Create free account
hub / github.com/HumbleUI/Skija / draw

Method draw

examples/scenes/src/WallOfTextScene.java:150–187  ·  view source on GitHub ↗
(Canvas canvas, int width, int height, float dpi, int xpos, int ypos)

Source from the content-addressed store, hash-verified

148 }
149
150 @Override
151 public void draw(Canvas canvas, int width, int height, float dpi, int xpos, int ypos) {
152 var padding = 20f * dpi;
153 var textWidth = width * dpi - padding * 2;
154 var fontSize = 14.5f * dpi;
155 var variant = _variants[_variantIdx];
156
157 if (font == null)
158 font = new Font(inter, fontSize).setSubpixel(true);
159
160 fill.setColor(colors[_variantIdx]);
161
162 if (variant.startsWith("Paragraph"))
163 drawParagraph(canvas, fontSize, padding, textWidth);
164 else if (variant.startsWith("TextLine"))
165 drawTextLinesByWords(canvas, padding, textWidth);
166 else {
167 Shaper shaper = null;
168 if (variant.startsWith("Primitive"))
169 shaper = Shaper.makePrimitive();
170 else if (variant.startsWith("ShaperDrivenWrapper"))
171 shaper = Shaper.makeShaperDrivenWrapper();
172 else if (variant.startsWith("ShapeDontWrapOrReorder"))
173 shaper = Shaper.makeShapeDontWrapOrReorder();
174 else if (variant.startsWith("CoreText"))
175 shaper = "Mac OS X".equals(System.getProperty("os.name")) ? Shaper.makeCoreText() : null;
176 else
177 shaper = Shaper.makeShapeThenWrap();
178
179 if (shaper != null) {
180 if (variant.endsWith("by words"))
181 drawByWords(shaper, canvas, padding, textWidth);
182 else
183 drawTogether(shaper, canvas, padding, textWidth);
184 shaper.close();
185 }
186 }
187 }
188
189 @Override
190 public boolean scale() {

Callers

nothing calls this directly

Calls 14

drawParagraphMethod · 0.95
drawTextLinesByWordsMethod · 0.95
makePrimitiveMethod · 0.95
makeCoreTextMethod · 0.95
makeShapeThenWrapMethod · 0.95
drawByWordsMethod · 0.95
drawTogetherMethod · 0.95
setSubpixelMethod · 0.80
getPropertyMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected