Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

drawPaint_imrect.h File Reference

#include <tina/sys/sysDef.h>
#include <tina/math/mathDef.h>
#include <tina/geometry/geomDef.h>
#include <tinatool/draw/draw_TvDef.h>

Include dependency graph for drawPaint_imrect.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void toggle_bigtolittle (void)
void cmap_get_stdlut (Cmap_data_visible *cmap, int clut, char *im, int loc)
int cmap_get_storage (Cmap_data_visible *cmap)
void tv_imrect_skel (Tv *tv, Imrect *imrect)
void tv_image (Tv *tv, int c, int r, int w, int h, char *data)
void tv_image2 (Tv *tv, int c, int r, int w, int h, char *data)
void tv_imrect (Tv *tv, Imrect *imrect, int sample)
void tv_imrect2_interpol (Tv *tv, Imrect *imrect)
void tv_imrect2 (Tv *tv, Imrect *imrect)
void tv_imrect_row (Tv *tv, Imrect *im, int r)
void tv_imrect_row2 (Tv *tv, Imrect *im, int r)
void tv_edges (Tv *tv, Imrect *edgerect)
void tv_edges_conn (Tv *tv, Imrect *edgerect)
void tv_string2 (Tv *tv, Tstring *string)
void tv_string2_col (Tv *tv, Tstring *string, int type)
void tv_string_list (Tv *tv, List *string_list)
void tv_strings (Tv *tv, Imrect *edgerect)
void tv_edge_string (Tv *tv, Tstring *string)
void tv_edge_match (Tv *tv1, Tv *tv2, Match *em)
void tv_edge_match_list (Tv *tv1, Tv *tv2, List *mlist)
void tv_edges_conn_propmask (Tv *tv, Imrect *edgerect, int mask, int type)
void tv_imrect_scale (Tv *tv, Imrect *imrect, double low, double high)
void tv_imrect_anaglyph (Tv *tv, Imrect *imrect_left, Imrect *imrect_right, double low, double high)
void im_ptr_draw (Tv *tv, Imrect *im, int sx, int sy, void(*drawfunc)(), void *data)
void im_vec2_draw (Tv *tv, Imrect *im, int sx, int sy, double scale)


Function Documentation

void cmap_get_stdlut Cmap_data_visible cmap,
int  clut,
char *  im,
int  loc
 

Definition at line 108 of file drawPaint_imrect.c.

References Cmap_data_visible, cshort_swap(), cword_swap(), cmap_data_visible::nplanes, and cmap_data_visible::std_lut.

Referenced by tv_image2(), tv_imrect(), tv_imrect2(), tv_imrect2_interpol(), tv_imrect_anaglyph(), tv_imrect_row(), tv_imrect_row2(), and tv_imrect_scale().

00109 {
00110     unsigned short *im16 = (unsigned short *) im;
00111     unsigned int *im32 = (unsigned int *) im;
00112     
00113     if (cmap->nplanes == 8)
00114        im[loc] = cmap->std_lut[clut];
00115     else if (cmap->nplanes == 16)
00116     {
00117        im16[loc] = cmap->std_lut[clut]; 
00118        cshort_swap((char *)&im16[loc]);
00119     }
00120      
00121     else if (cmap->nplanes == 24 || cmap->nplanes == 32)
00122     {
00123        im32[loc] = cmap->std_lut[clut];
00124        cword_swap((char *)&im32[loc]);
00125     }
00126 }

Here is the call graph for this function:

int cmap_get_storage Cmap_data_visible cmap  ) 
 

Definition at line 128 of file drawPaint_imrect.c.

References Cmap_data_visible, and cmap_data_visible::nplanes.

Referenced by tv_image2(), tv_imrect(), tv_imrect2(), tv_imrect2_interpol(), tv_imrect_anaglyph(), tv_imrect_row(), tv_imrect_row2(), and tv_imrect_scale().

00129 {
00130     if (cmap->nplanes != 8 && cmap->nplanes !=16 && cmap->nplanes != 24)
00131        errorf(warning,"cmap_get_storage: %d bits not tested \n", cmap->nplanes);
00132     if (cmap->nplanes == 24) return 4;
00133     else return(cmap->nplanes/8);
00134 }

void im_ptr_draw Tv tv,
Imrect *  im,
int  sx,
int  sy,
void(*  drawfunc)(),
void *  data
 

Definition at line 899 of file drawPaint_imrect.c.

References Tv.

Referenced by im_vec2_draw().

00901 {
00902     int     x, y, lx, ly, ux, uy;
00903 
00904     if (tv == NULL || im == NULL)
00905         return;
00906     lx = im->region->lx;
00907     ly = im->region->ly;
00908     ux = im->region->ux;
00909     uy = im->region->uy;
00910     for (x = lx; x < ux; x++)
00911         for (y = ly; y < uy; y++)
00912             (*drawfunc) (tv, IM_PTR(im, y, x), x, y, data);
00913     return;
00914 }

void im_vec2_draw Tv tv,
Imrect *  im,
int  sx,
int  sy,
double  scale
 

Definition at line 931 of file drawPaint_imrect.c.

References im_ptr_draw(), pvec2_draw(), and Tv.

00932 {
00933     double  data[3];
00934 
00935     data[0] = sx;
00936     data[1] = sy;
00937     data[2] = scale;
00938     im_ptr_draw(tv, im, sx, sy, pvec2_draw, data);
00939 }

Here is the call graph for this function:

void toggle_bigtolittle void   ) 
 

Definition at line 103 of file drawPaint_imrect.c.

References bigtolittle.

Referenced by set_bigtolittle_proc(), tw_init(), and tw_read_args().

00104 {
00105     bigtolittle = !bigtolittle;
00106 }

void tv_edge_match Tv tv1,
Tv tv2,
Match *  em
 

Definition at line 691 of file drawPaint_imrect.c.

References Tv, and tv_edge_string().

Referenced by tv_edge_match_list().

00692 {
00693     if (em == NULL)
00694         return;
00695 
00696     tv_edge_string(tv1, (Tstring *) em->to1);
00697     tv_edge_string(tv2, (Tstring *) em->to2);
00698 }

Here is the call graph for this function:

void tv_edge_match_list Tv tv1,
Tv tv2,
List *  mlist
 

Definition at line 700 of file drawPaint_imrect.c.

References Tv, and tv_edge_match().

00701 {
00702     List   *lptr;
00703 
00704     for (lptr = mlist; lptr != NULL; lptr = lptr->next)
00705         tv_edge_match(tv1, tv2, (Match *) lptr->to);
00706 }

Here is the call graph for this function:

void tv_edge_string Tv tv,
Tstring *  string
 

Definition at line 670 of file drawPaint_imrect.c.

References Tv, and tv_pixel2().

Referenced by draw_matchable(), left_string_matches(), tv_edge_match(), and tv_match().

00671 {
00672     List *dptr;
00673     List *end;
00674 
00675     if (string == NULL)
00676         return;
00677 
00678     dptr = string->start;
00679     end = string->end;
00680 
00681     tv_pixel2(tv, edge_image_pos((Edgel *) dptr->to));
00682     if (dptr == end)            /* a single pixel */
00683         return;
00684     for (; dptr != end;)
00685     {
00686         dptr = dptr->next;
00687         tv_pixel2(tv, edge_image_pos((Edgel *) dptr->to));
00688     }
00689 }

Here is the call graph for this function:

void tv_edges Tv tv,
Imrect *  edgerect
 

Definition at line 477 of file drawPaint_imrect.c.

References rfree(), Tv, tv_get_tv_screen_region(), tv_pixel2(), tv_reset_draw(), tv_save_draw(), tv::tv_screen, tv_set_color(), and vec2().

00478 {
00479     int     lx, ly, ux, uy;
00480     int     x, y;
00481     Imregion *tvregion;
00482     Imregion *region;
00483 
00484     if (tv == NULL || tv->tv_screen == NULL || edgerect == NULL)
00485         return;
00486 
00487     tvregion = tv_get_tv_screen_region(tv);
00488     tvregion->ux++;
00489     tvregion->uy++;
00490     region = roi_inter(tvregion, edgerect->region);
00491     rfree((void *) tvregion);
00492 
00493     if (region == NULL)
00494         return;
00495 
00496     lx = region->lx;
00497     ly = region->ly;
00498     ux = region->ux;
00499     uy = region->uy;
00500 
00501     tv_save_draw(tv);
00502     tv_set_color(tv, green);
00503     for (y = ly; y < uy; y++)
00504         for (x = lx; x < ux; x++)
00505         {
00506             Edgel  *eptr = (Edgel *) IM_PTR(edgerect, y, x);
00507 
00508             if (eptr == NULL)
00509                 continue;
00510             tv_pixel2(tv, vec2((float) x, (float) y));
00511         }
00512     rfree((void *) region);
00513 
00514     tv_reset_draw(tv);
00515 }

Here is the call graph for this function:

void tv_edges_conn Tv tv,
Imrect *  edgerect
 

Definition at line 517 of file drawPaint_imrect.c.

References magenta, orange, rfree(), salmon, Tv, tv_get_tv_screen_region(), tv_pixel2(), tv_reset_draw(), tv_save_draw(), tv::tv_screen, tv_set_color(), vec2(), and yellow.

Referenced by fulldraw(), fulldraw2(), fulldrawreg(), left_fulldraw(), mono_canny_proc(), mono_corner_proc(), mono_fulldraw(), right_fulldraw(), seq_fulldraw(), stereo_canny_proc(), stereo_corner_proc(), test_canny_proc(), xpartdraw(), ypartdraw(), and zpartdraw().

00518 {
00519     int     lx, ly, ux, uy;
00520     int     x, y;
00521     Imregion *tvregion;
00522     Imregion *region;
00523 
00524     if (tv == NULL || tv->tv_screen == NULL || edgerect == NULL)
00525         return;
00526 
00527     tvregion = tv_get_tv_screen_region(tv);
00528     tvregion->ux++;
00529     tvregion->uy++;
00530     region = roi_inter(tvregion, edgerect->region);
00531     rfree((void *) tvregion);
00532 
00533     if (region == NULL)
00534         return;
00535 
00536     lx = region->lx;
00537     ly = region->ly;
00538     ux = region->ux;
00539     uy = region->uy;
00540 
00541     tv_save_draw(tv);
00542     for (y = ly; y < uy; y++)
00543         for (x = lx; x < ux; x++)
00544         {
00545             Edgel  *eptr = (Edgel *) IM_PTR(edgerect, y, x);
00546 
00547             if (eptr == NULL)
00548                 continue;
00549 
00550             switch (eptr->type & EDGE_GET_CONN_MASK)
00551             {
00552             case EDGE_NOLINK:
00553                 tv_set_color(tv, salmon);
00554                 break;
00555             case EDGE_TERMIN:
00556                 tv_set_color(tv, blue);
00557                 break;
00558             case EDGE_CONN:
00559                 tv_set_color(tv, magenta);
00560                 break;
00561             case EDGE_JUNC:
00562                 tv_set_color(tv, orange);
00563                 break;
00564             case EDGE_ISOLATED:/* corner feature */
00565                 tv_set_color(tv, yellow);
00566                 break;
00567             }
00568             tv_pixel2(tv, vec2((float) x, (float) y));
00569         }
00570 
00571     tv_reset_draw(tv);
00572 
00573     rfree((void *) region);
00574 }

Here is the call graph for this function:

void tv_edges_conn_propmask Tv tv,
Imrect *  edgerect,
int  mask,
int  type
 

Definition at line 708 of file drawPaint_imrect.c.

References magenta, orange, rfree(), salmon, Tv, tv_get_tv_screen_region(), tv_pixel2(), tv_reset_draw(), tv_save_draw(), tv::tv_screen, tv_set_color(), vec2(), and yellow.

00709 {
00710     int     lx, ly, ux, uy;
00711     int     x, y;
00712     Imregion *tvregion;
00713     Imregion *region;
00714 
00715     if (tv == NULL || tv->tv_screen == NULL || edgerect == NULL || mask == 0)
00716         return;
00717 
00718     tvregion = tv_get_tv_screen_region(tv);
00719     tvregion->ux++;
00720     tvregion->uy++;
00721     region = roi_inter(tvregion, edgerect->region);
00722     rfree((void *) tvregion);
00723 
00724     if (region == NULL)
00725         return;
00726 
00727     lx = region->lx;
00728     ly = region->ly;
00729     ux = region->ux;
00730     uy = region->uy;
00731 
00732     tv_save_draw(tv);
00733     for (y = ly; y < uy; y++)
00734         for (x = lx; x < ux; x++)
00735         {
00736             Edgel  *eptr = (Edgel *) IM_PTR(edgerect, y, x);
00737 
00738             if (eptr == NULL || !((int) prop_get(eptr->props, type) & mask))
00739                 continue;
00740 
00741             switch (eptr->type & EDGE_GET_CONN_MASK)
00742             {
00743             case EDGE_NOLINK:
00744                 tv_set_color(tv, salmon);
00745                 break;
00746             case EDGE_TERMIN:
00747                 tv_set_color(tv, blue);
00748                 break;
00749             case EDGE_CONN:
00750                 tv_set_color(tv, magenta);
00751                 break;
00752             case EDGE_JUNC:
00753                 tv_set_color(tv, orange);
00754                 break;
00755             case EDGE_ISOLATED:/* corner feature */
00756                 tv_set_color(tv, yellow);
00757                 break;
00758             }
00759             tv_pixel2(tv, vec2((float) x, (float) y));
00760         }
00761     rfree((void *) region);
00762 
00763     tv_reset_draw(tv);
00764 }

Here is the call graph for this function:

void tv_image Tv tv,
int  c,
int  r,
int  w,
int  h,
char *  data
 

Definition at line 168 of file drawPaint_imrect.c.

References Tv, tv::tv_screen, and tv_screen_image().

Referenced by tv_imrect(), and tv_imrect2_interpol().

00169 {
00170     if (tv == NULL || tv->tv_screen == NULL)
00171         return;
00172 
00173     tv_screen_image(tv->tv_screen, c, r, w, h, data);
00174 }

Here is the call graph for this function:

void tv_image2 Tv tv,
int  c,
int  r,
int  w,
int  h,
char *  data
 

Definition at line 176 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), tv::height, ipos(), tv::scalex, tv::scaley, Tv, tv_backproj2(), tv_proj2(), tv::tv_screen, tv_screen_image(), vec2(), and tv::width.

Referenced by tv_imrect2(), tv_imrect_anaglyph(), and tv_imrect_scale().

00177 {
00178     int storage;
00179     char *im;
00180     Ipos ll = {Ipos_id};
00181     Ipos ur = {Ipos_id};        /* low left and upper right */
00182     Vec2 origin = {Vec2_id};
00183     int lx, ly, ux, uy;
00184     float sx, sy, imx, imy;
00185     int i, j, k;
00186     if (tv == NULL || tv->tv_screen == NULL)
00187         return;
00188 
00189     storage = cmap_get_storage(tv->cmap_data_visible);
00190     ll = tv_proj2(tv, vec2((float) c, (float) r));
00191     ur = tv_proj2(tv, vec2((float) c + w, (float) r + h));
00192     lx = ipos_x(ll);
00193     ly = ipos_y(ll);
00194     ux = ipos_x(ur);
00195     uy = ipos_y(ur);
00196     sx = (float)(1.0 / tv->scalex);
00197     sy = (float)(1.0 / tv->scaley);
00198     if (lx > ux)
00199     {
00200         SWAP(int, lx, ux);
00201         sx = -sx;
00202     }
00203     if (ly > uy)
00204     {
00205         SWAP(int, ly, uy);
00206         sy = -sy;
00207     }
00208     lx = MAX(0, lx);
00209     ux = MIN(tv->width, ux);
00210     ly = MAX(0, ly);
00211     uy = MIN(tv->height, uy);
00212 
00213     origin = tv_backproj2(tv, ipos(lx, ly));
00214     im = cvector_alloc(0, storage*(ux - lx) * (uy - ly));
00215 
00216     imy = vec2_y(origin);
00217     for (i = ly, k = 0; i < uy; ++i)
00218     {
00219         int y, yoff;
00220         y = (int)(imy - r);
00221         yoff = y * w;
00222 
00223         imx = vec2_x(origin);
00224         for (j = lx; j < ux; ++j, ++k)
00225         {
00226             int x = (int)(imx - c);
00227             if (y < 0 || x < 0 || y >= h || x >= w)
00228             {
00229                 cmap_get_stdlut(tv->cmap_data_visible,0,im,k);
00230             }
00231             else
00232             {
00233                 if (storage==1)
00234                    im[k] = data[yoff+x];
00235                 else if (storage==2)
00236                 {
00237                       im[2*k] = data[2*(yoff+x)];
00238                       im[2*k+1] = data[2*(yoff+x)+1]; 
00239                 }
00240                 else if (storage==3)
00241                 {
00242                       im[3*k] = data[3*(yoff+x)];
00243                       im[3*k+1] = data[3*(yoff+x)+1];
00244                       im[3*k+2] = data[3*(yoff+x)+2];
00245                 }
00246                 else if (storage ==4)
00247                 {
00248                       im[4*k] = data[4*(yoff+x)];
00249                       im[4*k+1] = data[4*(yoff+x)+1];
00250                       im[4*k+2] = data[4*(yoff+x)+2];
00251                       im[4*k+3] = data[4*(yoff+x)+3];
00252                 }
00253             }
00254 
00255             imx += sx;
00256         }
00257         imy += sy;
00258     }
00259 
00260     tv_screen_image(tv->tv_screen, lx, ly, ux - lx, uy - ly, (char *)im);
00261     cvector_free(im, 0);
00262 }

Here is the call graph for this function:

void tv_imrect Tv tv,
Imrect *  imrect,
int  sample
 

Definition at line 264 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), Tv, tv_image(), and tv::tv_screen.

00265 {
00266     char *im;
00267     int     storage;
00268     int     lx, ly, ux, uy;
00269     int     h, w, size;
00270     int     i, j, k;
00271 
00272     if (tv == NULL || tv->tv_screen == NULL || imrect == NULL || imrect->region == NULL)
00273         return;
00274     storage = cmap_get_storage(tv->cmap_data_visible);
00275 
00276     lx = imrect->region->lx;
00277     ux = imrect->region->ux;
00278     ly = imrect->region->ly;
00279     uy = imrect->region->uy;
00280 
00281     h = (uy - ly) / sample;
00282     w = (ux - lx) / sample;
00283     size = h * w;
00284 
00285     im = (char *) cvector_alloc(0, storage*size);
00286 
00287     for (i = ly, k = 0; i < uy; i += sample)
00288     {
00289         for (j = lx; j < ux; j += sample, ++k)
00290         {
00291             int     gl;
00292 
00293             IM_PIX_GET(imrect, i, j, gl);
00294             if (gl < 0)
00295               /* warning: pointer targets in passing argument 3 of 'cmap_get_stdlut' differ in signedness */
00296                 cmap_get_stdlut(tv->cmap_data_visible,0,im,k);
00297             else if (gl > 255)
00298                 cmap_get_stdlut(tv->cmap_data_visible,255,im,k);
00299             else
00300                 cmap_get_stdlut(tv->cmap_data_visible,gl,im,k);
00301         }
00302     }
00303 
00304     tv_image(tv, lx, ly, w, h, (char *) im);
00305     cvector_free(im, 0);
00306 }

Here is the call graph for this function:

void tv_imrect2 Tv tv,
Imrect *  imrect
 

Definition at line 345 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), rfree(), Tv, tv_get_tv_screen_region(), tv_image2(), and tv::tv_screen.

Referenced by backdraw(), col_tv_blue_backdraw(), col_tv_green_backdraw(), col_tv_red_backdraw(), fulldraw(), fulldraw2(), fulldrawreg(), imcalc_draw_scale(), left_backdraw(), mono_backdraw(), right_backdraw(), seq_backdraw(), xpartdraw(), ypartdraw(), and zpartdraw().

00346 {
00347     int    *row;
00348     int storage=1;
00349     char *im;
00350     int     lx, ly, ux, uy;
00351     int     i, j, k;
00352     Imregion *region;
00353     Imregion *tvregion;
00354 
00355     if (tv == NULL || tv->tv_screen == NULL || imrect == NULL)
00356         return;
00357     storage = cmap_get_storage(tv->cmap_data_visible);
00358     tvregion = tv_get_tv_screen_region(tv);
00359     tvregion->ux++;
00360     tvregion->uy++;
00361     region = roi_inter(tvregion, imrect->region);
00362     rfree((void *) tvregion);
00363 
00364     if (region == NULL)
00365         return;
00366 
00367     lx = region->lx;
00368     ux = region->ux;
00369     ly = region->ly;
00370     uy = region->uy;
00371     rfree((void *) region);
00372 
00373     row = ivector_alloc(lx, ux);/* intensisty */
00374 
00375     im = (char *) cvector_alloc(0, storage * (ux - lx) * (uy - ly));
00376 
00377     for (i = ly, k = 0; i < uy; ++i)
00378     {
00379         im_get_row(row, imrect, i, lx, ux);
00380         for (j = lx; j < ux; ++j, ++k)
00381         {
00382             int     gl = row[j];
00383 
00384             if (gl < 0)
00385             {
00386                 cmap_get_stdlut(tv->cmap_data_visible,0,im,k);
00387             }
00388             else if (gl > 255)
00389             {
00390                 cmap_get_stdlut(tv->cmap_data_visible,255,im,k);
00391             }
00392             else
00393             {
00394                 cmap_get_stdlut(tv->cmap_data_visible,gl,im,k);
00395             }
00396         }
00397     }
00398 
00399     tv_image2(tv, lx, ly, ux - lx, uy - ly, (char *) im);
00400     ivector_free(row, lx);
00401     cvector_free(im, 0);
00402 }

Here is the call graph for this function:

void tv_imrect2_interpol Tv tv,
Imrect *  imrect
 

Definition at line 308 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), tv::height, ipos(), Tv, tv_backproj2(), tv_image(), tv::tv_screen, and tv::width.

00309 {
00310     int     storage;
00311     char    *im;
00312     Vec2    v = {Vec2_id};
00313     int     i, j, k;
00314     int     height, width;
00315     int     gl;
00316 
00317 
00318     if (tv == NULL || tv->tv_screen == NULL || imrect == NULL)
00319         return;
00320     storage = cmap_get_storage(tv->cmap_data_visible);
00321 
00322     height = tv->height;
00323     width = tv->width;
00324     im = (char *) cvector_alloc(0, storage* height * width);
00325 
00326     for (i = 0, k = 0; i < height; ++i)
00327     {
00328         for (j = 0; j < width; ++j, ++k)
00329         {
00330             v = tv_backproj2(tv, ipos(j, i));
00331             gl = (int)(im_sub_pixf(imrect, vec2_y(v), vec2_x(v)) + 0.5);
00332             if (gl < 0)
00333                 cmap_get_stdlut(tv->cmap_data_visible,0,im,k);
00334             else if (gl > 255)
00335                 cmap_get_stdlut(tv->cmap_data_visible,255,im,k);
00336             else
00337                 cmap_get_stdlut(tv->cmap_data_visible,gl,im,k);
00338         }
00339     }
00340 
00341     tv_image(tv, 0, 0, width, height, (char *) im);
00342     cvector_free(im, 0);
00343 }

Here is the call graph for this function:

void tv_imrect_anaglyph Tv tv,
Imrect *  imrect_left,
Imrect *  imrect_right,
double  low,
double  high
 

Definition at line 824 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), LIMIT_TO_UCHAR, rfree(), Tv, tv_get_tv_screen_region(), tv_image2(), and tv::tv_screen.

Referenced by anaglyph_proc(), fulldraw(), xpartdraw(), ypartdraw(), and zpartdraw().

00825 {
00826     int storage;
00827     float *row1, *row2;
00828     if (tv && tv->tv_screen && imrect_left && imrect_right)
00829     {
00830 
00831 /* Memory leak fixed PAB 21 / 4 / 2004: double call of roi_outer leaked a roi */
00832 
00833         Imregion *region, *region2;
00834         Imregion *tvregion;
00835         Imregion *tv_get_tv_screen_region();
00836 
00837         tvregion = tv_get_tv_screen_region(tv);
00838         tvregion->ux++;
00839         tvregion->uy++;
00840         region = roi_outer(imrect_right->region, imrect_left->region);
00841         region2 = roi_outer(tvregion, region);
00842         rfree((void *) tvregion);
00843         rfree((void *) region);
00844         storage = cmap_get_storage(tv->cmap_data_visible);
00845 
00846         if (region2)
00847         {
00848             double  scale255 = 255 / (high - low);
00849             int     gl_left, gl_right;
00850             int     k;
00851             int     row, col;
00852             int     x1 = region2->lx;   /* Top left x co-ord */
00853             int     x2 = region2->ux;   /* Bottom right x co-ord */
00854             int     y1 = region2->ly;   /* Top left y co-ord */
00855             int     y2 = region2->uy;   /* Bottom right y co-ord */
00856             unsigned char gluc_left, gluc_right;
00857             char *image_anag = (char *) cvector_alloc(0, storage*(x2 - x1) * (y2 - y1));
00858 
00859             rfree((void *) region2);
00860             row1 = fvector_alloc(x1, x2);
00861             row2 = fvector_alloc(x1, x2);
00862 
00863 
00864             /* For each row in the image */
00865             for (row = y1, k = 0; row < y2; ++row)
00866             {
00867                 im_get_rowf(row1, imrect_left, row, x1, x2);
00868                 im_get_rowf(row2, imrect_right, row, x1, x2);
00869                 
00870                 /* For each column in the row */
00871                 for (col = x1; col < x2; ++col, k++)
00872                 {
00873                     /* Get the scaled left grey-level */
00874                     gl_left = (int) ((row1[col] - low) * scale255);
00875                     gluc_left = LIMIT_TO_UCHAR(gl_left);
00876 
00877                     /* Get the scaled right grey-level */
00878                     gl_right = (int) ((row2[col] - low) * scale255);
00879                     gluc_right = LIMIT_TO_UCHAR(gl_right);
00880 
00881                     /* Left = green = hi nibble. Right = red = lo
00882                      * nibble */
00883                     cmap_get_stdlut(tv->cmap_data_visible,
00884                         (gluc_left & 0xf0) | (gluc_right >> 4),image_anag,k);
00885 
00886                 }
00887             }
00888             tv_image2(tv, x1, y1, x2 - x1, y2 - y1, (char *) image_anag);
00889             cvector_free(image_anag, 0);
00890             fvector_free(row1, x1);
00891             fvector_free(row2, x1);
00892 
00893         }
00894     }
00895 }

Here is the call graph for this function:

void tv_imrect_row Tv tv,
Imrect *  im,
int  r
 

Definition at line 404 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), Tv, tv_raster(), and tv::tv_screen.

00405 {
00406     int    *row;
00407     int storage;
00408     char *rast;
00409     int     lx, ux;
00410     int     i;
00411 
00412     if (tv == NULL || tv->tv_screen == NULL || im == NULL || im->region == NULL)
00413         return;
00414     storage = cmap_get_storage(tv->cmap_data_visible);
00415 
00416     lx = im->region->lx;
00417     ux = im->region->ux;
00418 
00419     row = ivector_alloc(lx, ux);
00420     rast = (char *) cvector_alloc(storage*lx, storage*ux);      
00421 
00422     im_get_row(row, im, r, lx, ux);
00423     for (i = lx; i < ux; ++i)
00424                 cmap_get_stdlut(tv->cmap_data_visible,row[i],rast,i);
00425 
00426 
00427     /* BUG tv_raster(tv, x1, x2, y, char   *raster) NOT unsigned char* */
00428     tv_raster(tv, lx, ux, i, (char *) rast);
00429 
00430     ivector_free(row, lx);
00431     cvector_free(rast, lx);
00432 }

Here is the call graph for this function:

void tv_imrect_row2 Tv tv,
Imrect *  im,
int  r
 

Definition at line 434 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), rfree(), Tv, tv_get_tv_screen_region(), tv_raster(), and tv::tv_screen.

00435 {
00436     int    *row;
00437     int     storage;
00438     char *rast;
00439     int     lx, ux;
00440     Imregion *region;
00441     Imregion *tvregion;
00442     int     i;
00443 
00444     if (tv == NULL || tv->tv_screen == NULL || im == NULL)
00445         return;
00446     storage = cmap_get_storage(tv->cmap_data_visible);
00447 
00448     tvregion = tv_get_tv_screen_region(tv);
00449     tvregion->ux++;
00450     tvregion->uy++;
00451     region = roi_inter(tvregion, im->region);
00452     rfree((void *) tvregion);
00453 
00454     if (region == NULL)
00455         return;
00456 
00457     lx = region->lx;
00458     ux = region->ux;
00459     rfree((void *) region);
00460 
00461     row = ivector_alloc(lx, ux);/* intensisty */
00462     rast = (char *) cvector_alloc(storage*lx, storage*ux);      /* display grey level */
00463 
00464     im_get_row(row, im, r, lx, ux);
00465     for (i = lx; i < ux; ++i)
00466         cmap_get_stdlut(tv->cmap_data_visible,row[i],rast,i);
00467 
00468 
00469 
00470     /* BUG tv_raster(tv, lx, ux, i,char *rast NOT unsigned char * */
00471     tv_raster(tv, lx, ux, i, (char *) rast);
00472 
00473     ivector_free(row, lx);
00474     cvector_free(rast, lx);
00475 }

Here is the call graph for this function:

void tv_imrect_scale Tv tv,
Imrect *  imrect,
double  low,
double  high
 

Definition at line 766 of file drawPaint_imrect.c.

References tv::cmap_data_visible, cmap_get_stdlut(), cmap_get_storage(), rfree(), Tv, tv_get_tv_screen_region(), tv_image2(), and tv::tv_screen.

00767 {
00768     char *im;
00769     int     storage;
00770     int     lx, ly, ux, uy;
00771     int     i, j, k, gl;
00772     double  gld, scale255;
00773     Imregion *region;
00774     Imregion *tvregion;
00775     Imregion *tv_get_tv_screen_region();
00776 
00777     if (tv == NULL || tv->tv_screen == NULL || imrect == NULL)
00778         return;
00779     storage = cmap_get_storage(tv->cmap_data_visible);
00780     tvregion = tv_get_tv_screen_region(tv);
00781     tvregion->ux++;
00782     tvregion->uy++;
00783     region = roi_inter(tvregion, imrect->region);
00784     rfree((void *) tvregion);
00785 
00786     if (region == NULL)
00787         return;
00788 
00789     lx = region->lx;
00790     ux = region->ux;
00791     ly = region->ly;
00792     uy = region->uy;
00793     rfree((void *) region);
00794 
00795     /* display grey level */
00796     im = (char *) cvector_alloc(0, (ux - lx) * (uy - ly));
00797     scale255 = 255 / (high - low);
00798 
00799     for (i = ly, k = 0; i < uy; ++i)
00800     {
00801         for (j = lx; j < ux; ++j, ++k)
00802         {
00803             IM_PIX_GET(imrect, i, j, gld);
00804             gl = (int) ((gld - low) * scale255);
00805             if (gl < 0)
00806                 cmap_get_stdlut(tv->cmap_data_visible,0,im,k);
00807 
00808             else if (gl > 255)
00809                 cmap_get_stdlut(tv->cmap_data_visible,255,im,k);
00810 
00811             else
00812                 cmap_get_stdlut(tv->cmap_data_visible,gl,im,k);
00813         }
00814     }
00815 
00816     tv_image2(tv, lx, ly, ux - lx, uy - ly, (char *) im);
00817     cvector_free(im, 0);
00818 }

Here is the call graph for this function:

void tv_imrect_skel Tv tv,
Imrect *  imrect
 

Definition at line 141 of file drawPaint_imrect.c.

References linexy(), Tv, and tv::tv_screen.

Referenced by col_tv_blue_skeldraw(), col_tv_green_skeldraw(), col_tv_red_skeldraw(), left_skeldraw(), mono_skeldraw(), right_skeldraw(), seq_skeldraw(), skeldraw(), skeldraw2(), and skeldrawreg().

00142 {
00143     int     lx, ly, ux, uy;
00144     int     dx, dy;
00145     int     x, y;
00146 
00147     if (tv == NULL || tv->tv_screen == NULL || imrect == NULL || imrect->region == NULL)
00148         return;
00149 
00150     lx = imrect->region->lx;
00151     ux = imrect->region->ux;
00152     ly = imrect->region->ly;
00153     uy = imrect->region->uy;
00154 
00155     dx = (ux - lx) / 16;
00156     dy = (uy - ly) / 16;
00157     if (dx<1) dx = 1; /* BUG fix NAT */
00158     if (dy<1) dy = 1; /* 26/5/95     */
00159 
00160     for (x = lx; x < ux; x += dx)
00161         linexy(tv, x, ly, x, uy);
00162     linexy(tv, ux, ly, ux, uy);
00163     for (y = ly; y < uy; y += dy)
00164         linexy(tv, lx, y, ux, y);
00165     linexy(tv, lx, y, ux, y);
00166 }

Here is the call graph for this function:

void tv_string2 Tv tv,
Tstring *  string
 

Definition at line 576 of file drawPaint_imrect.c.

References Tv, tv_cross2(), tv_line2(), tv_pixel2(), and tv_point2().

00577 {
00578     List *start;
00579     List *end;
00580     List *dptr;
00581     Vec2    oldpos = {Vec2_id};
00582     Vec2    pos = {Vec2_id};
00583 
00584     if (string == NULL)
00585         return;
00586 
00587     start = string->start;
00588     end = string->end;
00589 
00590     if (start == end)
00591     {
00592         tv_pixel2(tv, edge_image_pos((Edgel *) start->to));
00593         return;
00594     }
00595     oldpos = edge_image_pos((Edgel *) start->to);
00596     tv_cross2(tv, oldpos, 5);
00597     for (dptr = start; dptr != end;)
00598     {
00599         dptr = dptr->next;
00600         pos = edge_image_pos((Edgel *) dptr->to);
00601         tv_point2(tv, oldpos);  /* for xor */
00602         tv_line2(tv, oldpos, pos);
00603         oldpos = pos;
00604     }
00605     tv_cross2(tv, oldpos, 5);
00606 }

Here is the call graph for this function:

void tv_string2_col Tv tv,
Tstring *  string,
int  type
 

Definition at line 608 of file drawPaint_imrect.c.

References salmon, Tv, tv_color_set(), tv_line2(), tv_pixel2(), tv_point2(), tv_reset_draw(), and tv_save_draw().

Referenced by tv_string_list().

00609 {
00610     List *start;
00611     List *end;
00612     List *dptr;
00613     Vec2    oldpos = {Vec2_id};
00614     Vec2    pos = {Vec2_id};
00615 
00616     if (string == NULL)
00617         return;
00618 
00619     start = string->start;
00620     end = string->end;
00621 
00622     tv_save_draw(tv);
00623     if (start == end)
00624     {
00625         tv_color_set(tv, salmon);
00626         tv_pixel2(tv, edge_image_pos((Edgel *) start->to));
00627         tv_reset_draw(tv);
00628         return;
00629     }
00630     oldpos = edge_image_pos((Edgel *) start->to);
00631     tv_color_set(tv, red);
00632     tv_point2(tv, oldpos);
00633     for (dptr = start; dptr != end;)
00634     {
00635         dptr = dptr->next;
00636         pos = edge_image_pos((Edgel *) dptr->to);
00637         tv_color_set(tv, salmon);
00638         tv_line2(tv, oldpos, pos);
00639         oldpos = pos;
00640     }
00641     tv_color_set(tv, red);
00642     tv_point2(tv, oldpos);
00643     tv_reset_draw(tv);
00644 }

Here is the call graph for this function:

void tv_string_list Tv tv,
List *  string_list
 

Definition at line 646 of file drawPaint_imrect.c.

References Tv, tv::tv_screen, and tv_string2_col().

Referenced by tv_strings().

00647 {
00648     List   *sptr;
00649     int    type;
00650 
00651     if (tv == NULL || tv->tv_screen == NULL || string_list == NULL)
00652         return;
00653 
00654     for (sptr = string_list; sptr != NULL; sptr = sptr->next)
00655         tv_string2_col(tv, sptr->to, type);
00656 }

Here is the call graph for this function:

void tv_strings Tv tv,
Imrect *  edgerect
 

Definition at line 658 of file drawPaint_imrect.c.

References Tv, tv_save_draw(), tv::tv_screen, and tv_string_list().

Referenced by fulldraw(), fulldraw2(), fulldrawreg(), left_fulldraw(), mono_fulldraw(), and right_fulldraw().

00659 {
00660     List   *string_list;
00661 
00662     if (tv == NULL || tv->tv_screen == NULL || edgerect == NULL)
00663         return;
00664 
00665     string_list = (List *) prop_get(edgerect->props, STRING);
00666     tv_save_draw(tv);
00667     tv_string_list(tv, string_list);
00668 }

Here is the call graph for this function:


Generated on Thu Nov 12 02:20:59 2009 for Tools by doxygen 1.3.6