dummyDevice         package:RGraphicsDevice         R Documentation

_C_r_e_a_t_e _a _d_e_g_e_n_e_r_a_t_e _c_o_l_l_e_c_t_i_o_n _o_f _R-_l_e_v_e_l _g_r_a_p_h_i_c_s _d_e_v_i_c_e _f_u_n_c_t_i_o_n_s.

_D_e_s_c_r_i_p_t_i_o_n:

     This function creates a collection of functions that can be used
     to implement an R-level graphics device.  These functions don't do
     much other than, by default, announce they have been called by
     printing the name of the corresponding graphics primitive (e.g.
     activate, line, circle). The action can be customized using the
     'bodies' parameter.

     We use this to a) test the functionality of the package, and b) to
     provide a basic skeleton of a device which programmers can
     override and customize by providing replacements for particular
     graphical primitive operations.  In other words, we can obtain the
     dummy device object and then set any of its slots to provide our
     own implementation.

     This function does not create the graphics device (see
     'graphicsDevice') but rather an object that is used to represent
     the R functions that an R-level graphics device will be given when
     it is instantiated.

     The default size function sets the value of the right and bottom
     to those in the device.

     Some of the graphical primitive functions are expected to return a
     value. These functions do not and so warnings about coercion
     generating 'NA' values may occur when you use these. These are not
     fatal.

_U_s_a_g_e:

     dummyDevice(..., bodies = makeBodies(), sample = simpleFun())

_A_r_g_u_m_e_n_t_s:

     ...: 'name = function' pairs that specify our own implementations
          of particular graphical operations.

  bodies: a list giving the bodies.

  sample: a sample function that is copied and its body modified.

_V_a_l_u_e:

     An object of class 'RDevDescMethods-class'.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang

_R_e_f_e_r_e_n_c_e_s:

     The R Internals Manual, R Development Core Team.

_S_e_e _A_l_s_o:

     'graphicsDevice'

_E_x_a_m_p_l_e_s:

       funs = dummyDevice()
       dev = graphicsDevice(funs)
       .Devices

           # to call browser in each function. This will get very tedious.
       funs = dummyDevice( bodies = RGraphicsDevice:::makeBodies(quote(browser())))
     ## Not run: 
       dev = graphicsDevice(funs)
     ## End(Not run)

       funs = dummyDevice(activate = function(dev) { dev$right = 1000; dev$bottom = 600})
       dev = graphicsDevice(funs)

       funs = dummyDevice(line = function(x1, y1, x2, y2, gcontext, dev) browser() )
       dev = graphicsDevice(funs)

       funs = dummyDevice()
       funs@activate = function(dev) { dev$right = 1000; dev$bottom = 600}
       dev = graphicsDevice(funs)

