| makeGraphicsDeviceObject {RGraphicsDevice} | R Documentation |
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.
makeGraphicsDeviceObject(..., funcs = list(...), obj = new("RDevDescMethods"))
... |
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.
|
obj with some of its slots updated.
Duncan Temple Lang
“The R Internals Manual”, R Development Core Team.
RDevDescMethods-class
graphicsDevice
o = makeGraphicsDeviceObject()
o@strWidth = function(str, gcontext, dev) { nchar(str) * 12}