Navigation

Operators and Keywords

Function List:

C++ API

graphics.cc File Reference

#include <cctype>
#include <cfloat>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include "file-ops.h"
#include "file-stat.h"
#include "cmd-edit.h"
#include "defun.h"
#include "display.h"
#include "error.h"
#include "graphics.h"
#include "input.h"
#include "ov.h"
#include "oct-obj.h"
#include "oct-map.h"
#include "ov-fcn-handle.h"
#include "parse.h"
#include "toplev.h"
#include "txt-eng-ft.h"
#include "unwind-prot.h"
#include "graphics-props.cc"
Include dependency graph for graphics.cc:

Classes

class  gnuplot_toolkit
class  callback_event
class  function_event
class  set_event

Defines

#define CONVERT_CDATA_1(ARRAY_T, VAL_FN)
#define CHECK_ARRAY_EQUAL(T, F, A)
#define FIX_LIMITS
#define GO_BODY(TYPE)

Functions

template<class T >
void convert_cdata_1 (bool is_scaled, double clim_0, double clim_1, const double *cmapv, const T *cv, octave_idx_type lda, octave_idx_type nc, double *av)
graphics_handle gcf (void)
graphics_handle gca (void)
Matrix xform_matrix (void)
ColumnVector xform_vector (void)
ColumnVector xform_vector (double x, double y, double z)
ColumnVector transform (const Matrix &m, double x, double y, double z)
Matrix xform_scale (double x, double y, double z)
Matrix xform_translate (double x, double y, double z)
void scale (Matrix &m, double x, double y, double z)
void translate (Matrix &m, double x, double y, double z)
void xform (ColumnVector &v, const Matrix &m)
void scale (ColumnVector &v, double x, double y, double z)
void translate (ColumnVector &v, double x, double y, double z)
void normalize (ColumnVector &v)
double dot (const ColumnVector &v1, const ColumnVector &v2)
double norm (const ColumnVector &v)
ColumnVector cross (const ColumnVector &v1, const ColumnVector &v2)
Matrix unit_cube (void)
ColumnVector cam2xform (const Array< double > &m)
RowVector xform2cam (const ColumnVector &v)
void get_children_limits (double &min_val, double &max_val, double &min_pos, const Matrix &kids, char limit_type)
double force_in_range (const double x, const double lower, const double upper)
void cross_product (double x1, double y1, double z1, double x2, double y2, double z2, double &x, double &y, double &z)
 DEFUN (ishandle, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} ishandle (@var{h})\n\ Return true if @var{h} is a graphics handle and false otherwise.\n\ @var{h} may also be a matrix of handles in which case a logical\n\ array is returned that is true where the elements of @var{h} are\n\ graphics handles and false where they are not.\n\ @seealso{isfigure}\n\ @end deftypefn")
 DEFUN (reset, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\ Remove any defaults set for the handle @var{h}. The default figure\n\ properties of \"position\", \"units\", \"windowstyle\" and\n\ \"paperunits\" and the default axes properties of \"position\" and \"units\"\n\ are not reset.\n\ @end deftypefn")
 DEFUN (set, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\ @deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\ @deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\ Set named property values for the graphics handle (or vector of graphics\n\ handles) @var{h}.\n\ There are three ways how to give the property names and values:\n\ \n\ @itemize\n\ @item as a comma separated list of @var{property}, @var{value} pairs\n\ \n\ Here, each @var{property} is a string containing the property name, each\n\ @var{value} is a value of the appropriate type for the property.\n\ \n\ @item as a cell array of strings @var{properties} containing property names\n\ and a cell array @var{values} containing property values.\n\ \n\ In this case, the number of columns of @var{values} must match the number of\n\ elements in @var{properties}. The first column of @var{values} contains\n\ values for the first entry in @var{properties}, etc. The number of rows of\n\ @var{values} must be 1 or match the number of elements of @var{h}. In the\n\ first case, each handle in @var{h} will be assigned the same values. In the\n\ latter case, the first handle in @var{h} will be assigned the values from\n\ the first row of @var{values} and so on.\n\ \n\ @item as a structure array @var{pv}\n\ \n\ Here, the field names of @var{pv} represent the property names, and the field\n\ values give the property values. In contrast to the previous case, all\n\ elements of @var{pv} will be set in all handles in @var{h} independent of\n\ the dimensions of @var{pv}.\n\ @end itemize\n\ @end deftypefn")
 DEFUN (get, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} get (@var{h}, @var{p})\n\ Return the named property @var{p} from the graphics handle @var{h}.\n\ If @var{p} is omitted, return the complete property list for @var{h}.\n\ If @var{h} is a vector, return a cell array including the property\n\ values or lists respectively.\n\ @end deftypefn")
 DEFUN (__get__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __get__ (@var{h})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_figure__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ Undocumented internal function.\n\ @end deftypefn")
int calc_dimensions (const graphics_object &go)
 DEFUN (__calc_dimensions__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ Internal function. Determine the number of dimensions in a graphics\n\ object, whether 2 or 3.\n\ @end deftypefn")
 DEFUN (__go_axes__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_line__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_text__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_image__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_surface__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_patch__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_hggroup__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_uimenu__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_delete__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_axes_init__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_handles__,,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_handles__ ()\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_figure_handles__,,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_figure_handles__ ()\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__go_execute_callback__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\ @deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (__image_pixel_size__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\ Internal function: returns the pixel size of the image in normalized units.\n\ @end deftypefn")
 DEFUN (available_graphics_toolkits,,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ Return a cell array of registered graphics toolkits.\n\ @end deftypefn")
 DEFUN (drawnow, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} drawnow ()\n\ @deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\ @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\ Update figure windows and their children. The event queue is flushed and\n\ any callbacks generated are executed. With the optional argument\n\ @code{\"expose\"}, only graphic objects are updated and no other events or\n\ callbacks are processed.\n\ The third calling form of @code{drawnow} is for debugging and is\n\ undocumented.\n\ @end deftypefn")
 DEFUN (addlistener, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\ Register @var{fcn} as listener for the property @var{prop} of the graphics\n\ object @var{h}. Property listeners are executed (in order of registration)\n\ when the property is set. The new value is already available when the\n\ listeners are executed.\n\ \n\ @var{prop} must be a string naming a valid property in @var{h}.\n\ \n\ @var{fcn} can be a function handle, a string or a cell array whose first\n\ element is a function handle. If @var{fcn} is a function handle, the\n\ corresponding function should accept at least 2 arguments, that will be\n\ set to the object handle and the empty matrix respectively. If @var{fcn}\n\ is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\ array, the first element must be a function handle with the same signature\n\ as described above. The next elements of the cell array are passed\n\ as additional arguments to the function.\n\ \n\ Example:\n\ \n\ @example\n\ @group\n\ function my_listener (h, dummy, p1)\n\ fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ endfunction\n\ \n\ addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\ @end group\n\ @end example\n\ \n\ @end deftypefn")
 DEFUN (dellistener, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\ Remove the registration of @var{fcn} as a listener for the property\n\ @var{prop} of the graphics object @var{h}. The function @var{fcn} must\n\ be the same variable (not just the same value), as was passed to the\n\ original call to @code{addlistener}.\n\ \n\ If @var{fcn} is not defined then all listener functions of @var{prop}\n\ are removed.\n\ \n\ Example:\n\ \n\ @example\n\ @group\n\ function my_listener (h, dummy, p1)\n\ fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ endfunction\n\ \n\ c = @{@@my_listener, \"my string\"@};\n\ addlistener (gcf, \"position\", c);\n\ dellistener (gcf, \"position\", c);\n\ @end group\n\ @end example\n\ \n\ @end deftypefn")
 DEFUN (addproperty, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\ @deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\ Create a new property named @var{name} in graphics object @var{h}.\n\ @var{type} determines the type of the property to create. @var{args}\n\ usually contains the default value of the property, but additional\n\ arguments might be given, depending on the type of the property.\n\ \n\ The supported property types are:\n\ \n\ @table @code\n\ @item string\n\ A string property. @var{arg} contains the default string value.\n\ \n\ @item any\n\ An un-typed property. This kind of property can hold any octave\n\ value. @var{args} contains the default value.\n\ \n\ @item radio\n\ A string property with a limited set of accepted values. The first\n\ argument must be a string with all accepted values separated by\n\ a vertical bar ('|'). The default value can be marked by enclosing\n\ it with a '@{' '@}' pair. The default value may also be given as\n\ an optional second string argument.\n\ \n\ @item boolean\n\ A boolean property. This property type is equivalent to a radio\n\ property with \"on|off\" as accepted values. @var{arg} contains\n\ the default property value.\n\ \n\ @item double\n\ A scalar double property. @var{arg} contains the default value.\n\ \n\ @item handle\n\ A handle property. This kind of property holds the handle of a\n\ graphics object. @var{arg} contains the default handle value.\n\ When no default value is given, the property is initialized to\n\ the empty matrix.\n\ \n\ @item data\n\ A data (matrix) property. @var{arg} contains the default data\n\ value. When no default value is given, the data is initialized to\n\ the empty matrix.\n\ \n\ @item color\n\ A color property. @var{arg} contains the default color value.\n\ When no default color is given, the property is set to black.\n\ An optional second string argument may be given to specify an\n\ additional set of accepted string values (like a radio property).\n\ @end table\n\ \n\ @var{type} may also be the concatenation of a core object type and\n\ a valid property name for that object type. The property created\n\ then has the same characteristics as the referenced property (type,\n\ possible values, hidden state@dots{}). This allows to clone an existing\n\ property into the graphics object @var{h}.\n\ \n\ Examples:\n\ \n\ @example\n\ @group\n\ addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\ addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\ addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\ @end group\n\ @end example\n\ \n\ @end deftypefn")
octave_value get_property_from_handle (double handle, const std::string &property, const std::string &func)
bool set_property_in_handle (double handle, const std::string &property, const octave_value &arg, const std::string &func)

Define Documentation

#define CHECK_ARRAY_EQUAL (   T,
  F,
  A 
)
Value:
{ \
              if (data.numel () == 1) \
                return data.F ## scalar_value () == \
                  v.F ## scalar_value (); \
              else  \
                { \
                  /* Keep copy of array_value to allow sparse/bool arrays */ \
                  /* that are converted, to not be deallocated early */ \
                  const A m1 = data.F ## array_value (); \
                  const T* d1 = m1.data (); \
                  const A m2 = v.F ## array_value (); \
                  const T* d2 = m2.data ();\
                  \
                  bool flag = true; \
                  \
                  for (int i = 0; flag && i < data.numel (); i++) \
                    if (d1[i] != d2[i]) \
                      flag = false; \
                  \
                  return flag; \
                } \
            }
#define CONVERT_CDATA_1 (   ARRAY_T,
  VAL_FN 
)
Value:
do \
    { \
      ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
 \
      convert_cdata_1 (is_scaled, clim_0, clim_1, cmapv, \
                       tmp.data (), lda, nc, av); \
    } \
  while (0)
#define FIX_LIMITS
Value:
if (limits.numel() == 3) \
    { \
      val = limits(0); \
      if (! (xisinf (val) || xisnan (val))) \
        min_val = val; \
      val = limits(1); \
      if (! (xisinf (val) || xisnan (val))) \
        max_val = val; \
      val = limits(2); \
      if (! (xisinf (val) || xisnan (val))) \
        min_pos = val; \
    } \
  else \
    { \
      limits.resize(3, 1); \
      limits(0) = min_val; \
      limits(1) = max_val; \
      limits(2) = min_pos; \
    }
#define GO_BODY (   TYPE  ) 
Value:
gh_manager::autolock guard; \
 \
  octave_value retval; \
 \
  if (args.length () > 0) \
    retval = make_graphics_object (#TYPE, args); \
  else \
    print_usage (); \
 \
  return retval

Function Documentation

int calc_dimensions ( const graphics_object go  ) 
ColumnVector cam2xform ( const Array< double > &  m  )  [inline]
template<class T >
void convert_cdata_1 ( bool  is_scaled,
double  clim_0,
double  clim_1,
const double *  cmapv,
const T *  cv,
octave_idx_type  lda,
octave_idx_type  nc,
double *  av 
)
ColumnVector cross ( const ColumnVector v1,
const ColumnVector v2 
) [inline]
void cross_product ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double &  x,
double &  y,
double &  z 
) [inline]
DEFUN ( __go_line__  ,
args   
)
DEFUN ( __image_pixel_size__  ,
args   
)
DEFUN ( __get__  ,
args   
)
DEFUN ( dellistener  ,
args   
)
DEFUN ( ishandle  ,
args   
)
DEFUN ( reset  ,
args   
)
DEFUN ( set  ,
args  ,
nargout   
)
DEFUN ( get  ,
args   
)
DEFUN ( __go_figure__  ,
args   
)
DEFUN ( __calc_dimensions__  ,
args   
)
DEFUN ( __go_figure_handles__   ) 
DEFUN ( __go_axes__  ,
args   
)
DEFUN ( __go_text__  ,
args   
)
DEFUN ( __go_image__  ,
args   
)
DEFUN ( __go_surface__  ,
args   
)
DEFUN ( __go_patch__  ,
args   
)
DEFUN ( __go_hggroup__  ,
args   
)
DEFUN ( __go_delete__  ,
args   
)
DEFUN ( __go_axes_init__  ,
args   
)
DEFUN ( __go_handles__   ) 
DEFUN ( drawnow  ,
args   
)
DEFUN ( __go_execute_callback__  ,
args   
)
DEFUN ( available_graphics_toolkits   ) 
DEFUN ( addlistener  ,
args   
)
DEFUN ( addproperty  ,
args   
)
DEFUN ( __go_uimenu__  ,
args   
)
double dot ( const ColumnVector v1,
const ColumnVector v2 
) [inline]
double force_in_range ( const double  x,
const double  lower,
const double  upper 
) [inline]
graphics_handle gca ( void   ) 
graphics_handle gcf ( void   ) 
void get_children_limits ( double &  min_val,
double &  max_val,
double &  min_pos,
const Matrix kids,
char  limit_type 
)
octave_value get_property_from_handle ( double  handle,
const std::string &  property,
const std::string &  func 
)
double norm ( const ColumnVector v  )  [inline]
void normalize ( ColumnVector v  )  [inline]
void scale ( ColumnVector v,
double  x,
double  y,
double  z 
) [inline]
void scale ( Matrix m,
double  x,
double  y,
double  z 
) [inline]
bool set_property_in_handle ( double  handle,
const std::string &  property,
const octave_value arg,
const std::string &  func 
)
ColumnVector transform ( const Matrix m,
double  x,
double  y,
double  z 
) [inline]
void translate ( ColumnVector v,
double  x,
double  y,
double  z 
) [inline]
void translate ( Matrix m,
double  x,
double  y,
double  z 
) [inline]
Matrix unit_cube ( void   )  [inline]
void xform ( ColumnVector v,
const Matrix m 
) [inline]
RowVector xform2cam ( const ColumnVector v  )  [inline]
Matrix xform_matrix ( void   )  [inline]
Matrix xform_scale ( double  x,
double  y,
double  z 
) [inline]
Matrix xform_translate ( double  x,
double  y,
double  z 
) [inline]
ColumnVector xform_vector ( double  x,
double  y,
double  z 
) [inline]
ColumnVector xform_vector ( void   )  [inline]
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines