1 /* template for generating a standard simple Tv structure */
2 /* with default image manipulation NAT 13/11/97 */
3 #include <stdio.h>
4 #include <tina/sys.h>
5 #include <tina/math.h>
6 #include <tina/mathfuncs.h>
7 #include <tina/tv.h>
8 #include <tina/tvfuncs.h>
9 #include <tina/vision.h>
10 #include <tina/visionfuncs.h>
11 #include <tina/image.h>
12 #include <tina/imagefuncs.h>
13 #include <tina/draw.h>
14 #include <tina/drawfuncs.h>
15
16 Imrect *simple_image_get(Tv *tv)
17 {
18 Imrect * im;
19 im = (Imrect *)prop_get(tv->draw,IMRECT);
20 return(im);
21 }
22
23 void simple_image_set(Tv *tv, Imrect *im)
24 {
25 tv->draw = (List *)proplist_addifnp(tv->draw,
26 (void *)im,IMRECT,im_free,true);
27 }
28
29 static void backdraw(Tv *tv)
30 {
31 Imrect *im = (Imrect *)simple_image_get(tv);
32
33 if (im != NULL)
34 {
35 im = imf_scale_nzero(im, 0.0, 255.0);
36 tv_imrect2(tv, im);
37 im_free(im);
38 }
39 }
40
41 static void fulldraw(Tv *tv)
42 {
43 /* for doing other stuff */
44 }
45
46 static void skeldraw(Tv *tv)
47 {
48 Imrect *im = (Imrect *)simple_image_get(tv);
49
50 tv_set_overlay(tv);
51 if (im != NULL)
52 tv_imrect_skel(tv, im);
53 tv_reset_draw(tv);
54 }
55
56 static void init(Tv *tv)
57 {
58 Imrect *im = (Imrect *)simple_image_get(tv);
59
60 if (im != NULL)
61 tv_camera2_image(tv, im->width, im->height);
62 }
63
64 Tv *simple_tv_make(char *name)
65 {
66 Tv *tvtemp = NULL;
67
68 tvtemp = tv_create(name);
69 tv_set_backdraw(tvtemp, backdraw);
70 tv_set_fulldraw(tvtemp, fulldraw);
71 tv_set_skeldraw(tvtemp, skeldraw);
72 tv_set_zoomlevel(tvtemp, IMZOOM);
73 tv_set_init(tvtemp, init);
74
75 return (tvtemp);
76 }
77
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.