makeGraphicsDeviceObject   package:RGraphicsDevice   R Documentation

_C_o_n_s_t_r_u_c_t_o_r _f_o_r _a_n _R_D_e_v_D_e_s_c_M_e_t_h_o_d_s _o_b_j_e_c_t

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

     This function acts as a constructor for an 'RDevDescMethods-class'
     object which collects functions together  that collectively
     implement an R graphics device. The resulting S4 object can then
     be passed to 'graphicsDevice' to create an active graphics device
     on which we can draw R graphics.

     This function takes the functions specified either individually as
     'name = function' (via ...) or as an existing list of named
     elements (via 'funcs'). It then assigns these functions to the
     corresponding slots in the 'RDevDescMethods-class' object. One can
     use the ... and the 'funcs' parameters together and those
     functions specified in ... will be merged with those in 'funcs'.

     By default, the function creates and populates its own instance of
     the 'RDevDescMethods-class' object that is returned. However, one
     can pass an already created object of class
     'RDevDescMethods-class'  or a sub-class. This allows this function
     to be used for initializing sub-classes. The function is
     sufficiently general that it uses run-time slot access so it
     naturally handles sub-classes and indeed objects entirely
     different classes.

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

     makeGraphicsDeviceObject(..., funcs = list(...), obj = new("RDevDescMethods"))

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

     ...: a collection of 'name = function' pairs specifying the 
          functions to be inserted into the corresponding slot in
          'obj'.  The slot names are matched using partial matching
          'pmatch'. 

   funcs: a named list of functions. This is an alternative to the ...
          specification that is convenient when the functions have
          already been collected into a list and it is akward to
          specify them via the ... parameter, e.g. via 'do.call'. 

     obj: the object whose slots are to be populated by the functions
          specified via ... and 'funcs'.  This is typically an object
          of class 'RDevDescMethods-class' or a sub-class. 

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

     'obj' with some of its slots updated.

_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:

     'RDevDescMethods-class' 'graphicsDevice'

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

       o = makeGraphicsDeviceObject()
       o@strWidth = function(str, gcontext, dev) { nchar(str) * 12}

