Package org.apache.harmony.awt.gl

Examples of org.apache.harmony.awt.gl.MultiRectArea


        this.factory = factory;
        setEvent(event);
    }

    public MultiRectArea getClipRects() {
        return new MultiRectArea(clipRects);
    }
View Full Code Here


            wm.setFocusedWindow(newFocusedWindow);
        }
    }

    private void processExposeEvent(X11.XExposeEvent event) {
        MultiRectArea clip = nativeQueue.getAccumulatedClip(windowId);

        clip.add(new Rectangle(event.get_x(), event.get_y(),
                event.get_width(), event.get_height()));

        if (event.get_count() != 0) {
            eventId = ID_PLATFORM;
        } else {
View Full Code Here

     * @param invert - the invert indicator, always false
     * @return a MultiRectArea of rasterizer line
     */
    public static MultiRectArea rasterize(int x1, int y1, int x2, int y2, MultiRectArea clip, LineDasher dasher, boolean invert) {

        MultiRectArea dst = new MultiRectArea(false);
        int dx = x2 - x1;
        int dy = y2 - y1;

        // Point
        if (dx == 0 && dy == 0) {
            if ((clip == null || clip.contains(x1, y1)) && (dasher == null || dasher.visible)) {
                dst = new MultiRectArea(x1, y1, x1, y1);
            }
            return dst;
        }

        if (dy < 0) {
View Full Code Here

     * @param clip - the MultiRectArea object of clipping area
     * @return a MultiRectArea of rasterizer arc
     */
    public static MultiRectArea rasterize(int x, int y, int width, int height, double angleStart, double angleExtent, MultiRectArea clip) {

        MultiRectArea mra = new MultiRectArea(false);

        int cx1, cx2, cy1, cy2;
        cx1 = cx2 = x + width / 2;
        cy1 = cy2 = y + height / 2;

        if (width % 2 == 0) {
            cx2--;
        }

        if (height % 2 == 0) {
            cy2--;
        }

        int a = width / 2;
        int b = height / 2;
        double c = Math.sqrt(a * a + b * b);

        int xcount, ycount;
        if (a < b) {
            xcount = (int)Math.ceil(a * a / c);
            ycount = (int)Math.floor(b * b / c);
        } else {
            xcount = (int)Math.floor(a * a / c);
            ycount = (int)Math.ceil(b * b / c);
        }

        int[] xline = createLine(a, b, xcount, ycount);
        int[] yline = createLine(b, a, ycount, xcount);

        // Correct lines
        int i = xline.length;
        while(xline[--i] > xcount) {
            xline[i] = xcount;
        }

        i = yline.length;
        while(yline[--i] > ycount) {
            yline[i] = ycount;
        }

        if (Math.abs(angleExtent) >= 360) {
            // Rasterize CIRCLE
            addX0Line(mra, xline, cx2, cy2, b);
            addX1Line(mra, xline, cx2, cy1, b);
            addX2Line(mra, xline, cx1, cy1, b);
            addX3Line(mra, xline, cx1, cy2, b);
            addY0Line(mra, yline, cx2, cy2, a);
            addY1Line(mra, yline, cx1, cy2, a);
            addY2Line(mra, yline, cx1, cy1, a);
            addY3Line(mra, yline, cx2, cy1, a);
        } else {
            // Rasterize ARC
            angleStart = getNormAngle(angleStart);
            double angleFinish = getNormAngle(angleStart + angleExtent);

            if (angleExtent < 0) {
                double tmp = angleStart;
                angleStart = angleFinish;
                angleFinish = tmp;
            }

            double radStart = -Math.toRadians(angleStart);
            double radFinish = -Math.toRadians(angleFinish);
            int ax1 = (int)(a * Math.cos(radStart));
            int ay1 = (int)(b * Math.sin(radStart));
            int ax2 = (int)(a * Math.cos(radFinish));
            int ay2 = (int)(b * Math.sin(radFinish));

            int[] seg1 = getSegment1(angleStart, ax1, ay1, xcount, ycount);
            int[] seg2 = getSegment2(angleFinish, ax2, ay2, xcount, ycount);

            // Start and Finish located in the same quater
            if (angleStart < angleFinish && seg1[0] == seg2[0]) {
                if (seg1[0] % 2 == 0) {
                    seg1[2] = seg2[2];
                } else {
                    seg1[1] = seg2[1];
                }
                addSeg(mra, cx1, cy1, cx2, cy2, a, b, xline, yline, seg1);
                return mra;
            }

            addSeg(mra, cx1, cy1, cx2, cy2, a, b, xline, yline, seg1);
            addSeg(mra, cx1, cy1, cx2, cy2, a, b, xline, yline, seg2);

            int startSeg = (seg1[0] + 1) % 8;
            int finishSeg = seg2[0];

            while (startSeg != finishSeg) {
                switch(startSeg) {
                case 0:
                    addY3Line(mra, yline, cx2, cy1, a);
                    break;
                case 1:
                    addX1Line(mra, xline, cx2, cy1, b);
                    break;
                case 2:
                    addX2Line(mra, xline, cx1, cy1, b);
                    break;
                case 3:
                    addY2Line(mra, yline, cx1, cy1, a);
                    break;
                case 4:
                    addY1Line(mra, yline, cx1, cy2, a);
                    break;
                case 5:
                    addX3Line(mra, xline, cx1, cy2, b);
                    break;
                case 6:
                    addX0Line(mra, xline, cx2, cy2, b);
                    break;
                case 7:
                    addY0Line(mra, yline, cx2, cy2, a);
                    break;
                }
                startSeg = (startSeg + 1) % 8;
            }
        }

        if (clip != null) {
            mra.intersect(clip);
        }

        return mra;
    }
View Full Code Here

        return false;
    }

    MultiRectArea getAccumulatedClip(long windowId) {
        Long id = new Long(windowId);
        MultiRectArea clip = (MultiRectArea)accumulatedClipRegions.get(id);
        if (clip == null) {
            clip = new MultiRectArea();
            accumulatedClipRegions.put(id, clip);
        }
        return clip;
    }
View Full Code Here

            indexModel = true;
        }
    }

    public XGraphics2D(XVolatileImage image, int tx, int ty, int width, int height) {
        this(image, tx, ty, new MultiRectArea(new Rectangle(width, height)));
    }
View Full Code Here

            indexModel = true;
        }
    }

    public XGraphics2D(long drawable, int tx, int ty, int width, int height) {
        this(drawable, tx, ty, new MultiRectArea(new Rectangle(width, height)));
    }
View Full Code Here

    public XGraphics2D(NativeWindow nwin, int tx, int ty, MultiRectArea clip) {
        this(nwin.getId(), tx, ty, clip);
    }

    public XGraphics2D(NativeWindow nwin, int tx, int ty, int width, int height) {
        this(nwin.getId(), tx, ty, new MultiRectArea(new Rectangle(width, height)));
    }
View Full Code Here

public class WinManagement {

    public static MultiRectArea getObscuredRegion(long hwnd, Rectangle part) {
        int rects[] = getObscuredRegionImpl(hwnd, part.x, part.y,
                                            part.width, part.height);
        MultiRectArea mra = new MultiRectArea();
        for (int i=0; i<rects.length; i+=4) {
            mra.addRect(rects[i], rects[i+1], rects[i+2]-1, rects[i+3]-1);
        }
        return mra;
    }
View Full Code Here

            if (behaviour instanceof LWBehavior) {
                if (parent == null || !parent.visible || !parent.behaviour.isDisplayable()) {
                    return;
                }
                if (repaintRegion == null) {
                    repaintRegion = new MultiRectArea(new Rectangle(x, y, width, height));
                }
                repaintRegion.intersect(new Rectangle(0, 0, this.w, this.h));
                repaintRegion.translate(this.x, this.y);
                parent.repaintRegion = repaintRegion;
                repaintRegion = null;
View Full Code Here

TOP

Related Classes of org.apache.harmony.awt.gl.MultiRectArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.