Back to index

texmacs  1.0.7.15
Classes | Functions | Variables
animate_boxes.cpp File Reference
#include "Boxes/composite.hpp"
#include "Boxes/construct.hpp"
#include "file.hpp"

Go to the source code of this file.

Classes

struct  anim_constant_box_rep
class  anim_compose_box_rep
struct  anim_repeat_box_rep
struct  anim_effect_box_rep
struct  anim_translate_box_rep
struct  anim_progressive_box_rep
struct  sound_box_rep

Functions

void refresh_at (time_t t)
static url decompose_gif (url u)
static void add_frames (array< box > &v, path ip, url u, int w, int h, int a, int msecs)
box anim_constant_box (path ip, box b, int len)
box anim_compose_box (path ip, array< box > bs)
box anim_repeat_box (path ip, box b)
box anim_translate_box (path ip, box b, int len, SI sx, SI sy, SI ex, SI ey)
box anim_progressive_box (path ip, box b, int len, rectangle r1, rectangle r2)
box sound_box (path ip, url u, SI h)
box video_box (path ip, url u, SI w, SI h, int alpha, int msecs, bool repeated)

Variables

bool refresh_needed = false
time_t refresh_next = 0
static hashmap< tree, treedecomposed_gif ("")

Function Documentation

static void add_frames ( array< box > &  v,
path  ip,
url  u,
int  w,
int  h,
int  a,
int  msecs 
) [static]

Definition at line 545 of file animate_boxes.cpp.

                                                                           {
  if (is_none (u)) return;
  else if (is_or (u)) {
    add_frames (v, ip, u[1], w, h, a, msecs);
    add_frames (v, ip, u[2], w, h, a, msecs);
  }
  else {
    box imb= image_box (ip, u, w, h, a);
    v << anim_constant_box (ip, imb, msecs);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

box anim_compose_box ( path  ip,
array< box bs 
)

Definition at line 567 of file animate_boxes.cpp.

                                          {
  return tm_new<anim_compose_box_rep> (ip, bs);
}

Here is the caller graph for this function:

box anim_constant_box ( path  ip,
box  b,
int  len 
)

Definition at line 562 of file animate_boxes.cpp.

                                            {
  return tm_new<anim_constant_box_rep> (ip, b, len);
}

Here is the caller graph for this function:

box anim_progressive_box ( path  ip,
box  b,
int  len,
rectangle  r1,
rectangle  r2 
)

Definition at line 582 of file animate_boxes.cpp.

                                                                           {
  return tm_new<anim_progressive_box_rep> (ip, b, len, r1, r2);
}

Here is the caller graph for this function:

box anim_repeat_box ( path  ip,
box  b 
)

Definition at line 572 of file animate_boxes.cpp.

                                 {
  return tm_new<anim_repeat_box_rep> (ip, b);
}

Here is the caller graph for this function:

box anim_translate_box ( path  ip,
box  b,
int  len,
SI  sx,
SI  sy,
SI  ex,
SI  ey 
)

Definition at line 577 of file animate_boxes.cpp.

                                                                         {
  return tm_new<anim_translate_box_rep> (ip, b, len, sx, sy, ex, ey);
}

Here is the caller graph for this function:

static url decompose_gif ( url  u) [static]

Definition at line 529 of file animate_boxes.cpp.

                      {
  if (!exists_in_path ("convert"))
    return url_none ();
  if (!decomposed_gif->contains (u->t)) {
    url tmp= url_temp ("");
    url res= glue (tmp, "_%04d.gif");
    system ("convert +adjoin -coalesce", u, res);
    decomposed_gif (u->t)= tmp->t;
  }
  url tmp= as_url (decomposed_gif [u->t]);
  url dir= head (tmp);
  url nam= tail (tmp);
  return expand (complete (dir * url_wildcard (as_string (nam) * "_*.gif")));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh_at ( time_t  t)

Definition at line 24 of file animate_boxes.cpp.

                      {
  time_t now= texmacs_time ();
  if (t - now < 0) t= now;
  if (refresh_needed) {
    if (refresh_next - now < 0) refresh_next= now;
    if (t - refresh_next < 0) refresh_next= t;
  }
  else {
    refresh_needed= true;
    refresh_next  = t;
  }
  //cout << "Refresh at " << t << " -> " << refresh_next << "\n";
}

Here is the call graph for this function:

Here is the caller graph for this function:

box sound_box ( path  ip,
url  u,
SI  h 
)

Definition at line 587 of file animate_boxes.cpp.

                                 {
  return tm_new<sound_box_rep> (ip, u, h);
}

Here is the caller graph for this function:

box video_box ( path  ip,
url  u,
SI  w,
SI  h,
int  alpha,
int  msecs,
bool  repeated 
)

Definition at line 592 of file animate_boxes.cpp.

                                                                            {
  url frames= decompose_gif (u);
  if (is_none (frames)) return empty_box (ip, 0, 0, w, h);
  array<box> bs;
  add_frames (bs, decorate (ip), frames, w, h, alpha, msecs);
  box b= anim_compose_box (repeated? decorate (ip): ip, bs);
  if (repeated) return anim_repeat_box (ip, b);
  else return b;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

bool refresh_needed = false

Definition at line 20 of file animate_boxes.cpp.

Definition at line 21 of file animate_boxes.cpp.