rtk_fig.c File Reference

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "rtk.h"
#include "rtkprivate.h"


Defines

#define _GNU_SOURCE
#define CROP(p)
#define DX_TO_GX(x)   ((+(x) - fig->canvas->sizex / 2) * fig->canvas->sx + fig->canvas->ox)
#define DY_TO_GY(y)   ((-(y) + fig->canvas->sizey / 2) * fig->canvas->sy + fig->canvas->oy)
#define GA(a)   (fig->doa + (a))
#define GTOD(p, q)   {p.x = GX_TO_DX(q.x); p.y = GY_TO_DY(q.y);}
#define GTOP(p, fx, fy)   {p.x = PX(GX(fx, fy)); p.y = PY(GY(fx, fy));}
#define GX(x, y)   (fig->dox + (x) * fig->dsx * fig->dcos - (y) * fig->dsy * fig->dsin)
#define GX_TO_DX(x)   (fig->canvas->sizex / 2 + ((x) - fig->canvas->ox) / fig->canvas->sx)
#define GX_TO_LX(x, y)
#define GY(x, y)   (fig->doy + (x) * fig->dsx * fig->dsin + (y) * fig->dsy * fig->dcos)
#define GY_TO_DY(y)   (fig->canvas->sizey / 2 - ((y) - fig->canvas->oy) / fig->canvas->sy)
#define GY_TO_LY(x, y)
#define LTOD(p, fx, fy)   {p.x = GX_TO_DX(GX(fx, fy)); p.y = GY_TO_DY(GY(fx, fy));}
#define LTOG(p, fx, fy)   {p.x = GX(fx, fy); p.y = GY(fx, fy);}
#define PA(a)   (fig->canvas->sy < 0 ? -(a) : (a))
#define PX(x)   (GX_TO_DX(x) * 1200 * 6 / fig->canvas->sizex)
#define PY(y)   (GY_TO_DY(y) * 1200 * 6 / fig->canvas->sizex)
#define SETP(p, fx, fy)   {p.x = fx; p.y = fy;}

Functions

void stg_rtk_fig_add_mouse_handler (stg_rtk_fig_t *fig, stg_rtk_mouse_fn_t callback)
void stg_rtk_fig_and_descendents_destroy (stg_rtk_fig_t *fig)
void stg_rtk_fig_arrow (stg_rtk_fig_t *fig, double ox, double oy, double oa, double len, double head)
void stg_rtk_fig_arrow_ex (stg_rtk_fig_t *fig, double ax, double ay, double bx, double by, double head)
void stg_rtk_fig_arrow_fancy (stg_rtk_fig_t *fig, double ox, double oy, double oa, double len, double head, double thickness, int filled)
void stg_rtk_fig_blink (stg_rtk_fig_t *fig, int interval_ms, int flag)
gboolean stg_rtk_fig_blink_callback (void *data)
void stg_rtk_fig_calc (stg_rtk_fig_t *fig)
void stg_rtk_fig_calc_selection (stg_rtk_fig_t *fig)
void stg_rtk_fig_clear (stg_rtk_fig_t *fig)
void stg_rtk_fig_color (stg_rtk_fig_t *fig, double r, double g, double b)
void stg_rtk_fig_color_rgb32 (stg_rtk_fig_t *fig, int color)
stg_rtk_fig_tstg_rtk_fig_create (stg_rtk_canvas_t *canvas, stg_rtk_fig_t *parent, int layer)
stg_rtk_fig_tstg_rtk_fig_create_ex (stg_rtk_canvas_t *canvas, stg_rtk_fig_t *parent, int layer, void *userdata)
void stg_rtk_fig_destroy (stg_rtk_fig_t *fig)
void stg_rtk_fig_dirty (stg_rtk_fig_t *fig)
void stg_rtk_fig_ellipse (stg_rtk_fig_t *fig, double ox, double oy, double oa, double sx, double sy, int filled)
void stg_rtk_fig_ellipse_arc (stg_rtk_fig_t *fig, double ox, double oy, double oa, double sx, double sy, double min_th, double max_th)
void stg_rtk_fig_get_origin (stg_rtk_fig_t *fig, double *ox, double *oy, double *oa)
void stg_rtk_fig_grid (stg_rtk_fig_t *fig, double ox, double oy, double dx, double dy, double sp)
int stg_rtk_fig_hittest (stg_rtk_fig_t *fig, int dx, int dy)
void stg_rtk_fig_image (stg_rtk_fig_t *fig, double ox, double oy, double oa, double scale, int width, int height, int bpp, void *image, void *mask)
void stg_rtk_fig_image_alloc (stg_rtk_fig_t *fig, double ox, double oy, double oa, double scale, int width, int height, int bpp, const void *image, const void *mask)
void stg_rtk_fig_image_calc (stg_rtk_fig_t *fig, stg_rtk_image_stroke_t *data)
void stg_rtk_fig_image_draw (stg_rtk_fig_t *fig, stg_rtk_image_stroke_t *data)
void stg_rtk_fig_image_free (stg_rtk_fig_t *fig, stg_rtk_image_stroke_t *data)
void stg_rtk_fig_line (stg_rtk_fig_t *fig, double ax, double ay, double bx, double by)
void stg_rtk_fig_line_ex (stg_rtk_fig_t *fig, double ox, double oy, double oa, double size)
void stg_rtk_fig_linewidth (stg_rtk_fig_t *fig, int width)
int stg_rtk_fig_mouse_over (stg_rtk_fig_t *fig)
int stg_rtk_fig_mouse_selected (stg_rtk_fig_t *fig)
void stg_rtk_fig_movemask (stg_rtk_fig_t *fig, int mask)
void stg_rtk_fig_on_mouse (stg_rtk_fig_t *fig, int event, int mode)
void stg_rtk_fig_origin (stg_rtk_fig_t *fig, double ox, double oy, double oa)
void stg_rtk_fig_origin_global (stg_rtk_fig_t *fig, double ox, double oy, double oa)
void stg_rtk_fig_point (stg_rtk_fig_t *fig, double ox, double oy)
void stg_rtk_fig_point_alloc (stg_rtk_fig_t *fig, double ox, double oy)
void stg_rtk_fig_point_calc (stg_rtk_fig_t *fig, stg_rtk_point_stroke_t *data)
void stg_rtk_fig_point_draw (stg_rtk_fig_t *fig, stg_rtk_point_stroke_t *data)
void stg_rtk_fig_point_free (stg_rtk_fig_t *fig, stg_rtk_point_stroke_t *data)
void stg_rtk_fig_polygon (stg_rtk_fig_t *fig, double ox, double oy, double oa, int point_count, double points[][2], int filled)
void stg_rtk_fig_polygon_alloc (stg_rtk_fig_t *fig, double ox, double oy, double oa, int closed, int filled, int point_count, stg_rtk_point_t *points)
void stg_rtk_fig_polygon_calc (stg_rtk_fig_t *fig, stg_rtk_polygon_stroke_t *data)
void stg_rtk_fig_polygon_draw (stg_rtk_fig_t *fig, stg_rtk_polygon_stroke_t *data)
void stg_rtk_fig_polygon_free (stg_rtk_fig_t *fig, stg_rtk_polygon_stroke_t *data)
void stg_rtk_fig_rectangle (stg_rtk_fig_t *fig, double ox, double oy, double oa, double sx, double sy, int filled)
void stg_rtk_fig_remove_mouse_handler (stg_rtk_fig_t *fig, stg_rtk_mouse_fn_t callback)
void stg_rtk_fig_render (stg_rtk_fig_t *fig)
void stg_rtk_fig_render_selection (stg_rtk_fig_t *fig)
void stg_rtk_fig_scale (stg_rtk_fig_t *fig, double scale)
void stg_rtk_fig_show (stg_rtk_fig_t *fig, int show)
void stg_rtk_fig_stroke_add (stg_rtk_fig_t *fig, stg_rtk_stroke_t *stroke)
void stg_rtk_fig_text (stg_rtk_fig_t *fig, double ox, double oy, double oa, const char *text)
void stg_rtk_fig_text_alloc (stg_rtk_fig_t *fig, double ox, double oy, double oa, const char *text, double *width, double *height)
void stg_rtk_fig_text_bubble (stg_rtk_fig_t *fig, double ox, double oy, double oa, const char *text, double bx, double by)
void stg_rtk_fig_text_calc (stg_rtk_fig_t *fig, stg_rtk_text_stroke_t *data)
void stg_rtk_fig_text_draw (stg_rtk_fig_t *fig, stg_rtk_text_stroke_t *data)
void stg_rtk_fig_text_free (stg_rtk_fig_t *fig, stg_rtk_text_stroke_t *data)
gboolean test_callback (void *data)

Define Documentation

#define _GNU_SOURCE
 

#define CROP  ) 
 

Value:

(p.x < 0 || p.x >= 1200 * 6 || \
                 p.y < 0 || p.y >= 1200 * 6)

#define DX_TO_GX  )     ((+(x) - fig->canvas->sizex / 2) * fig->canvas->sx + fig->canvas->ox)
 

#define DY_TO_GY  )     ((-(y) + fig->canvas->sizey / 2) * fig->canvas->sy + fig->canvas->oy)
 

#define GA  )     (fig->doa + (a))
 

#define GTOD p,
 )     {p.x = GX_TO_DX(q.x); p.y = GY_TO_DY(q.y);}
 

#define GTOP p,
fx,
fy   )     {p.x = PX(GX(fx, fy)); p.y = PY(GY(fx, fy));}
 

#define GX x,
 )     (fig->dox + (x) * fig->dsx * fig->dcos - (y) * fig->dsy * fig->dsin)
 

#define GX_TO_DX  )     (fig->canvas->sizex / 2 + ((x) - fig->canvas->ox) / fig->canvas->sx)
 

#define GX_TO_LX x,
 ) 
 

Value:

(+((x) - fig->dox) / fig->dsx * fig->dcos + \
                    ((y) - fig->doy) / fig->dsy * fig->dsin)

#define GY x,
 )     (fig->doy + (x) * fig->dsx * fig->dsin + (y) * fig->dsy * fig->dcos)
 

#define GY_TO_DY  )     (fig->canvas->sizey / 2 - ((y) - fig->canvas->oy) / fig->canvas->sy)
 

#define GY_TO_LY x,
 ) 
 

Value:

(-((x) - fig->dox) / fig->dsx * fig->dsin + \
                    ((y) - fig->doy) / fig->dsy * fig->dcos)

#define LTOD p,
fx,
fy   )     {p.x = GX_TO_DX(GX(fx, fy)); p.y = GY_TO_DY(GY(fx, fy));}
 

#define LTOG p,
fx,
fy   )     {p.x = GX(fx, fy); p.y = GY(fx, fy);}
 

#define PA  )     (fig->canvas->sy < 0 ? -(a) : (a))
 

#define PX  )     (GX_TO_DX(x) * 1200 * 6 / fig->canvas->sizex)
 

#define PY  )     (GY_TO_DY(y) * 1200 * 6 / fig->canvas->sizex)
 

#define SETP p,
fx,
fy   )     {p.x = fx; p.y = fy;}
 


Function Documentation

void stg_rtk_fig_add_mouse_handler stg_rtk_fig_t fig,
stg_rtk_mouse_fn_t  callback
 

void stg_rtk_fig_and_descendents_destroy stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_arrow stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  len,
double  head
 

void stg_rtk_fig_arrow_ex stg_rtk_fig_t fig,
double  ax,
double  ay,
double  bx,
double  by,
double  head
 

void stg_rtk_fig_arrow_fancy stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  len,
double  head,
double  thickness,
int  filled
 

void stg_rtk_fig_blink stg_rtk_fig_t fig,
int  interval_ms,
int  flag
 

gboolean stg_rtk_fig_blink_callback void *  data  ) 
 

void stg_rtk_fig_calc stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_calc_selection stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_clear stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_color stg_rtk_fig_t fig,
double  r,
double  g,
double  b
 

void stg_rtk_fig_color_rgb32 stg_rtk_fig_t fig,
int  color
 

stg_rtk_fig_t* stg_rtk_fig_create stg_rtk_canvas_t canvas,
stg_rtk_fig_t parent,
int  layer
 

stg_rtk_fig_t* stg_rtk_fig_create_ex stg_rtk_canvas_t canvas,
stg_rtk_fig_t parent,
int  layer,
void *  userdata
 

void stg_rtk_fig_destroy stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_dirty stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_ellipse stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  sx,
double  sy,
int  filled
 

void stg_rtk_fig_ellipse_arc stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  sx,
double  sy,
double  min_th,
double  max_th
 

void stg_rtk_fig_get_origin stg_rtk_fig_t fig,
double *  ox,
double *  oy,
double *  oa
 

void stg_rtk_fig_grid stg_rtk_fig_t fig,
double  ox,
double  oy,
double  dx,
double  dy,
double  sp
 

int stg_rtk_fig_hittest stg_rtk_fig_t fig,
int  dx,
int  dy
 

void stg_rtk_fig_image stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  scale,
int  width,
int  height,
int  bpp,
void *  image,
void *  mask
 

void stg_rtk_fig_image_alloc stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  scale,
int  width,
int  height,
int  bpp,
const void *  image,
const void *  mask
 

void stg_rtk_fig_image_calc stg_rtk_fig_t fig,
stg_rtk_image_stroke_t data
 

void stg_rtk_fig_image_draw stg_rtk_fig_t fig,
stg_rtk_image_stroke_t data
 

void stg_rtk_fig_image_free stg_rtk_fig_t fig,
stg_rtk_image_stroke_t data
 

void stg_rtk_fig_line stg_rtk_fig_t fig,
double  ax,
double  ay,
double  bx,
double  by
 

void stg_rtk_fig_line_ex stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  size
 

void stg_rtk_fig_linewidth stg_rtk_fig_t fig,
int  width
 

int stg_rtk_fig_mouse_over stg_rtk_fig_t fig  ) 
 

int stg_rtk_fig_mouse_selected stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_movemask stg_rtk_fig_t fig,
int  mask
 

void stg_rtk_fig_on_mouse stg_rtk_fig_t fig,
int  event,
int  mode
 

void stg_rtk_fig_origin stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa
 

void stg_rtk_fig_origin_global stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa
 

void stg_rtk_fig_point stg_rtk_fig_t fig,
double  ox,
double  oy
 

void stg_rtk_fig_point_alloc stg_rtk_fig_t fig,
double  ox,
double  oy
 

void stg_rtk_fig_point_calc stg_rtk_fig_t fig,
stg_rtk_point_stroke_t data
 

void stg_rtk_fig_point_draw stg_rtk_fig_t fig,
stg_rtk_point_stroke_t data
 

void stg_rtk_fig_point_free stg_rtk_fig_t fig,
stg_rtk_point_stroke_t data
 

void stg_rtk_fig_polygon stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
int  point_count,
double  points[][2],
int  filled
 

void stg_rtk_fig_polygon_alloc stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
int  closed,
int  filled,
int  point_count,
stg_rtk_point_t points
 

void stg_rtk_fig_polygon_calc stg_rtk_fig_t fig,
stg_rtk_polygon_stroke_t data
 

void stg_rtk_fig_polygon_draw stg_rtk_fig_t fig,
stg_rtk_polygon_stroke_t data
 

void stg_rtk_fig_polygon_free stg_rtk_fig_t fig,
stg_rtk_polygon_stroke_t data
 

void stg_rtk_fig_rectangle stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
double  sx,
double  sy,
int  filled
 

void stg_rtk_fig_remove_mouse_handler stg_rtk_fig_t fig,
stg_rtk_mouse_fn_t  callback
 

void stg_rtk_fig_render stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_render_selection stg_rtk_fig_t fig  ) 
 

void stg_rtk_fig_scale stg_rtk_fig_t fig,
double  scale
 

void stg_rtk_fig_show stg_rtk_fig_t fig,
int  show
 

void stg_rtk_fig_stroke_add stg_rtk_fig_t fig,
stg_rtk_stroke_t stroke
 

void stg_rtk_fig_text stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
const char *  text
 

void stg_rtk_fig_text_alloc stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
const char *  text,
double *  width,
double *  height
 

void stg_rtk_fig_text_bubble stg_rtk_fig_t fig,
double  ox,
double  oy,
double  oa,
const char *  text,
double  bx,
double  by
 

void stg_rtk_fig_text_calc stg_rtk_fig_t fig,
stg_rtk_text_stroke_t data
 

void stg_rtk_fig_text_draw stg_rtk_fig_t fig,
stg_rtk_text_stroke_t data
 

void stg_rtk_fig_text_free stg_rtk_fig_t fig,
stg_rtk_text_stroke_t data
 

gboolean test_callback void *  data  ) 
 


Generated on Thu Dec 13 14:35:18 2007 for Stage by  doxygen 1.4.6