Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Iterator<Pixel> sample(int initX, int initY, int dx, int dy) {
- if (dx < 0 || dy < 0) {
- throw new IllegalArgumentException("Dx or Dy cannot be negative");
- } else if (initX < 0 || initX > width) {
- throw new IllegalArgumentException("initX must be within the picture");
- } else if (initY < 0 || initY > height) {
- throw new IllegalArgumentException("initY must be within the picture");
- }
- Iterator<Pixel> iter = new SampleIterator(this, initX, initY, dx, dy);
- return iter;
- }
- public Iterator<SubPicture> window(int windowWidth, int windowHeight) {
- if (windowWidth < 0 || windowHeight < 0) {
- throw new IllegalArgumentException("windowWidth or windowHeight cannot be negative");
- } else if (windowWidth > width || windowHeight > height) {
- throw new IllegalArgumentException("windowWidth and windowHeight must be smaller or equal to picture width and height");
- }
- Iterator<SubPicture> iter = new WindowIterator(this, windowWidth, windowHeight);
- return iter;
- }
- public Iterator<SubPicture> tile(int tileWidth, int tileHeight) {
- if (tileWidth < 0 || tileHeight < 0) {
- throw new IllegalArgumentException("tileWidth or tileHeight cannot be negative");
- } else if (tileWidth > width || tileHeight > height) {
- throw new IllegalArgumentException("tileWidth and tileHeight must be smaller or equal to picture width and height");
- }
- Iterator<SubPicture> iter = new TileIterator(this, tileWidth, tileHeight);
- return iter;
- }
- public Iterator<Pixel> zigzag() {
- Iterator<Pixel> iter = new ZigzagIterator(this);
- return iter;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement