MCPcopy Create free account
hub / github.com/Card-Forge/forge / draw

Method draw

forge-gui-mobile/src/forge/toolbox/FLabel.java:301–341  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

299 }
300
301 @Override
302 public void draw(Graphics g) {
303 float w = getWidth();
304 float h = getHeight();
305
306 g.startClip(0, 0, w, h); //start clip to ensure nothing escapes bounds
307
308 boolean applyAlphaComposite = (opaque && !pressed && isEnabled());
309 if (applyAlphaComposite) {
310 g.setAlphaComposite(alphaComposite);
311 }
312
313 if (pressed) {
314 if (pressedColor != null) {
315 g.fillRect(pressedColor, 0, 0, w, h);
316 }
317 else {
318 g.fillGradientRect(getD50(), getD10(), true, 0, 0, w, h);
319 g.drawRect(BORDER_THICKNESS, getD50(), 0, 0, w, h);
320 }
321 }
322 else if (selected && (opaque || selectable)) {
323 g.fillGradientRect(getD30(), getL10(), true, 0, 0, w, h);
324 g.drawRect(BORDER_THICKNESS, getD30(), 0, 0, w, h);
325 }
326 else if (opaque) {
327 g.fillGradientRect(getD10(), getL20(), true, 0, 0, w, h);
328 g.drawRect(BORDER_THICKNESS, getD10(), 0, 0, w, h);
329 }
330 else if (selectable) {
331 g.drawRect(BORDER_THICKNESS, getL10(), 0, 0, w, h);
332 }
333
334 drawContent(g, w, h, pressed);
335
336 if (applyAlphaComposite) {
337 g.resetAlphaComposite();
338 }
339
340 g.endClip();
341 }
342
343 protected void drawContent(Graphics g, float w, float h, final boolean pressed) {
344 float x = insets.x;

Callers

nothing calls this directly

Calls 15

getD50Method · 0.95
getD10Method · 0.95
getD30Method · 0.95
getL10Method · 0.95
getL20Method · 0.95
drawContentMethod · 0.95
setAlphaCompositeMethod · 0.80
fillRectMethod · 0.80
fillGradientRectMethod · 0.80
drawRectMethod · 0.80
resetAlphaCompositeMethod · 0.80
endClipMethod · 0.80

Tested by

no test coverage detected