Mercurial > MadButterfly
comparison Android/examples/native_test/native_test.cpp @ 518:3a7bce43ec6e Android_Skia
Android native code with MB
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 01 Dec 2009 22:55:27 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
517:82c1ea2ba929 | 518:3a7bce43ec6e |
---|---|
1 #include <SkCanvas.h> | |
2 #include <SkBitmap.h> | |
3 | |
4 extern "C" { | |
5 #include <mb.h> | |
6 }; | |
7 | |
8 void native_test(void) { | |
9 mbe_t *mbe1, *mbe2; | |
10 SkBitmap *bmap1, *bmap2; | |
11 redraw_man_t _rdman; | |
12 redraw_man_t *rdman = &_rdman; | |
13 coord_t *root; | |
14 shape_t *shape; | |
15 paint_t *paint; | |
16 | |
17 bmap1 = new SkBitmap(); | |
18 bmap1->setConfig(SkBitmap::kARGB_8888_Config, 300, 300); | |
19 mbe1 = mbe_create((mbe_surface_t *)bmap1); | |
20 bmap2 = new SkBitmap(); | |
21 bmap2->setConfig(SkBitmap::kARGB_8888_Config, 300, 300); | |
22 mbe2 = mbe_create((mbe_surface_t *)bmap2); | |
23 | |
24 redraw_man_init(rdman, mbe1, mbe2); | |
25 root = rdman_get_root(rdman); | |
26 shape = rdman_shape_path_new(rdman, "M 100 100 L 100 150 L 150 150 z"); | |
27 paint = rdman_paint_color_new(rdman, 1, 0, 0, 1); | |
28 rdman_paint_stroke(rdman, paint, shape); | |
29 rdman_add_shape(rdman, shape, root); | |
30 | |
31 rdman_shape_changed(rdman, shape); | |
32 rdman_paint_changed(rdman, paint); | |
33 | |
34 rdman_redraw_all(rdman); | |
35 | |
36 rdman_paint_free(rdman, paint); | |
37 rdman_shape_free(rdman, shape); | |
38 redraw_man_destroy(rdman); | |
39 } | |
40 | |
41 int main(int argc, const char *argv[]) { | |
42 native_test(); | |
43 return 0; | |
44 } |