Search in sources :

Example 11 with Bounds

use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.

the class SubcircuitPoker method paint.

@Override
public void paint(InstancePainter painter) {
    if (painter.getDestination() instanceof Canvas && painter.getData() instanceof CircuitState) {
        Bounds bds = painter.getInstance().getBounds();
        int cx = bds.getX() + bds.getWidth() / 2;
        int cy = bds.getY() + bds.getHeight() / 2;
        int tx = cx + 3;
        int ty = cy + 3;
        int[] xp = { tx - 1, cx + 8, cx + 10, tx + 1 };
        int[] yp = { ty + 1, cy + 10, cy + 8, ty - 1 };
        Graphics g = painter.getGraphics();
        if (mouseDown) {
            g.setColor(MAGNIFYING_INTERIOR_DOWN);
        } else {
            g.setColor(MAGNIFYING_INTERIOR);
        }
        g.fillOval(cx - 5, cy - 5, 10, 10);
        g.setColor(Color.BLACK);
        g.drawOval(cx - 5, cy - 5, 10, 10);
        g.fillPolygon(xp, yp, xp.length);
    }
}
Also used : Graphics(java.awt.Graphics) Canvas(com.cburch.logisim.gui.main.Canvas) Bounds(com.cburch.logisim.data.Bounds)

Example 12 with Bounds

use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.

the class SubcircuitPoker method isWithin.

private boolean isWithin(InstanceState state, MouseEvent e) {
    Bounds bds = state.getInstance().getBounds();
    int cx = bds.getX() + bds.getWidth() / 2;
    int cy = bds.getY() + bds.getHeight() / 2;
    int dx = e.getX() - cx;
    int dy = e.getY() - cy;
    return dx * dx + dy * dy <= 60;
}
Also used : Bounds(com.cburch.logisim.data.Bounds)

Example 13 with Bounds

use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.

the class ComponentDrawContext method drawRectangle.

public void drawRectangle(Component comp, String label) {
    Bounds bds = comp.getBounds(g);
    drawRectangle(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight(), label);
}
Also used : Bounds(com.cburch.logisim.data.Bounds)

Example 14 with Bounds

use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.

the class ComponentDrawContext method drawHandles.

public void drawHandles(Component comp) {
    Bounds b = comp.getBounds(g);
    int left = b.getX();
    int right = left + b.getWidth();
    int top = b.getY();
    int bot = top + b.getHeight();
    drawHandle(right, top);
    drawHandle(left, bot);
    drawHandle(right, bot);
    drawHandle(left, top);
}
Also used : Bounds(com.cburch.logisim.data.Bounds)

Example 15 with Bounds

use of com.cburch.logisim.data.Bounds in project logisim-evolution by reds-heig.

the class ComponentDrawContext method drawRectangle.

public void drawRectangle(ComponentFactory source, int x, int y, AttributeSet attrs, String label) {
    Bounds bds = source.getOffsetBounds(attrs);
    drawRectangle(source, x + bds.getX(), y + bds.getY(), bds.getWidth(), bds.getHeight(), label);
}
Also used : Bounds(com.cburch.logisim.data.Bounds)

Aggregations

Bounds (com.cburch.logisim.data.Bounds)133 Graphics (java.awt.Graphics)50 Direction (com.cburch.logisim.data.Direction)27 Location (com.cburch.logisim.data.Location)24 BitWidth (com.cburch.logisim.data.BitWidth)21 Component (com.cburch.logisim.comp.Component)11 Color (java.awt.Color)10 FontMetrics (java.awt.FontMetrics)10 Value (com.cburch.logisim.data.Value)7 Font (java.awt.Font)7 Circuit (com.cburch.logisim.circuit.Circuit)6 Port (com.cburch.logisim.instance.Port)6 Handle (com.cburch.draw.model.Handle)5 CanvasObject (com.cburch.draw.model.CanvasObject)4 Instance (com.cburch.logisim.instance.Instance)4 InstanceDataSingleton (com.cburch.logisim.instance.InstanceDataSingleton)4 ComponentFactory (com.cburch.logisim.comp.ComponentFactory)3 AttributeSet (com.cburch.logisim.data.AttributeSet)3 Project (com.cburch.logisim.proj.Project)3 Dimension (java.awt.Dimension)3