Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import aguiaj.iscte.*;
- import aguiaj.iscte.Color;
- class AreaRect {
- final int x;
- final int y;
- final int width;
- final int height;
- //Construtor
- public AreaRect(int x, int y, int width, int height) {
- if(x < 0 || y < 0 || width < 0 || height < 0)
- throw new IllegalArgumentException ("Valores invárlidos");
- this.x=x;
- this.y=y;
- this.width=width;
- this.height=height;
- }
- //ponto 2
- public static void selection (ColorImage image, int x, int y, int width, int height){
- Color white = new Color(255,255,255);
- for(int i = x; i < width+x; i++){
- image.setColor(i, y, white);
- image.setColor(i, y+height, white);
- }
- for(int i = y; i < height+y; i++){
- image.setColor(x, i, white);
- image.setColor(x+width, i, white);
- }
- }
- //ponto 3
- public boolean selectionPossible (ColorImage image){
- if(width < image.getWidth() && height < image.getHeight())
- return true;
- else
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement