Android Region - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Region class.

This code example shows how to use the following methods:op, setEmpty
        @Override 
        protected void dispatchDraw(Canvas canvas) {
 
            canvas.save();
 
            mRegion.setEmpty();
            mRegion.op(0, 0, getWidth(), getHeight(),
                    Region.Op.REPLACE);
            mRegion.op(getWidth() / 4, getHeight() / 4, 3 * getWidth() / 4, 3 * getHeight() / 4,
                    Region.Op.DIFFERENCE);
 
            canvas.clipRegion(mRegion);
            super.dispatchDraw(canvas);
 
            canvas.restore();
        } 
    } 
 
    private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sagittis molestie aliquam. Donec metus metus, laoreet nec sagittis vitae, ultricies sit amet eros. Suspendisse sed massa sit amet felis consectetur gravida. In vitae erat mi, in egestas nisl. Phasellus quis ipsum massa, at scelerisque arcu. Nam lectus est, pellentesque eget lacinia non, congue vitae augue. Aliquam erat volutpat. Pellentesque bibendum tincidunt viverra. Aliquam erat volutpat. Maecenas pretium vulputate placerat. Nulla varius elementum rutrum. Aenean mollis blandit imperdiet. Pellentesque interdum fringilla ligula.";
} 
8
CodeRank
This code example shows how to use the following methods:getBounds, op
     * {@inheritDoc}  
     */ 
    //TODO change more appropriate method 
    public boolean intersects(float x, float y, float width, float height) {
        float tmpx, tmpy, tmpw, tmph;
        Region region = new Region(mRegion);
        if (x < width + x) {
            tmpx = x;
            tmpw = width;
        } 
        else{ 
            tmpx = width + x;
            tmpw = Math.abs(width); 
        } 
        if (y < height + y) {
            tmpy = y;
            tmph = height;
        } 
        else{ 
            tmpy = height + y;

7
CodeRank
This code example shows how to use the following methods:op, setEmpty
        @Override 
        protected void dispatchDraw(Canvas canvas) {
 
            canvas.save();
 
            mRegion.setEmpty();
            mRegion.op(0, 0, getWidth(), getHeight(),
                    Region.Op.REPLACE);
            mRegion.op(getWidth() / 4, getHeight() / 4, 3 * getWidth() / 4, 3 * getHeight() / 4,
                    Region.Op.DIFFERENCE);
 
            canvas.clipRegion(mRegion);
            super.dispatchDraw(canvas);
 
            canvas.restore();
        } 
    } 
 
    private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sagittis molestie aliquam. Donec metus metus, laoreet nec sagittis vitae, ultricies sit amet eros. Suspendisse sed massa sit amet felis consectetur gravida. In vitae erat mi, in egestas nisl. Phasellus quis ipsum massa, at scelerisque arcu. Nam lectus est, pellentesque eget lacinia non, congue vitae augue. Aliquam erat volutpat. Pellentesque bibendum tincidunt viverra. Aliquam erat volutpat. Maecenas pretium vulputate placerat. Nulla varius elementum rutrum. Aenean mollis blandit imperdiet. Pellentesque interdum fringilla ligula.";
} 
7
CodeRank
This code example shows how to use the following methods:op
 
    /** 
     * {@inheritDoc} 
     */ 
    public boolean contains(RectShape rect) {
        Region tmpRegion = new Region();
        Region targetRegion = new Region((int)rect.getX(), (int)rect.getY(),
                (int)(rect.getWidth() + rect.getX()), (int)(rect.getHeight() + rect.getY()));
        tmpRegion.op(this.mRegion, targetRegion, Op.INTERSECT );
        return ! targetRegion.op(tmpRegion, Op.XOR);
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    public boolean contains(float x, float y) {
        return mRegion.contains((int)x, (int)y);
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:op
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(RectShape rect) {
        Region tmpRegion = new Region();
        Region targetRegion = new Region((int)rect.getX(), (int)rect.getY(),
                (int)(rect.getWidth() + rect.getX()), (int)(rect.getHeight() + rect.getY()));
        tmpRegion.op(this.mRegion, targetRegion, Op.INTERSECT );
        return ! targetRegion.op(tmpRegion, Op.XOR);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(float x, float y) {
        return mRegion.contains((int)x, (int)y);
    } 
 
    /** 
     * {@inheritDoc}  
6
CodeRank
This code example shows how to use the following methods:op
    /** 
     * {@inheritDoc}  
     */ 
    //TODO change more appropriate method 
    public boolean intersects(float x, float y, float width, float height) {
        Region region = new Region(mRegion);
        float tmpx, tmpy, tmpw, tmph;
 
        if (x < width + x) {
            tmpx = x;
            tmpw = width;
        } 
        else{ 
            tmpx = width + x;
            tmpw = Math.abs(width); 
        } 
        if (y < height + y) {
            tmpy = y;
            tmph = height;
        } 

6
CodeRank
This code example shows how to use the following methods:
    // Global scaling factor applied to touch events when they are dispatched 
    // to the window 
    public float scaleFactor;
 
    // Window touchable region. 
    public final Region touchableRegion = new Region();
 
    // Window is visible. 
    public boolean visible;
 
    // Window can receive keys. 
    public boolean canReceiveKeys;
 
    // Window has focus. 
    public boolean hasFocus;
 
    // Window has wallpaper.  (window is the current wallpaper target) 
    public boolean hasWallpaper;
 
    // Input event dispatching is paused. 
6
CodeRank
This code example shows how to use the following methods:op
     
    /** 
     * {@inheritDoc}  
     */ 
    public boolean intersects(float x, float y, float width, float height) {
        Region region = new Region(mRegion);
        float tmpx, tmpy, tmpw, tmph;
 
        if (x < width + x) {
            tmpx = x;
            tmpw = width;
        } 
        else{ 
            tmpx = width + x;
            tmpw = Math.abs(width); 
        } 
        if (y < height + y) {
            tmpy = y;
            tmph = height;
        } 

6
CodeRank
This code example shows how to use the following methods:op
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(float x, float y, float width, float height) {
        Region tmpRegion = new Region();
        Region targetRegion = new Region((int)x, (int)y, (int)(width + x), (int)(height + y));
        tmpRegion.op(this.mRegion, targetRegion, Op.INTERSECT );
        return ! targetRegion.op(tmpRegion, Op.XOR);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(PointF point) {
        return mRegion.contains((int)point.x, (int)point.y);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
6
CodeRank
This code example shows how to use the following methods:op
     
    /** 
     * {@inheritDoc} 
     */ 
    public boolean intersects(float x, float y, float width, float height) {
        Region region = new Region(mRegion);
        float tmpx, tmpy, tmpw, tmph;
 
        if (x < width + x) {
            tmpx = x;
            tmpw = width;
        } 
        else{ 
            tmpx = width + x;
            tmpw = Math.abs(width); 
        } 
        if (y < height + y) {
            tmpy = y;
            tmph = height;
        } 

6
CodeRank

Related Android Region Questions & Answers:

See Code Examples for Android Region Methods: