public ImmutablePoint getScaledOffset(int boxSize) { ImmutablePoint point = offset; if (order > 0) { point = point.translate(10 * order, 0); } return point.scale(getSquareSize(), boxSize); }
public void drawAntialiasedTextCentered( Graphics2D g2, String text, int fontSize, Position pos, ImmutablePoint centerNoScaled, Color fgColor, Color bgColor) { ImmutablePoint center = centerNoScaled.scale(getSquareSize()); drawAntialiasedTextCenteredNoScale(g2, text, fontSize, pos, center, fgColor, bgColor); }
/** debug purposes highlight - it always shows basic follower (doesn't important for dbg */ private void paintFigureHighlight(Graphics2D g2) { // ugly copy pasted code from Meeple but uncached here g2.setComposite(FIGURE_HIGHLIGHT_AREA_ALPHA_COMPOSITE); Tile tile = getGame().getBoard().get(selectedPosition); ImmutablePoint point = getClient() .getResourceManager() .getMeeplePlacement(tile, SmallFollower.class, selectedLocation); Player p = getClient().getGame().getActivePlayer(); Image unscaled = getClient() .getFigureTheme() .getFigureImage(SmallFollower.class, p.getColors().getMeepleColor(), null); int size = (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO); Image scaled = unscaled.getScaledInstance(size, size, Image.SCALE_SMOOTH); scaled = new ImageIcon(scaled).getImage(); ImmutablePoint scaledOffset = point.scale(getSquareSize(), (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO)); g2.drawImage( scaled, getOffsetX(selectedPosition) + scaledOffset.getX(), getOffsetY(selectedPosition) + scaledOffset.getY(), gridPanel); }
public ImmutablePoint getScaledOffset(int boxSize) { return offset.scale(getSquareSize(), boxSize); }