Exemple #1
0
void test_gfx(int argc, char **argv) {
	int delay = 1000;
	
	Screen* screen = switch_to_vga();

	fill_screen(screen, color_make(2, 0, 0));

	draw_button(screen);
	sleep(delay);

	test_lines(screen);
	sleep(delay);

	test_circles(screen);
	sleep(delay);

	test_rects(screen);
	sleep(delay);

	test_triangles(screen);
	sleep(delay);

	test_text(screen);
	sleep(delay);

	draw_julia(screen);
	sleep(delay);
	
	draw_mandelbrot(screen);
	sleep(delay);

	gfx_teardown(screen);
	switch_to_text();
}
    virtual void onDraw(SkCanvas* canvas) {
        this->drawBG(canvas);

      //  canvas->scale(1.5f, 1.5f);
        
        canvas->drawBitmap(fBM, 0, 0);
        
        SkIRect margins;
        SkRect  dst;
        int d = 25;
        
        margins.set(d, d, d, d);
        margins.fLeft   = fBM.width()/2 - 1;
        margins.fTop    = fBM.height()/2 - 1;
        margins.fRight  = fBM.width() - margins.fLeft - 1;
        margins.fBottom = fBM.height() - margins.fTop - 1;

   //     canvas->translate(fX/5, fY/5);
        canvas->translate(0, 76);

        dst.set(0, 0, SkIntToScalar(200), SkIntToScalar(200));
        
        SkPaint paint;
        paint.setAntiAlias(false);
        paint.setDither(true);
        paint.setFilterBitmap(false);
    //    SkNinePatch::DrawNine(canvas, dst, fBM, margins, &paint);
        test_rects(canvas, fBM, &paint);
    }