Java 类sun.awt.ConstrainableGraphics 实例源码

项目:OpenJSharp    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:jdk8u-jdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk-jdk10    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk9    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:Java8CN    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:jdk8u_jdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:VarJ    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:jdk-1.7-annotated    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:infobip-open-jdk-8    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:jdk8u-dev-jdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:jdk7-jdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk-source-code-learn    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:OLD-OpenJDK8    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk-jdk7u-jdk    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk-icedtea7    文件:Component.java   
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
项目:openjdk-jdk10    文件:EmptyClipRenderingTest.java   
/**
 * Run the test: cycle through all the rectangles, use one as clip and
 * another as the area to render to.
 * Set the clip in the same way Swing does it when repainting:
 * first constrain the graphics to the damaged area, and repaint everything
 */
void runTest(Graphics2D destGraphics) {
    destGraphics.setColor(Color.black);
    destGraphics.fillRect(0, 0, IMG_W, IMG_H);

    destGraphics.setColor(Color.red);
    for (Rectangle clip : rects) {
        Graphics2D g2d = (Graphics2D)destGraphics.create();
        g2d.setColor(Color.red);
        // mimic what swing does in BufferStrategyPaintManager
        if (g2d instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics)g2d).constrain(clip.x, clip.y,
                                                   clip.width, clip.height);
        }
        g2d.setClip(clip);

        for (Rectangle renderRegion : rects) {
            if (renderRegion != clip) {
                // from CellRendererPane's paintComponent
                Graphics2D rG = (Graphics2D)
                    g2d.create(renderRegion.x, renderRegion.y,
                               renderRegion.width, renderRegion.height);
                rG.fillRect(0,0, renderRegion.width, renderRegion.height);
            }
        }
    }
}
项目:openjdk9    文件:EmptyClipRenderingTest.java   
/**
 * Run the test: cycle through all the rectangles, use one as clip and
 * another as the area to render to.
 * Set the clip in the same way Swing does it when repainting:
 * first constrain the graphics to the damaged area, and repaint everything
 */
void runTest(Graphics2D destGraphics) {
    destGraphics.setColor(Color.black);
    destGraphics.fillRect(0, 0, IMG_W, IMG_H);

    destGraphics.setColor(Color.red);
    for (Rectangle clip : rects) {
        Graphics2D g2d = (Graphics2D)destGraphics.create();
        g2d.setColor(Color.red);
        // mimic what swing does in BufferStrategyPaintManager
        if (g2d instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics)g2d).constrain(clip.x, clip.y,
                                                   clip.width, clip.height);
        }
        g2d.setClip(clip);

        for (Rectangle renderRegion : rects) {
            if (renderRegion != clip) {
                // from CellRendererPane's paintComponent
                Graphics2D rG = (Graphics2D)
                    g2d.create(renderRegion.x, renderRegion.y,
                               renderRegion.width, renderRegion.height);
                rG.fillRect(0,0, renderRegion.width, renderRegion.height);
            }
        }
    }
}