Добавлен класс Clip

This commit is contained in:
Victor 2014-03-02 18:15:45 +02:00
parent d789f69c6e
commit 57c252e46c

View File

@ -0,0 +1,35 @@
package com.annimon.graphics;
/**
* @author aNNiMON
*/
public class Clip extends Rect {
public Clip(double x, double y, double width, double height) {
super(x, y, width, height);
}
public void setClip(double x, double y, double width, double height) {
super.x = x;
super.y = y;
super.width = width;
super.height = height;
}
public double getXMax() {
return x + width;
}
public double getYMax() {
return y + height;
}
public int getClipCode(double x, double y) {
int xmin = (x < super.x) ? 1 : 0;
int xmax = (x > getXMax()) ? 1 : 0;
int ymin = (y < super.y) ? 1 : 0;
int ymax = (y > getYMax()) ? 1 : 0;
return (xmin << 3) | (xmax << 2) | (ymin << 1) | ymax;
}
}