Example usage for java.awt Graphics fillArc

List of usage examples for java.awt Graphics fillArc

Introduction

In this page you can find the example usage for java.awt Graphics fillArc.

Prototype

public abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle);

Source Link

Document

Fills a circular or elliptical arc covering the specified rectangle.

Usage

From source file:com.jcraft.weirdx.Draw.java

static void reqFillPolyArc(Client c, XDrawable d, GC gc) throws IOException {
    //int foo;// w w w  .  ja v a2 s . c  om
    int n = c.length;
    InputOutput io = c.client;

    Graphics graphics = d.getGraphics(gc, GC.GCFunction | GC.GCSubwindowMode);
    if (graphics == null) {
        io.readPad(n * 4);
        return;
    }

    if (gc.clip_mask != null && gc.clip_mask instanceof ClipRectangles) {
        java.awt.Rectangle rec = (Rectangle) (gc.clip_mask.getMask());
        if (rec == null) {
            io.readPad(n * 4);
            return;
        }
    }
    n *= 4;
    short x, y, a1, a2;
    int width, height;
    int sx = d.width;
    int sy = d.height;
    int lx = 0;
    int ly = 0;
    while (n != 0) {
        x = (short) io.readShort();
        y = (short) io.readShort();
        if (x < sx)
            sx = x;
        if (y < sy)
            sy = y;

        width = io.readShort();
        height = io.readShort();

        if (lx < x + width)
            lx = x + width;
        if (ly < y + height)
            ly = y + height;

        a1 = (short) io.readShort();
        a2 = (short) io.readShort();
        n -= 12;
        graphics.fillArc(x, y, width, height, a1 / 64, a2 / 64);
    }

    if (d instanceof XWindow) {
        if (sx < 0)
            sx = 0;
        if (sy < 0)
            sy = 0;
        ((XWindow) d).draw(sx, sy, lx - sx + 2, ly - sy + 2);
    }

    if (gc.function == GC.GXxor || gc.function == GC.GXinvert) {
        graphics.setPaintMode();
    }
    if (gc.clip_mask != null && gc.clip_mask instanceof ClipRectangles) {
        d.restoreClip();
    }
}