Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends
pdf_renderer_rep Class Reference

#include <pdf_renderer.hpp>

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

List of all members.

Public Member Functions

 pdf_renderer_rep (url pdf_file_name, int dpi, int nr_pages, string ptype, bool landsc, double paper_w, double paper_h)
 ~pdf_renderer_rep ()
bool is_printer ()
void next_page ()
void set_clipping (SI x1, SI y1, SI x2, SI y2, bool restore=false)
color get_color ()
color get_background ()
void set_color (color c)
void set_background (color c)
void draw (int char_code, font_glyphs fn, SI x, SI y)
void set_line_style (SI w, int type=0, bool round=true)
void line (SI x1, SI y1, SI x2, SI y2)
void lines (array< SI > x, array< SI > y)
void clear (SI x1, SI y1, SI x2, SI y2)
void fill (SI x1, SI y1, SI x2, SI y2)
void arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta)
void fill_arc (SI x1, SI y1, SI x2, SI y2, int alpha, int delta)
void polygon (array< SI > x, array< SI > y, bool convex=true)
void xpm (url file_name, SI x, SI y)
void image (url u, SI w, SI h, SI x, SI y, double cx1, double cy1, double cx2, double cy2, int alpha)
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)
virtual bool is_x_drawable ()
virtual x_drawable_repas_x_drawable ()
virtual void get_extents (int &w, int &h)
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 tree get_background_pattern (int &alpha)
virtual void set_background_pattern (tree t, int alpha=255)
virtual void clear_pattern (SI x1, SI y1, SI x2, SI y2)
virtual void triangle (SI x1, SI y1, SI x2, SI y2, SI x3, SI y3)
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

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

Private Member Functions

double to_x (SI x)
double to_y (SI y)
void init_page_size ()
void select_color (color c)
void select_line_width (SI w)
void compile_glyph (scheme_tree t)

Private Attributes

url pdf_file_name
int dpi
int nr_pages
string page_type
bool landscape
double paper_w
double paper_h
color fg
color bg
SI lw
string cfn
int cfid
double p
double width
double height
hashmap< string, int > tex_fonts
hashmap< string, int > image_resources

Static Private Attributes

static const int default_dpi = 72

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 20 of file pdf_renderer.hpp.


Constructor & Destructor Documentation

pdf_renderer_rep::pdf_renderer_rep ( url  pdf_file_name,
int  dpi,
int  nr_pages,
string  ptype,
bool  landsc,
double  paper_w,
double  paper_h 
)

Definition at line 130 of file pdf_renderer.cpp.

                                                                       :
    pdf_file_name (pdf_file_name2), dpi (dpi2),
    nr_pages (nr_pages2), page_type (page_type2),
    landscape (landscape2), paper_w (paper_w2), paper_h (paper_h2),
    fg (-1), bg (-1),
    lw (-1),  cfn (""), cfid(0),
    tex_fonts (0),
    image_resources (0)
{
//  dvi2pts = 1.0;
  width= default_dpi * paper_w / 2.54;
  height= default_dpi * paper_h / 2.54;
  dvi2pts = (double)default_dpi / dpi / PIXEL;
  p= (double)default_dpi / dpi / PIXEL;
//  p = 1.0;
  if (landscape) {
    width= (width > height)? width : height;
    height= (width > height)? height : width;
  } else {
    width= (width > height)? height : width;
    height= (width > height)? width : height;
  }
  
  set_origin(0, paper_h*dpi*PIXEL/2.54);
  
 // mem_debug_init();
  pdf_init_fontmaps(); /* This must come before parsing options... */
  pdf_font_set_dpi(dpi);
  pdf_doc_set_creator("TeXmacs");
  pdf_set_version(3);
  pdf_files_init();
  /* Set default paper size here so that all page's can inherite it.
   * annot_grow:    Margin of annotation.
   * bookmark_open: Miximal depth of open bookmarks.
   */
  
  {
    char* _pdf_file_name;
    _pdf_file_name= as_charp (concretize (pdf_file_name));

    pdf_open_document(_pdf_file_name, do_encryption,
                    width, height, annot_grow, bookmark_open,
                    !(opt_flags & OPT_PDFDOC_NO_DEST_REMOVE));
  
    tm_delete_array (_pdf_file_name);
  }
  
  /* Ignore_colors placed here since
   * they are considered as device's capacity.
   */
  pdf_init_device(dvi2pts, pdfdecimaldigits, ignore_colors);
  
  
  pdf_rect mediabox;
  mediabox.llx = 0.0;
  mediabox.lly = 0.0;
  mediabox.urx = width;
  mediabox.ury = height;
  
  pdf_doc_set_mediabox(0, &mediabox); /* Root node */
  
  pdf_doc_begin_page(1.0,0.0,0.0);
  

  set_clipping (0, (int) ((-dpi*PIXEL*paper_h)/2.54), (int) ((dpi*PIXEL*paper_w)/2.54), 0);
  fg  = -1;
  bg  = -1;
  lw  = -1;
  cfn= "Helvetica";
  cfid = pdf_dev_locate_font("Helvetica",10);
  tex_fonts (cfn)= cfid+1;
}

Here is the call graph for this function:

Definition at line 205 of file pdf_renderer.cpp.

                                     {
  pdf_doc_end_page();
  
  pdf_files_close();
  
  /* Order of close... */
  pdf_close_device  ();
  /* pdf_close_document flushes XObject (image) and other resources. */
  pdf_close_document();
  
  pdf_close_fontmaps(); /* pdf_font may depend on fontmap. */
}

Here is the call graph for this function:


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

Implements renderer_rep.

Definition at line 598 of file pdf_renderer.cpp.

                                                          {
//  cerr << "apply_shadow\n";
//  (void) x1; (void) y1; (void) x2; (void) y2;
}
void pdf_renderer_rep::arc ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
int  alpha,
int  delta 
) [virtual]

Implements renderer_rep.

Definition at line 424 of file pdf_renderer.cpp.

                                                                       {
  cerr << "arc\n";
#if 0
  double cx= to_x ((x1+x2)/2);
  double cy= to_y ((y1+y2)/2);
  double rx= (x2-x1);
  double ry= (y2-y1);
  double a= -(double)alpha / 64 + 90;
  double d= -(double)(alpha + delta) / 64 + 90;
  cerr << "arc GSave\n", HPDF_Page_GSave (page);
  HPDF_Page_SetRGBFill (page, 1, 0, 0);
  cerr << "arc Concat\n", HPDF_Page_Concat (page, p * rx, 0, 0, p * ry, cx, cy);
  cerr << "arc Arc\n", HPDF_Page_Arc (page, 0, 0, 1, min (a, d), max (a, d));
  cerr << "arc LineTo\n", HPDF_Page_LineTo (page, 0, 0);
  cerr << "arc ClosePath\n", HPDF_Page_ClosePath (page);
  cerr << "arc Clip\n", HPDF_Page_Clip (page);
  cerr << "arc EndPath\n", HPDF_Page_EndPath (page);
  cerr << "arc Concat\n", HPDF_Page_Concat (page, 1 / p / rx, 0, 0, 1 / p / ry, 0, 0);
  cerr << "arc SetLineWidth\n", HPDF_Page_SetLineWidth (page, p * lw);  
  cerr << "arc Ellipse\n", HPDF_Page_Ellipse (page, 0, 0, p * rx / 2, p * ry / 2);
  cerr << "arc Stroke\n", HPDF_Page_Stroke (page);
  cerr << "arc GRestore\n", HPDF_Page_GRestore (page);
#endif
}

Here is the call 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:

void pdf_renderer_rep::clear ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

Implements renderer_rep.

Definition at line 392 of file pdf_renderer.cpp.

                                                   {
//  cerr << "clear\n";
  select_color (bg);
  double xx1= to_x (min (x1, x2));
  double yy1= to_y (min (y1, y2));
  double xx2= to_x (max (x1, x2));
  double yy2= to_y (max (y1, y2));
  pdf_dev_moveto(xx1, yy1);
  pdf_dev_lineto(xx2, yy1);
  pdf_dev_lineto(xx2, yy2);
  pdf_dev_lineto(xx1, yy2);
  pdf_dev_closepath();
  pdf_dev_fill();  
  select_color (fg);
}

Here is the call 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 pdf_renderer_rep::delete_shadow ( renderer ren) [virtual]

Implements renderer_rep.

Definition at line 580 of file pdf_renderer.cpp.

                                              {
//  cerr << "delete_shadow\n";
//  (void) ren;
}
void pdf_renderer_rep::draw ( int  char_code,
font_glyphs  fn,
SI  x,
SI  y 
) [virtual]

Implements renderer_rep.

Definition at line 300 of file pdf_renderer.cpp.

                                                          {
  //cerr << "draw \"" << (char)ch << "\" " << ch << " " << fn->res_name << "\n";
  glyph gl= fn->get(ch);
  if (is_nil (gl)) return;
  if (cfn != fn->res_name) {
    
  //  cerr << "CHANGE FONT" << LF;
    
    if (!tex_fonts [fn->res_name]) {
      int pos= search_forwards (":", fn->res_name);
      string fname= (pos==-1? fn->res_name: fn->res_name (0, pos));
      url u = url_none();
      {        
        //cerr << " try freetype " << LF;
        u = tt_font_find(fname);
        //cerr << fname << " " << u << LF;
      }
      if (is_none (u)) {
        //cerr << " try pk " << LF;
        u= resolve_tex (fn->res_name);
        //cerr << fname << " " << u << LF;
      }
      if (!is_none (u)) {
        int pos= search_forwards (".", fn->res_name);
        string rname= (pos==-1? fn->res_name: fn->res_name (0, pos));
        double fsize= font_size (fn->res_name);

        url utfm =  resolve_tex(fname * ".tfm") ;
   
        char *_rname = as_charp(fname);
        char* _u= as_charp (concretize (u));
        char* _utfm= NULL;
        if (!is_none(utfm)) _utfm = as_charp (concretize (utfm));
        //cout << "DEVFONT " << _rname << " " << fsize << " " << u << " " << utfm << LF;
        int font_id = pdf_dev_physical_font(_rname,fsize*dpi*PIXEL/default_dpi,_u,_utfm); 
        tm_delete_array(_rname);
        tm_delete_array(_u);
        if (_utfm) tm_delete_array(_utfm);
        if (font_id >= 0) {
          tex_fonts(fn->res_name)= font_id+1;
        }  else {
          cout << "(pdf_renderer) Problems with font: " << fname << " file " << u << LF;
        }
      }
    }
    cfn= fn->res_name;
    if (tex_fonts [cfn]) {
      cfid = tex_fonts(cfn) -1;
    } else cfid = 0;
  }

  y += oy;  x += ox;
#if 0
  pdf_dev_set_raw_glyph(x, y, ch, cfid);
#else
  unsigned char buf[2] = { ch, 0 };
  fixword width = pdf_dev_string_width(cfid, buf, 1);
  pdf_dev_set_string(x, y, buf, 1, width, cfid, 1);
#endif
//  cerr << "char " << ch << " " << x << " " << y << " font " << cfid << " width " << w << LF;
  
}

Here is the call 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 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 pdf_renderer_rep::fetch ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
renderer  ren,
SI  x,
SI  y 
) [virtual]

Implements renderer_rep.

Definition at line 567 of file pdf_renderer.cpp.

                                                                             {
//  cerr << "fetch\n";
/*  (void) x1; (void) y1; (void) x2; (void) y2;
  (void) ren; (void) x; (void) y;*/
}
void pdf_renderer_rep::fill ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

Implements renderer_rep.

Definition at line 409 of file pdf_renderer.cpp.

                                                  {
//  cerr << "fill\n";
  double xx1= to_x (min (x1, x2));
  double yy1= to_y (min (y1, y2));
  double xx2= to_x (max (x1, x2));
  double yy2= to_y (max (y1, y2));
  pdf_dev_moveto(xx1, yy1);
  pdf_dev_lineto(xx2, yy1);
  pdf_dev_lineto(xx2, yy2);
  pdf_dev_lineto(xx1, yy2);
  pdf_dev_closepath();
  pdf_dev_fill();  
}

Here is the call graph for this function:

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

Implements renderer_rep.

Definition at line 450 of file pdf_renderer.cpp.

                                                                            {
  cerr << "fill_arc\n";
#if 0
  double cx= to_x ((x1+x2)/2);
  double cy= to_y ((y1+y2)/2);
  double rx= (x2-x1);
  double ry= (y2-y1);
  double a= -(double)alpha / 64 + 90;
  double d= -(double)(alpha + delta) / 64 + 90;
  cerr << "arc GSave\n", HPDF_Page_GSave (page);
  HPDF_Page_SetRGBFill (page, 1, 0, 0);
  cerr << "arc Concat\n", HPDF_Page_Concat (page, p * (rx / 2), 0, 0, p * (ry / 2), cx, cy);
  cerr << "arc Arc\n", HPDF_Page_Arc (page, 0, 0, 1, min (a, d), max (a, d));
  cerr << "arc EndPath\n", HPDF_Page_ClosePath (page);
  cerr << "arc Stroke\n", HPDF_Page_Fill (page);
  cerr << "arc GRestore\n", HPDF_Page_GRestore (page);
#endif
}

Here is the call graph for this function:

Implements renderer_rep.

Definition at line 270 of file pdf_renderer.cpp.

                                  {
//  cerr << "get_background\n";
  return bg;
}
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.

Definition at line 264 of file pdf_renderer.cpp.

                             {
//  cerr << "get_color\n";
  return fg;
}
void renderer_rep::get_extents ( int &  w,
int &  h 
) [virtual, inherited]

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:

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

Implements renderer_rep.

Definition at line 586 of file pdf_renderer.cpp.

                                                                      {
//  cerr << "get_shadow\n";
//  (void) ren; (void) x1; (void) y1; (void) x2; (void) y2;
}
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:

void pdf_renderer_rep::image ( url  u,
SI  w,
SI  h,
SI  x,
SI  y,
double  cx1,
double  cy1,
double  cx2,
double  cy2,
int  alpha 
) [virtual]

Implements renderer_rep.

Definition at line 512 of file pdf_renderer.cpp.

{
  //cerr << "image " << u << LF;
  (void) alpha; // FIXME
  
  int bx1, by1, bx2, by2;
  ps_bounding_box (u, bx1, by1, bx2, by2);
  int x1= bx1 + (int) (cx1 * (bx2 - bx1) + 0.5);
  int y1= by1 + (int) (cy1 * (by2 - by1) + 0.5);
  int x2= bx1 + (int) (cx2 * (bx2 - bx1) + 0.5);
  int y2= by1 + (int) (cy2 * (by2 - by1) + 0.5);
  
  double sc_x= (72.0/dpi) * ((double) (w/PIXEL)) / ((double) (x2-x1));
  double sc_y= (72.0/dpi) * ((double) (h/PIXEL)) / ((double) (y2-y1));
  
  transform_info ti;
  
  transform_info_clear(&ti);
  
  make_transmatrix(&(ti.matrix), 0, 0, sc_x, sc_y, 0.0);
  ti.bbox.llx = x1;
  ti.bbox.lly = y1;
  ti.bbox.urx = x2;
  ti.bbox.ury = y2;
  ti.flags = INFO_DO_CLIP  | INFO_HAS_USER_BBOX;
  
  string filename = concretize(u);

  if (!image_resources->contains(filename)) {
    url temp= url_temp (".pdf");
    string cmd = "ps2pdf13";
    system(cmd, u, temp);
    cout << temp << LF;
    char *_u = as_charp(concretize(temp));
    
    int form_id = pdf_ximage_findresource(_u, 1, NULL);
    if (form_id < 0) {
      cerr <<  "Failed to read image file:" << _u << LF;
    } else {
      image_resources (filename) = form_id;
    }
    tm_delete_array(_u);
    remove (temp);    
  }
  
  if (image_resources->contains(filename)) {
    pdf_dev_put_image(image_resources (filename), &ti, to_x(x), to_y(y));
  }
  
}

Here is the call 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;
}
bool renderer_rep::interrupted ( bool  check = false) [virtual, inherited]

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 pdf_renderer_rep::is_printer ( ) [virtual]

Reimplemented from renderer_rep.

Definition at line 219 of file pdf_renderer.cpp.

                              {
//  cerr << "is_printer\n";
  return true;
}
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;
}
void pdf_renderer_rep::line ( SI  x1,
SI  y1,
SI  x2,
SI  y2 
) [virtual]

Implements renderer_rep.

Definition at line 372 of file pdf_renderer.cpp.

                                                  {
//  cerr << "line\n";
  pdf_dev_moveto(to_x (x1), to_y (y1));
  pdf_dev_lineto(to_x (x2), to_y (y2));
  pdf_dev_stroke();
}

Here is the call graph for this function:

void pdf_renderer_rep::lines ( array< SI x,
array< SI y 
) [virtual]

Implements renderer_rep.

Definition at line 380 of file pdf_renderer.cpp.

                                                 {
//  cerr << "lines\n";
  int i, n= N(x);
  if ((N(y) != n) || (n<1)) return;
  pdf_dev_moveto(to_x (x[0]), to_y (y[0]));
  for (i=1; i<n; i++) {
    pdf_dev_lineto(to_x (x[i]), to_y (y[i]));
  }
  pdf_dev_stroke();
}

Here is the call 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 pdf_renderer_rep::new_shadow ( renderer ren) [virtual]

Implements renderer_rep.

Definition at line 574 of file pdf_renderer.cpp.

                                           {
//  cerr << "new_shadow\n";
//  (void) ren;
}
void pdf_renderer_rep::next_page ( ) [virtual]

Reimplemented from renderer_rep.

Definition at line 225 of file pdf_renderer.cpp.

                             {
//  cerr << "next_page\n";
  pdf_doc_end_page();
  pdf_doc_begin_page(1.0,0.0,0.0);

  set_clipping (0, (int) ((-dpi*PIXEL*paper_h)/2.54), (int) ((dpi*PIXEL*paper_w)/2.54), 0);
  fg  = -1;
  bg  = -1;
  lw  = -1;
  cfn= "Helvetica";
  cfid = tex_fonts(cfn)-1;
}

Here is the call 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:

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

Implements renderer_rep.

Definition at line 470 of file pdf_renderer.cpp.

                                                                {
//  cerr << "polygon\n";
  int i, n= N(x);
  if ((N(y) != n) || (n<1)) return;
  pdf_dev_moveto(to_x (x[0]), to_y (y[0]));
  for (i=1; i<n; i++) {
     pdf_dev_lineto (to_x (x[i]), to_y (y[i]));
  }
  pdf_dev_closepath ();
  pdf_dev_fill (); //  HPDF_Page_Eofill (page);
}

Here is the call graph for this function:

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

Implements renderer_rep.

Definition at line 592 of file pdf_renderer.cpp.

                                                                      {
// cerr << "put_shadow\n";
//  (void) ren; (void) x1; (void) y1; (void) x2; (void) y2;
}
bool renderer_rep::repainted ( ) [virtual, inherited]

Definition at line 57 of file renderer.cpp.

                         {
  return true;
}
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;
}
void pdf_renderer_rep::select_color ( color  c) [private]

Definition at line 99 of file pdf_renderer.cpp.

                                       {;
  int r, g, b, a;
  get_rgb_color (c, r, g, b, a);
  double dr= ((double) r) / 255;
  double dg= ((double) g) / 255;
  double db= ((double) b) / 255;
  double da= ((double) a) / 255; // FIXME: what to do with alpha?
  
  
  pdf_color color;
  pdf_color_rgbcolor(&color, dr, dg, db);
  pdf_dev_set_color(&color,0,0); // stroke color;
  pdf_dev_set_color(&color,0x20,0); // non-stroking color;
  
#if 0
  HPDF_Page_SetRGBFill (page, dr, dg, db);
  HPDF_Page_SetRGBStroke (page, dr, dg, db);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pdf_renderer_rep::select_line_width ( SI  w) [private]

Definition at line 120 of file pdf_renderer.cpp.

                                         {
  double pw= p * w;
  //if (pw < 1) pw= 1;
//  HPDF_Page_SetLineWidth (page, pw);
}

Here is the caller graph for this function:

void pdf_renderer_rep::set_background ( color  c) [virtual]

Implements renderer_rep.

Definition at line 284 of file pdf_renderer.cpp.

                                         {
//  cerr << "set_background\n";
  if (bg==c) return;
  bg= c;
}
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 pdf_renderer_rep::set_clipping ( SI  x1,
SI  y1,
SI  x2,
SI  y2,
bool  restore = false 
) [virtual]

Reimplemented from renderer_rep.

Definition at line 243 of file pdf_renderer.cpp.

                                                                        {
//  cerr << "set_clipping\n";
  outer_round (x1, y1, x2, y2);
  renderer_rep::set_clipping (x1, y1, x2, y2);
/*  if (restore) {
    print (PDF_CLIP_POP);
    cfn= "";
  }
  else {
    print (PDF_CLIP_PUSH);
    print (x1, y1);
    print (x2, y2);
    print (PDF_CLIP);
  }*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements renderer_rep.

Definition at line 276 of file pdf_renderer.cpp.

                                    {
//  cerr << "set_color\n";
  if (fg==c) return;
  fg= c;
  select_color (c);
}

Here is the call graph for this function:

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

Implements renderer_rep.

Definition at line 364 of file pdf_renderer.cpp.

                                                            {
//  cerr << "set_line_style\n";
  if (lw == w) return;
  lw= w;
  select_line_width (w);
}

Here is the call 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:

double pdf_renderer_rep::to_x ( SI  x) [private]

Definition at line 89 of file pdf_renderer.cpp.

                            {
  return p * (ox + x);  
}

Here is the caller graph for this function:

double pdf_renderer_rep::to_y ( SI  y) [private]

Definition at line 94 of file pdf_renderer.cpp.

                            {
  return  p * ( oy + y);  
}

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:

void pdf_renderer_rep::xpm ( url  file_name,
SI  x,
SI  y 
) [virtual]

Implements renderer_rep.

Definition at line 483 of file pdf_renderer.cpp.

                                                {
//  cerr << "xpm\n";
/*  (void) file_name; (void) x; (void) y;
  FAILED ("not yet implemented");*/
}

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 31 of file pdf_renderer.hpp.

int pdf_renderer_rep::cfid [private]

Definition at line 34 of file pdf_renderer.hpp.

Definition at line 33 of file pdf_renderer.hpp.

Definition at line 44 of file 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.

const int pdf_renderer_rep::default_dpi = 72 [static, private]

Definition at line 21 of file pdf_renderer.hpp.

int pdf_renderer_rep::dpi [private]

Definition at line 24 of file pdf_renderer.hpp.

Definition at line 31 of file pdf_renderer.hpp.

double pdf_renderer_rep::height [private]

Definition at line 37 of file pdf_renderer.hpp.

Definition at line 41 of file pdf_renderer.hpp.

Definition at line 27 of file pdf_renderer.hpp.

Definition at line 32 of file pdf_renderer.hpp.

Reimplemented in qt_shadow_renderer_rep.

Definition at line 41 of file renderer.hpp.

Definition at line 25 of file pdf_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.

double pdf_renderer_rep::p [private]

Definition at line 36 of file pdf_renderer.hpp.

Definition at line 26 of file pdf_renderer.hpp.

double pdf_renderer_rep::paper_h [private]

Definition at line 29 of file pdf_renderer.hpp.

double pdf_renderer_rep::paper_w [private]

Definition at line 28 of file pdf_renderer.hpp.

Definition at line 42 of file renderer.hpp.

int renderer_rep::pattern_alpha [inherited]

Definition at line 43 of file renderer.hpp.

Definition at line 23 of file pdf_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.

Definition at line 40 of file pdf_renderer.hpp.

int renderer_rep::thicken [inherited]

Definition at line 40 of file renderer.hpp.

double pdf_renderer_rep::width [private]

Definition at line 37 of file pdf_renderer.hpp.


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