package com.example.gribouillage;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;

import org.w3c.dom.Text;

public class Gribouillis extends View {

    Bitmap image;
    Paint turpentinebleu = new Paint();
    Paint turpentineviolet = new Paint();
    Paint turpentinejaune = new Paint();
    Rect rectangle;

    public Gribouillis(Context context) {
        super(context);
        Resources res = this.getResources();
        this.image = BitmapFactory.decodeResource(res, R.drawable.cercles);
        this.turpentinebleu.setARGB(255,0,0,255);
        this.turpentineviolet.setARGB(255,127,0,255);
        this.turpentinejaune.setARGB(255,255,255,0);
        turpentineviolet.setStyle(Paint.Style.STROKE);
        turpentineviolet.setStrokeWidth(5);
        this.rectangle = new Rect(0,0,500,1000);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawRect(rectangle, turpentinebleu);
        canvas.drawCircle(800,600,200,turpentineviolet);
        turpentinejaune.setFakeBoldText(true);
        turpentinejaune.setTextSize(40);
        turpentinejaune.setTextAlign(Paint.Align.CENTER);
        canvas.drawText("Ceci est un test",rectangle.centerX(),rectangle.centerY(),turpentinejaune);
        canvas.drawBitmap(image,500,1500,turpentinebleu);
    }
}
