1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
public class Dessine_Carre extends DessinneForme implements Element
{
protected float coint_inf_x;
protected float coint_inf_y;
protected Paint combre;
protected boolean ombre = false;
public Dessine_Carre(Context context, double posx, double posy,double pbx,double pby, int couleur,int taille)
{
super(context, (float)posx, (float)posy, couleur,taille);
this.coint_inf_x =(float)pbx;
this.coint_inf_y =(float)pby;
}
public Dessine_Carre(Context context, double posx, double posy,double pbx,double pby, int couleur,int taille,int combre)
{
super(context, (float)posx, (float)posy, couleur,taille);
this.coint_inf_x =(float)pbx;
this.coint_inf_y =(float)pby;
this.combre = new Paint();
this.combre.setColor(combre);
this.ombre=true;
}
protected void onDraw(Canvas canvas)
{
if(this.ombre)
{
this.combre.setStyle(Paint.Style.STROKE);
this.combre.setStrokeWidth(7);
canvas.drawRect(this.d_x+2,this.d_y+2,this.coint_inf_x ,this.coint_inf_y, this.combre);
}
if(!this.ombre)this.paint.setStyle(Paint.Style.STROKE);
canvas.drawRect(this.d_x,this.d_y,this.coint_inf_x ,this.coint_inf_y, this.paint);
invalidate();
}
protected void CHANGE_SECOND_POINT(int ne_posx,int ne_posy)
{
this.coint_inf_x=ne_posx;
this.coint_inf_x=ne_posy;
}
public float getFinx()
{
return this.coint_inf_x;
}
public float getFiny()
{
return this.coint_inf_y;
}
public float getFinOmbrex()
{
return this.coint_inf_x+4;//7taille-2x-1px=4
}
public float getFinyOmbre()
{
return this.coint_inf_y+4;//7taille-2x-1px=4
}
public float getLargeur()
{
return this.coint_inf_x - this.d_x;
}
public float getHauteur()
{
return this.coint_inf_y - this.d_y;
}
public List<Chunk> getChunks() {
// TODO Auto-generated method stub
return null;
}
public boolean isContent() {
// TODO Auto-generated method stub
return false;
}
public boolean isNestable() {
// TODO Auto-generated method stub
return false;
}
public boolean process(ElementListener arg0) {
// TODO Auto-generated method stub
return false;
}
public int type() {
// TODO Auto-generated method stub
return 0;
}
} |
Partager