Project - Comic Strip (board) [closed]

1

I have an Introduction to Programming project that consists of making a comic book. The first class is the Vignette. It is necessary to create two constructors for Vignette, which in one of them receives as a ColorImage , a int that represents the thickness, a int type and a Color , and in the other receives everything but the Color . This is because, we are supposed to create frames in the Vignette, hence the thickness, the type (that can be, line, dashed or drawn) and the color (which is the color of the frame).

Then you need to create several methods to know the height and width of the sticker, change the color, thickness, type, move the image to black and white and return to the original colors. All this is done. My question is about the second class: Surfboard. The board is an array of vignettes with several strips (it is necessary to create the method to say how many strips we want) and each strip must have several vignettes (it is necessary to create the method to say how many vignettes in each individual strip we want, one strip may carry a sticker and another may carry 3).

I will also have to create a method that will allow a spacing between the stickers and the next strip. The matrix is created and also the method to create the method to choose how many strips we want, but now it is necessary to draw the board, define the method to know the height, width, number of stickers of a strip, the space between stickers and strips and put a vignette in a given position (replacing the one that was in that position previously). I would like you to help me in what you can, and the most important at the moment is to draw the board, the height and the width.

Code Vignette (the dashed frame is bad, if anyone knows):

import aguiaj.iscte.Color;
import aguiaj.iscte.ColorImage;


class Vinheta {

//CONSTRUTOR    
    ColorImage img;
    private ColorImage vinheta;
    int moldura;
    int tipo;
    Color color;
    private boolean preto_branco=false;

//FORNECENDO COR
    Vinheta(ColorImage img, int moldura, Color color, int tipo) {
        this.img=img;
        this.moldura=moldura;
        this.tipo=tipo;
        this.color=color;
        if(tipo==0)
        semMoldura(img,moldura);
        else if(tipo==1)
        linha(img, moldura, color);
        else if(tipo==2)
        tracejado(img,moldura,color);
        else if(tipo==3)
        desenhado(img,moldura,color);
    }



//ASSUMINDO QUE A COR É PRETO
        Vinheta(ColorImage img, int moldura, int tipo) {
        this.img=img;
        this.moldura=moldura;
        this.tipo=tipo;
        if(tipo==0)
        semMoldura(img,moldura);
        else if(tipo==1)
        linha(img, moldura, Color.BLACK);
        else if(tipo==2)
        tracejado(img,moldura,Color.BLACK);
        else if(tipo==3)
        desenhado(img,moldura,Color.BLACK);
    }



//VINHETA SEM MOLDURA
    private void semMoldura(ColorImage img, int moldura){   
        ColorImage img2 = new ColorImage(this.img.getWidth() + moldura*2, this.img.getHeight() + moldura*2);
        for(int x=0; x<this.img.getWidth(); x++) {
            for(int y=0; y<this.img.getHeight(); y++) {
                img2.setColor(x+moldura,y+moldura,this.img.getColor(x,y));
            }
        }
            this.vinheta=img;
    }

//MOLDURA LINHA
    private void linha(ColorImage img, int moldura, Color color){
        ColorImage img2 = new ColorImage(this.img.getWidth() + moldura*2, this.img.getHeight() + moldura*2);
            for(int x=0; x<this.img.getWidth(); x++) {
                for(int y=0; y<this.img.getHeight(); y++) {
                        img2.setColor(x+moldura,y+moldura,this.img.getColor(x,y));
                }
            }
                for(int i=0; i<img2.getWidth(); i++) {
                    for(int j=0; j<img2.getHeight(); j++) {
                        if(i <= moldura-1 || j <= moldura-1 || i >=img2.getWidth()-moldura || j >= img2.getHeight()-moldura) {
                            img2.setColor(i, j, color);
                        }
                    }
                }
            this.vinheta=img2;          
    }




//MOLDURA TRACEJADA
    private void tracejado(ColorImage img, int moldura, Color color) {
            ColorImage img2 = new ColorImage(this.img.getWidth() + moldura*2, this.img.getHeight() + moldura*2);
                for(int x=0; x<this.img.getWidth(); x++) {
                    for(int y=0; y<this.img.getHeight(); y++) {
                        img2.setColor(x+moldura,y+moldura,this.img.getColor(x,y));
                    }
                }

                for(int i=0; i<img2.getWidth(); i++) {
                    for(int j=0; j<img2.getHeight(); j++) {
                        //if(i%2==0 && j<=moldura || j%2==0 && i<=moldura){
                            if(i <= moldura-1 || j <= moldura-1 || i >=img2.getWidth()-moldura || j >= img2.getHeight()-moldura) {
                            img2.setColor(i,j,color);
                        }
                    }
                }
        this.vinheta=img2;
    }


//MOLDURA DESENHADA
    private void desenhado (ColorImage img, int moldura, Color color){
        ColorImage img2 = new ColorImage(this.img.getWidth() + moldura*2, this.img.getHeight() + moldura*2);
            for(int x=0; x<this.img.getWidth(); x++) {
                for(int y=0; y<this.img.getHeight(); y++) {
                    img2.setColor(x+moldura,y+moldura,this.img.getColor(x,y));
                }
            }       
            for (int i=0;i!=img2.getWidth();i++){
                for (int j=0;j!=img2.getHeight();j++){
                    if(i<moldura || i>=img2.getWidth()-moldura || j<moldura || j>=img2.getHeight()-moldura){
                        int n=(int)(Math.random()*11);
                        if(n%2!=0)
                            img2.setColor(i,j,color);
                    else{
                        Color c=new Color (255,255,255);
                        img2.setColor(i,j,c);
                    }
                    }
            if(i>=moldura && i<img2.getWidth()-moldura && j>=moldura && j<img2.getHeight()-moldura){
                Color f = img.getColor((i-moldura),(j-moldura));
                        img2.setColor(i,j,f);           
            }
                }
            }
            this.vinheta=img2;
    }

//DEFINIR A COR DA MOLDURA          
    void changeColor (Color color){
        this.color=color;
        if(tipo==0)
        semMoldura(img,moldura);
        else if(tipo==1)
        linha(img, moldura, color);
        else if(tipo==2)
        tracejado(img,moldura,color);
        else if(tipo==3)
        desenhado(img,moldura,color);
    }

//DEFINIR O TIPO DA MOLDURA
    void changeTipo(int tipo){
        this.tipo=tipo;
        if(tipo==0)
        semMoldura(img,moldura);
        else if(tipo==1)
        linha(img, moldura, color);
        else if(tipo==2)
        tracejado(img,moldura,color);
        else if(tipo==3)
        desenhado(img,moldura,color);
    }

//DEFINIR A ESPESSURA DA MOLDURA    
    void changeEspessura(int moldura){      
        this.moldura=moldura;
        if(tipo==0)
        semMoldura(img,moldura);
        else if(tipo==1)
        linha(img, moldura, color);
        else if(tipo==2)
        tracejado(img,moldura,color);
        else if(tipo==3)
        desenhado(img,moldura,color);
    }           


//ALTURA VINNHETA           
    public int altura() {
        return vinheta.getHeight();
    }   

//LARGURA VINHETA
    int largura() {
        return vinheta.getWidth();
    }

//PASSAR DE CORES PARA P&B
    void colorToGray() {
        for(int x=moldura; x<vinheta.getWidth()-moldura; x++)
            for(int y=moldura; y<vinheta.getHeight()-moldura; y++)
                vinheta.setColor(x,y,vinheta.getColor(x,y).toGraytone());
    }

//VOLTAR ÀS CORES ORIGINAIS
    void coresOriginais(){
        for(int x=0; x<img.getWidth(); x++)
            for(int y=0; y<img.getHeight(); y++)
                vinheta.setColor(x+moldura, y+moldura, img.getColor(x,y));
    }

//DEVOLVER A IMAGEM CORRESPONDENTE À VINHETA
    ColorImage getVinheta(){
        if(preto_branco==false)
            return this.vinheta;
        else{
            colorToGray();
        return this.vinheta;
        }
    }

}

Plank code so far:

import aguiaj.iscte.ColorImage;
import aguiaj.iscte.Color;

class Prancha {

//CONSTRUTOR
    Vinheta[][]m;
    ColorImage prancha;
    private int espacamento;
    private int nTiras;
    private int numeroDeVinhetas;



    Prancha (int nTiras){
        m = new Vinheta[nTiras][1];
            for(int x=0; x>nTiras; x++){
                    m[x][0]=new Vinheta(new ColorImage (50,50), 1, 1);
            }
    int espacamento=0;

}

These imports have to do with AguiaJ, a program created by a professor of my college, that we use in Eclipse

    
asked by anonymous 07.12.2016 / 17:31

0 answers