Search in sources :

Example 56 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 57 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 58 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 59 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 60 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)199 Graphics (java.awt.Graphics)71 Direction (com.cburch.logisim.data.Direction)29 Location (com.cburch.logisim.data.Location)29 BitWidth (com.cburch.logisim.data.BitWidth)20 Graphics2D (java.awt.Graphics2D)20 Font (java.awt.Font)19 Component (com.cburch.logisim.comp.Component)14 Color (java.awt.Color)14 FontMetrics (java.awt.FontMetrics)12 Value (com.cburch.logisim.data.Value)9 Circuit (com.cburch.logisim.circuit.Circuit)7 Port (com.cburch.logisim.instance.Port)7 Instance (com.cburch.logisim.instance.Instance)6 InstanceDataSingleton (com.cburch.logisim.instance.InstanceDataSingleton)6 Handle (com.cburch.draw.model.Handle)5 RadixOption (com.cburch.logisim.circuit.RadixOption)5 CanvasObject (com.cburch.draw.model.CanvasObject)3 Wire (com.cburch.logisim.circuit.Wire)3 ComponentFactory (com.cburch.logisim.comp.ComponentFactory)3