protected void drawRect(Surface surf, float x, float y, float w, float h) { float left = x-1, top = y-1, right = x+w+2, bot = y+h+2; surf.drawLine(left, top, right, top, 1); surf.drawLine(right, top, right, bot, 1); surf.drawLine(left, top, left, bot, 1); surf.drawLine(left, bot, right, bot, 1); } }));
protected void drawRect(Surface surf, float x, float y, float w, float h) { float left = x-1, top = y-1, right = x+w+2, bot = y+h+2; surf.drawLine(left, top, right, top, 1); surf.drawLine(right, top, right, bot, 1); surf.drawLine(left, top, left, bot, 1); surf.drawLine(left, bot, right, bot, 1); } });
protected void drawDebugRect(Surface surf) { float x = 0, y = 0, w = this.width(), h = this.height(); if (w > 0 && h > 0) { surf.setFillColor(paintNestLevel >= DEBUG_COLORS.length ? 0xFF000000 : DEBUG_COLORS[paintNestLevel]); int thick = 2; surf.drawLine(x, y, x+w, y, thick); surf.drawLine(x+w, y, x+w, y+h, thick); surf.drawLine(x+w, y+h, x, y+h, thick); surf.drawLine(x, y+h, x, y, thick); } }
@Override protected void paintImpl (Surface surf) { surf.setFillColor(0xFFFFFFFF); surf.fillRect(0, 0, _size.width, _size.height); float left = 1, top = 1, right = _size.width, bot = _size.height; surf.setFillColor(0xFF7f7F7F); for (float x = 0; x < _size.width; x += tick) { surf.drawLine(x, top, x, bot, 1); } for (float y = 0; y < _size.height; y += tick) { surf.drawLine(left, y, right, y, 1); } surf.setFillColor(0xFFFF7F7F); surf.drawLine(left - 1, top, right, top, 2); surf.drawLine(right - 1, top - 1, right - 1, bot, 2); surf.drawLine(left, top - 1, left, bot, 2); surf.drawLine(left - 1, bot - 1, right, bot - 1, 2); } });
void drawLine(Surface surf, float x1, float y1, float x2, float y2, float width) { float xmin = Math.min(x1, x2), xmax = Math.max(x1, x2); float ymin = Math.min(y1, y2), ymax = Math.max(y1, y2); surf.setFillColor(0xFF0000AA); surf.fillRect(xmin, ymin, xmax-xmin, ymax-ymin); surf.setFillColor(0xFF99FFCC); surf.drawLine(x1, y1, x2, y2, width); surf.setFillColor(0xFFFF0000); surf.fillRect(x1, y1, 1, 1); surf.fillRect(x2, y2, 1, 1); }
void drawLine(Surface surf, float x1, float y1, float x2, float y2, float width) { float xmin = Math.min(x1, x2), xmax = Math.max(x1, x2); float ymin = Math.min(y1, y2), ymax = Math.max(y1, y2); surf.setFillColor(0xFF0000AA).fillRect(xmin, ymin, xmax-xmin, ymax-ymin); surf.setFillColor(0xFF99FFCC).drawLine(x1, y1, x2, y2, width); surf.setFillColor(0xFFFF0000).fillRect(x1, y1, 1, 1).fillRect(x2, y2, 1, 1); }
/** * Fills a line between the specified coordinates, of the specified display unit width. */ public Surface drawLine (XY a, XY b, float width) { return drawLine(a.x(), a.y(), b.x(), b.y(), width); }
/** * Fills a line between the specified coordinates, of the specified display unit width. */ public Surface drawLine (XY a, XY b, float width) { return drawLine(a.x(), a.y(), b.x(), b.y(), width); }