~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/tools/mono/mono_view.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/vision.h>
  9 #include <tina/improcfuncs.h>
 10 #include <tina/tv.h>
 11 #include <tina/tvfuncs.h>
 12 #include <tina/draw.h>
 13 #include <tina/drawfuncs.h>
 14 #include <tina/toolsfuncs.h>
 15 
 16 Tv     *tv_create();
 17 
 18 static Bool image_on;
 19 static Bool edges_on;
 20 static Bool corners_on;
 21 static Bool strings_on;
 22 static Bool poly_on;
 23 
 24 void    mono_image_on(Bool on)
 25 {
 26     image_on = on;
 27 }
 28 
 29 void    mono_edges_on(Bool on)
 30 {
 31     edges_on = on;
 32 }
 33 
 34 void    mono_corners_on(Bool on)
 35 {
 36     corners_on = on;
 37 }
 38 
 39 void    mono_strings_on(Bool on)
 40 {
 41     strings_on = on;
 42 }
 43 
 44 void    mono_poly_on(Bool on)
 45 {
 46     poly_on = on;
 47 }
 48 
 49 void    mono_backdraw(Tv * tv)
 50 {
 51     Imrect *im = mono_image();
 52 
 53     if (image_on && (im != NULL))
 54     {
 55         im = imf_scale(im, 0.0, 255.0); 
 56         tv_imrect2(tv, im);
 57         im_free(im);
 58     }
 59 }
 60 
 61 void    mono_fulldraw(Tv * tv)
 62 {
 63     Imrect *er = mono_edges();
 64     Imrect *cnr = mono_corners_get();
 65     List   *poly = mono_geom();
 66 
 67     if (edges_on && (er != NULL))
 68         tv_edges_conn(tv, er);
 69     if (corners_on && (cnr != NULL))
 70         tv_edges_conn(tv, cnr);
 71     if (strings_on && (er != NULL))
 72         tv_strings(tv, er);
 73     if (poly_on && poly != NULL)
 74         reclist_list_draw(tv, poly, (int) NULL, geom_col_draw, NULL);
 75 }
 76 
 77 void    mono_init(Tv * tv)
 78 {
 79     Imrect *im = mono_image();
 80     Imrect *er = mono_edges();
 81 
 82     if (im != NULL)
 83         tv_camera2_image(tv, im->width, im->height);
 84     else if (er != NULL)
 85         tv_camera2_image(tv, er->width, er->height);
 86 }
 87 
 88 void    mono_skeldraw(Tv * tv)
 89 {
 90     Imrect *im = mono_image();
 91     Imrect *er = mono_edges();
 92     List   *poly = mono_geom();
 93 
 94     if (image_on && (im != NULL))
 95         tv_imrect_skel(tv, im);
 96     else if ((edges_on || strings_on) && (er != NULL))
 97         tv_imrect_skel(tv, er);
 98     if (poly_on && poly != NULL)
 99         reclist_list_draw(tv, poly, (int) NULL, geom_draw, NULL);
100 }
101 
102 Tv     *mono_tv_make(void)
103 {
104     Tv     *tvmono = NULL;
105 
106     tvmono = tv_create("mono");
107     (void) tv_set_backdraw(tvmono, mono_backdraw);
108     (void) tv_set_fulldraw(tvmono, mono_fulldraw);
109     (void) tv_set_skeldraw(tvmono, mono_skeldraw);
110     (void) tv_set_zoomlevel(tvmono, IMZOOM);
111     tv_set_init(tvmono, mono_init);
112     return (tvmono);
113 }
114 
115 void    mono_grey(Tv * tv, Ipos pos)
116 {
117     Vec2    v = {Vec2_id};
118     Vec2    tv_backproj2();
119     Imrect *im = mono_image();
120     int     x, y, val;
121 
122     v = tv_backproj2(tv, pos);
123     x = vec2_x(v);
124     y = vec2_y(v);
125     val = im_get_pix(im, y, x);
126 
127     format("pos %10d %10d:     grey level = %10d\n", x, y, val);
128 }
129 
130 Tv_mouse mono_grey_mouse(void)
131 {
132     return (mouse_define(MOUSE_NAME, "grey mouse",
133                          LEFT_NAME, "grey",
134                          LEFT_DOWN, mono_grey, NULL));
135 }
136 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.