Back to index

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

#include <renderer.hpp>

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

List of all members.

Public Member Functions

 renderer_rep ()
virtual ~renderer_rep ()
virtual bool is_printer ()
virtual bool is_x_drawable ()
virtual x_drawable_repas_x_drawable ()
virtual void get_extents (int &w, int &h)
virtual void next_page ()
virtual bool repainted ()
virtual bool interrupted (bool check=false)
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 color get_color ()=0
virtual color get_background ()=0
virtual tree get_background_pattern (int &alpha)
virtual void set_color (color c)=0
virtual void set_background (color c)=0
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)
virtual void set_clipping (SI x1, SI y1, SI x2, SI y2, bool restore=false)
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 fetch (SI x1, SI y1, SI x2, SI y2, renderer ren, SI x, SI y)=0
virtual void new_shadow (renderer &ren)=0
virtual void delete_shadow (renderer &ren)=0
virtual void get_shadow (renderer ren, SI x1, SI y1, SI x2, SI y2)=0
virtual void put_shadow (renderer ren, SI x1, SI y1, SI x2, SI y2)=0
virtual void apply_shadow (SI x1, SI y1, SI x2, SI y2)=0
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

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 34 of file renderer.hpp.


Constructor & Destructor Documentation

Definition at line 21 of file renderer.cpp.

                           :
  ox (0), oy (0), cx1 (0), cy1 (0), cx2 (0), cy2 (0),
  sfactor (1), pixel (PIXEL), thicken (0),
  master (NULL), pattern (UNINIT), pattern_alpha (255) {}

Definition at line 26 of file renderer.cpp.

{}

Member Function Documentation

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

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:

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

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Here is the caller graph for this function:

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

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:

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 renderer_rep::clear ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual]

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]

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 
)

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:

virtual void renderer_rep::delete_shadow ( renderer ren) [pure virtual]

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Here is the caller graph for this function:

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

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]

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]

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 renderer_rep::extra_clipping ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
)

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:

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

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]

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 color renderer_rep::get_background ( ) [pure virtual]

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, and x_drawable_rep.

Here is the caller graph for this function:

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

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]

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:

virtual color renderer_rep::get_color ( ) [pure virtual]

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, and x_drawable_rep.

Here is the caller graph for this function:

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

Reimplemented in basic_renderer_rep, qt_renderer_rep, and x_drawable_rep.

Definition at line 43 of file renderer.cpp.

                                         {
  w= h= 0;
}

Here is the caller graph for this function:

virtual void renderer_rep::get_shadow ( renderer  ren,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual]

Implemented in basic_renderer_rep, qt_proxy_renderer_rep, printer_rep, qt_shadow_renderer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::href ( string  label,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

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]

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::inner_round ( SI x1,
SI y1,
SI x2,
SI y2 
)

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;
}
bool renderer_rep::interrupted ( bool  check = false) [virtual]

Reimplemented in basic_renderer_rep, and x_drawable_rep.

Definition at line 62 of file renderer.cpp.

                                     {
  (void) check;
  return false;
}

Here is the caller graph for this function:

bool renderer_rep::is_printer ( ) [virtual]

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 
)

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]

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]

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]

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 
)

Definition at line 92 of file renderer.cpp.

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

Here is the caller graph for this function:

virtual void renderer_rep::new_shadow ( renderer ren) [pure virtual]

Implemented in qt_proxy_renderer_rep, basic_renderer_rep, printer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Here is the caller graph for this function:

void renderer_rep::next_page ( ) [virtual]

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 
)

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]

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::put_shadow ( renderer  ren,
SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [pure virtual]

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Here is the caller graph for this function:

bool renderer_rep::repainted ( ) [virtual]

Definition at line 57 of file renderer.cpp.

                         {
  return true;
}
void renderer_rep::round ( SI x,
SI y 
)

Definition at line 161 of file renderer.cpp.

                                 {
  x= RND (x+ ox)- ox;
  y= RND (y+ oy)- oy;
}
virtual void renderer_rep::set_background ( color  c) [pure virtual]

Implemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, and x_drawable_rep.

Here is the caller graph for this function:

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

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 renderer_rep::set_clipping ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
bool  restore = false 
) [virtual]

Reimplemented in basic_renderer_rep, printer_rep, pdf_renderer_rep, x_drawable_rep, and qt_renderer_rep.

Definition at line 121 of file renderer.cpp.

                                                                    {
  (void) restore;
  outer_round (x1, y1, x2, y2);
  cx1= x1+ ox; cy1= y1+ oy;
  cx2= x2+ ox; cy2= y2+ oy;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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 
)

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)

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]

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:

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]

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]

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]

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]

Definition at line 187 of file renderer.cpp.

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

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 37 of file renderer.hpp.

Definition at line 37 of file renderer.hpp.

Definition at line 37 of file renderer.hpp.

Definition at line 37 of file renderer.hpp.

Reimplemented in qt_shadow_renderer_rep.

Definition at line 41 of file renderer.hpp.

Definition at line 36 of file renderer.hpp.

Definition at line 36 of file renderer.hpp.

Definition at line 42 of file renderer.hpp.

Definition at line 43 of file renderer.hpp.

Definition at line 39 of file renderer.hpp.

Definition at line 38 of file renderer.hpp.

Definition at line 40 of file renderer.hpp.


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