Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Friends
basic_renderer_rep Class Reference

#include <basic_renderer.hpp>

Inheritance diagram for basic_renderer_rep:
Inheritance graph
[legend]
Collaboration diagram for basic_renderer_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 basic_renderer_rep (int w2=0, int h2=0)
virtual ~basic_renderer_rep ()
virtual void get_extents (int &w, int &h)
virtual bool interrupted (bool check=false)
color rgb (int r, int g, int b, int a=255)
void get_rgb (color col, int &r, int &g, int &b, int &a)
color get_color ()
color get_background ()
void set_clipping (SI x1, SI y1, SI x2, SI y2, bool restore=false)
void set_color (color c)
void set_background (color c)
virtual void begin (void *handle)
virtual void end ()
void encode (SI &x, SI &y)
void decode (SI &x, SI &y)
void fetch (SI x1, SI y1, SI x2, SI y2, renderer ren, SI x, SI y)
void new_shadow (renderer &ren)
void delete_shadow (renderer &ren)
void get_shadow (renderer ren, SI x1, SI y1, SI x2, SI y2)
void put_shadow (renderer ren, SI x1, SI y1, SI x2, SI y2)
void apply_shadow (SI x1, SI y1, SI x2, SI y2)
cache_image_element get_image_cache (tree lookup)
void set_image_cache (tree lookup, cache_image_element ci)
void image_auto_gc ()
void image_gc (string name)
virtual bool is_printer ()
virtual bool is_x_drawable ()
virtual x_drawable_repas_x_drawable ()
virtual void next_page ()
virtual bool repainted ()
void set_origin (SI x, SI y)
void move_origin (SI dx, SI dy)
void set_shrinking_factor (int sfactor)
void round (SI &x, SI &y)
void inner_round (SI &x1, SI &y1, SI &x2, SI &y2)
void outer_round (SI &x1, SI &y1, SI &x2, SI &y2)
bool is_visible (SI x1, SI y1, SI x2, SI y2)
virtual tree get_background_pattern (int &alpha)
virtual void set_background_pattern (tree t, int alpha=255)
virtual void draw (int char_code, font_glyphs fn, SI x, SI y)=0
virtual void set_line_style (SI w, int type=0, bool round=true)=0
virtual void line (SI x1, SI y1, SI x2, SI y2)=0
virtual void lines (array< SI > x, array< SI > y)=0
virtual void clear (SI x1, SI y1, SI x2, SI y2)=0
virtual void clear_pattern (SI x1, SI y1, SI x2, SI y2)
virtual void fill (SI x1, SI y1, SI x2, SI y2)=0
virtual void arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta)=0
virtual void fill_arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta)=0
virtual void polygon (array< SI > x, array< SI > y, bool convex=true)=0
virtual void triangle (SI x1, SI y1, SI x2, SI y2, SI x3, SI y3)
virtual void xpm (url file_name, SI x, SI y)=0
virtual void image (url u, SI w, SI h, SI x, SI y, double cx1, double cy1, double cx2, double cy2, int alpha=255)=0
virtual void get_clipping (SI &x1, SI &y1, SI &x2, SI &y2)
void extra_clipping (SI x1, SI y1, SI x2, SI y2)
void clip (SI x1, SI y1, SI x2, SI y2)
void unclip ()
virtual void anchor (string label, SI x, SI y)
virtual void href (string label, SI x1, SI y1, SI x2, SI y2)
virtual void draw_rectangles (rectangles rs)
virtual void draw_selection (rectangles rs)

Public Attributes

int w
int h
color cur_fg
color cur_bg
SI ox
SI oy
SI cx1
SI cy1
SI cx2
SI cy2
int sfactor
int pixel
int thicken
renderer master
tree pattern
int pattern_alpha
rectangles clip_stack

Friends

void abs_round (SI &l)
void abs_round (SI &x, SI &y)
void abs_inner_round (SI &x1, SI &y1, SI &x2, SI &y2)
void abs_outer_round (SI &x1, SI &y1, SI &x2, SI &y2)

Detailed Description

Definition at line 76 of file basic_renderer.hpp.


Constructor & Destructor Documentation

basic_renderer_rep::basic_renderer_rep ( int  w2 = 0,
int  h2 = 0 
) [inline]

Definition at line 82 of file basic_renderer.hpp.

                                              :
  w (w2), h (h2), cur_fg(black), cur_bg(white) {};
virtual basic_renderer_rep::~basic_renderer_rep ( ) [inline, virtual]

Definition at line 84 of file basic_renderer.hpp.

{};

Member Function Documentation

void renderer_rep::anchor ( string  label,
SI  x,
SI  y 
) [virtual, inherited]

Reimplemented in printer_rep.

Definition at line 68 of file renderer.cpp.

                                             {
  (void) label; (void) x; (void) y;
  return;
}

Here is the caller graph for this function:

void basic_renderer_rep::apply_shadow ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

Implements renderer_rep.

Reimplemented in qt_renderer_rep.

virtual void renderer_rep::arc ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
int  alpha,
int  delta 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

x_drawable_rep * renderer_rep::as_x_drawable ( ) [virtual, inherited]

Reimplemented in x_drawable_rep.

Definition at line 48 of file renderer.cpp.

                             {
  return NULL;
}

Here is the caller graph for this function:

virtual void basic_renderer_rep::begin ( void *  handle) [virtual]
virtual void renderer_rep::clear ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::clear_pattern ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual, inherited]

Definition at line 254 of file renderer.cpp.

                                                       {
  if (pattern == "");
  else if (is_atomic (pattern))
    clear (x1, y1, x2, y2);
  else if (is_func (pattern, PATTERN)) {
    outer_round (x1, y1, x2, y2);
    //cout << "A: " << x1 << ", " << y1 << ", " << x2 << ", " << y2 << "\n";
    //cout << "A: " << x/pixel1 << ", " << y1 << ", " << x2 << ", " << y2 << "\n";
    SI cx1, cy1, cx2, cy2;
    get_clipping (cx1, cy1, cx2, cy2);
    extra_clipping (x1, y1, x2, y2);

    url u= as_string (pattern[0]);
    int imw_pt, imh_pt;
    image_size (u, imw_pt, imh_pt);
    double pt= ((double) 600*PIXEL) / 72.0;
    SI imw= (SI) (((double) imw_pt) * pt);
    SI imh= (SI) (((double) imh_pt) * pt);

    SI w= x2 - x1, h= y2 - y1;
    if (pattern[1] == "") w= imw;
    else if (is_int (pattern[1])) w= as_int (pattern[1]);
    else if (is_percentage (pattern[1]))
      w= (SI) (as_percentage (pattern[1]) * ((double) w));
    else if (is_percentage (pattern[1], "@"))
      w= (SI) (as_percentage (pattern[1]) * ((double) h));
    if (pattern[1] == "") h= imh;
    else if (is_int (pattern[2])) h= as_int (pattern[2]);
    else if (is_percentage (pattern[2]))
      h= (SI) (as_percentage (pattern[2]) * ((double) h));
    else if (is_percentage (pattern[2], "@"))
      h= (SI) (as_percentage (pattern[2]) * ((double) w));
    w= ((w + pixel - 1) / pixel) * pixel;
    h= ((h + pixel - 1) / pixel) * pixel;

    SI sx= 0; //is_percentage (pattern[1])? 0: ox;
    SI sy= 0; //is_percentage (pattern[2])? 0: oy;
    for (int i= ((x1+sx)/w) - 1; i <= ((x2+sx)/w) + 1; i++)
      for (int j= ((y1+sy)/h) - 1; j <= ((y2+sy)/h) + 1; j++) {
       SI X1= i*w     - sx, Y1= j*h     - sy;
       SI X2= (i+1)*w - sx, Y2= (j+1)*h - sy;
       if (X1 < x2 && X2 > x1 && Y1 < y2 && Y2 > y1)
         image (u, w, h, X1, Y1, 0.0, 0.0, 1.0, 1.0, pattern_alpha);
      }
    set_clipping (cx1, cy1, cx2, cy2, true);
  }
  else clear (x1, y1, x2, y2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void renderer_rep::clip ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [inherited]

Definition at line 138 of file renderer.cpp.

                                              {
  rectangle r (cx1, cy1, cx2, cy2);
  clip_stack= rectangles (r, clip_stack);
  set_clipping (x1, y1, x2, y2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void basic_renderer_rep::decode ( SI x,
SI y 
)

Here is the caller graph for this function:

void basic_renderer_rep::delete_shadow ( renderer ren) [virtual]

Implements renderer_rep.

Reimplemented in qt_renderer_rep.

virtual void renderer_rep::draw ( int  char_code,
font_glyphs  fn,
SI  x,
SI  y 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, qt_renderer_rep, x_drawable_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::draw_rectangles ( rectangles  rs) [virtual, inherited]

Definition at line 310 of file renderer.cpp.

                                            {
  rectangles it= rs;
  while (!is_nil (it)) {
    fill (it->item->x1, it->item->y1, it->item->x2, it->item->y2);
    it= it->next;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void renderer_rep::draw_selection ( rectangles  rs) [virtual, inherited]

Definition at line 319 of file renderer.cpp.

                                           {
  color fg= get_color ();
  int r, g, b, a;
  get_rgb_color (fg, r, g, b, a);
  color pfg= rgb_color (r, g, b, (a + 1) / 16);
  rectangles inn= ::thicken (rs, -pixel, -pixel);
  rectangles out= ::simplify (::correct (rs - inn));
  set_color (pfg);
  draw_rectangles (::simplify (inn));
  set_color (fg);
  draw_rectangles (out);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void basic_renderer_rep::encode ( SI x,
SI y 
)

Here is the caller graph for this function:

virtual void basic_renderer_rep::end ( ) [virtual]

Reimplemented in cg_renderer_rep, qt_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::extra_clipping ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [inherited]

Definition at line 129 of file renderer.cpp.

                                                        {
  SI ox1, oy1, ox2, oy2;
  get_clipping (ox1, oy1, ox2, oy2);
  x1= max (x1, ox1); y1= max (y1, oy1);
  x2= max (x1, min (x2, ox2)); y2= max (y1, min (y2, oy2));
  set_clipping (x1, y1, x2, y2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void basic_renderer_rep::fetch ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
renderer  ren,
SI  x,
SI  y 
) [virtual]

Implements renderer_rep.

virtual void renderer_rep::fill ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

virtual void renderer_rep::fill_arc ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
int  alpha,
int  delta 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

Implements renderer_rep.

tree renderer_rep::get_background_pattern ( int &  alpha) [virtual, inherited]

Definition at line 238 of file renderer.cpp.

                                                {
  alpha= pattern_alpha;
  if (is_atomic (pattern) || is_func (pattern, PATTERN, 4))
    return pattern;
  else {
    tree s= get_named_color (get_background ());
    if (is_func (pattern, PATTERN, 3))
      return pattern * tree (PATTERN, s);
    else return s;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void renderer_rep::get_clipping ( SI x1,
SI y1,
SI x2,
SI y2 
) [virtual, inherited]

Definition at line 115 of file renderer.cpp.

                                                          {
  x1= cx1- ox; y1= cy1- oy;
  x2= cx2- ox; y2= cy2- oy;
}

Here is the caller graph for this function:

Implements renderer_rep.

virtual void basic_renderer_rep::get_extents ( int &  w,
int &  h 
) [virtual]

Reimplemented from renderer_rep.

Reimplemented in qt_renderer_rep.

Here is the caller graph for this function:

void basic_renderer_rep::get_rgb ( color  col,
int &  r,
int &  g,
int &  b,
int &  a 
)

Here is the caller graph for this function:

void basic_renderer_rep::get_shadow ( renderer  ren,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]
void renderer_rep::href ( string  label,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual, inherited]

Reimplemented in printer_rep.

Definition at line 74 of file renderer.cpp.

                                                           {
  (void) label;
  (void) x1; (void) y1; (void) x2; (void) y2;
  return;
}

Here is the caller graph for this function:

virtual void renderer_rep::image ( url  u,
SI  w,
SI  h,
SI  x,
SI  y,
double  cx1,
double  cy1,
double  cx2,
double  cy2,
int  alpha = 255 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

Here is the caller graph for this function:

void renderer_rep::inner_round ( SI x1,
SI y1,
SI x2,
SI y2 
) [inherited]

Definition at line 167 of file renderer.cpp.

                                                         {
  x1= RND (x1+ox+pixel-1) - ox;
  y1= RND (y1+oy+pixel-1) - oy;
  x2= RND (x2+ox) - ox;
  y2= RND (y2+oy) - oy;
}
virtual bool basic_renderer_rep::interrupted ( bool  check = false) [virtual]

Reimplemented from renderer_rep.

Here is the caller graph for this function:

bool renderer_rep::is_printer ( ) [virtual, inherited]

Reimplemented in pdf_renderer_rep, and printer_rep.

Definition at line 33 of file renderer.cpp.

                          {
  return false;
}

Here is the caller graph for this function:

bool renderer_rep::is_visible ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [inherited]

Definition at line 152 of file renderer.cpp.

                                                    {
  return
    (x2 >= (cx1- ox)) && (y2 >= (cy1- oy)) &&
    (x1 <  (cx2- ox)) && (y1 <  (cy2- oy));
}

Here is the caller graph for this function:

bool renderer_rep::is_x_drawable ( ) [virtual, inherited]

Reimplemented in x_drawable_rep.

Definition at line 38 of file renderer.cpp.

                             {
  return false;
}
virtual void renderer_rep::line ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

virtual void renderer_rep::lines ( array< SI x,
array< SI y 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::move_origin ( SI  dx,
SI  dy 
) [inherited]

Definition at line 92 of file renderer.cpp.

                                       {
  ox += dx;
  oy += dy;
}

Here is the caller graph for this function:

void basic_renderer_rep::new_shadow ( renderer ren) [virtual]

Implements renderer_rep.

Reimplemented in qt_proxy_renderer_rep, and qt_renderer_rep.

void renderer_rep::next_page ( ) [virtual, inherited]

Reimplemented in pdf_renderer_rep, printer_rep, and cg_renderer_rep.

Definition at line 53 of file renderer.cpp.

                         {
}

Here is the caller graph for this function:

void renderer_rep::outer_round ( SI x1,
SI y1,
SI x2,
SI y2 
) [inherited]

Definition at line 175 of file renderer.cpp.

                                                         {
  x1= RND (x1+ox) - ox;
  y1= RND (y1+oy) - oy;
  x2= RND (x2+ox+pixel-1) - ox;
  y2= RND (y2+oy+pixel-1) - oy;
}

Here is the caller graph for this function:

virtual void renderer_rep::polygon ( array< SI x,
array< SI y,
bool  convex = true 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void basic_renderer_rep::put_shadow ( renderer  ren,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

Implements renderer_rep.

Reimplemented in qt_renderer_rep.

bool renderer_rep::repainted ( ) [virtual, inherited]

Definition at line 57 of file renderer.cpp.

                         {
  return true;
}
color basic_renderer_rep::rgb ( int  r,
int  g,
int  b,
int  a = 255 
)
void renderer_rep::round ( SI x,
SI y 
) [inherited]

Definition at line 161 of file renderer.cpp.

                                 {
  x= RND (x+ ox)- ox;
  y= RND (y+ oy)- oy;
}

Implements renderer_rep.

Here is the caller graph for this function:

void renderer_rep::set_background_pattern ( tree  t,
int  alpha = 255 
) [virtual, inherited]

Definition at line 227 of file renderer.cpp.

                                                         {
  pattern= pat;
  pattern_alpha= alpha;
  if (pattern == "");
  else if (is_atomic (pattern))
    set_background (named_color (pat->label, alpha));
  else if (is_func (pattern, PATTERN, 4))
    set_background (named_color (as_string (pattern[3]), alpha));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void basic_renderer_rep::set_clipping ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
bool  restore = false 
) [virtual]

Reimplemented from renderer_rep.

Reimplemented in qt_renderer_rep.

Here is the caller graph for this function:

void basic_renderer_rep::set_color ( color  c) [virtual]

Implements renderer_rep.

Reimplemented in qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

virtual void renderer_rep::set_line_style ( SI  w,
int  type = 0,
bool  round = true 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::set_origin ( SI  x,
SI  y 
) [inherited]

Definition at line 86 of file renderer.cpp.

                                    {
  ox= x;
  oy= y;
}

Here is the caller graph for this function:

void renderer_rep::set_shrinking_factor ( int  sfactor) [inherited]

Definition at line 98 of file renderer.cpp.

                                          {
  ox  /= sfactor; oy  /= sfactor;
  cx1 /= sfactor; cy1 /= sfactor;
  cx2 /= sfactor; cy2 /= sfactor;
  sfactor= sf;
  pixel  = sf*PIXEL;
  thicken= (sf>>1)*PIXEL;
  ox  *= sfactor; oy  *= sfactor;
  cx1 *= sfactor; cy1 *= sfactor;
  cx2 *= sfactor; cy2 *= sfactor;
}

Here is the caller graph for this function:

void renderer_rep::triangle ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
SI  x3,
SI  y3 
) [virtual, inherited]

Definition at line 218 of file renderer.cpp.

                                                                {
  array<SI> x (3), y (3);
  x[0]= x1; y[0]= y1;
  x[1]= x2; y[1]= y2;
  x[2]= x3; y[2]= y3;
  polygon (x, y);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void renderer_rep::unclip ( ) [inherited]

Definition at line 145 of file renderer.cpp.

                      {
  rectangle r (clip_stack->item);
  set_clipping (r->x1- ox, r->y1- oy, r->x2- ox, r->y2- oy);
  clip_stack= clip_stack->next;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void renderer_rep::xpm ( url  file_name,
SI  x,
SI  y 
) [pure virtual, inherited]

Implemented in printer_rep, pdf_renderer_rep, x_drawable_rep, qt_renderer_rep, cg_renderer_rep, and aqua_renderer_rep.

Here is the caller graph for this function:


Friends And Related Function Documentation

void abs_inner_round ( SI x1,
SI y1,
SI x2,
SI y2 
) [friend, inherited]

Definition at line 198 of file renderer.cpp.

                                                 {
  x1= RND (x1+PIXEL-1);
  y1= RND (y1+PIXEL-1);
  x2= RND (x2);
  y2= RND (y2);
}
void abs_outer_round ( SI x1,
SI y1,
SI x2,
SI y2 
) [friend, inherited]

Definition at line 206 of file renderer.cpp.

                                                 {
  x1= RND (x1);
  y1= RND (y1);
  x2= RND (x2+PIXEL-1);
  y2= RND (y2+PIXEL-1);
}
void abs_round ( SI l) [friend, inherited]

Definition at line 187 of file renderer.cpp.

                  {
  l= RND (l);
}
void abs_round ( SI x,
SI y 
) [friend, inherited]

Definition at line 192 of file renderer.cpp.

                         {
  x= RND (x);
  y= RND (y);
}

Member Data Documentation

Definition at line 44 of file renderer.hpp.

Definition at line 79 of file basic_renderer.hpp.

Definition at line 79 of file basic_renderer.hpp.

SI renderer_rep::cx1 [inherited]

Definition at line 37 of file renderer.hpp.

SI renderer_rep::cx2 [inherited]

Definition at line 37 of file renderer.hpp.

SI renderer_rep::cy1 [inherited]

Definition at line 37 of file renderer.hpp.

SI renderer_rep::cy2 [inherited]

Definition at line 37 of file renderer.hpp.

Definition at line 78 of file basic_renderer.hpp.

Reimplemented in qt_shadow_renderer_rep.

Definition at line 41 of file renderer.hpp.

SI renderer_rep::ox [inherited]

Definition at line 36 of file renderer.hpp.

SI renderer_rep::oy [inherited]

Definition at line 36 of file renderer.hpp.

Definition at line 42 of file renderer.hpp.

int renderer_rep::pattern_alpha [inherited]

Definition at line 43 of file renderer.hpp.

int renderer_rep::pixel [inherited]

Definition at line 39 of file renderer.hpp.

int renderer_rep::sfactor [inherited]

Definition at line 38 of file renderer.hpp.

int renderer_rep::thicken [inherited]

Definition at line 40 of file renderer.hpp.

Definition at line 78 of file basic_renderer.hpp.


The documentation for this class was generated from the following file: