\HeaderA{convertNative}{Convert a Unit Object to Native units}{convertNative}
\keyword{dplot}{convertNative}
\begin{Description}\relax
\bold{This function is deprecated in grid version 0.8 and will be
made defunct in grid version 1.9}

You should use the \code{convertUnit()} function or one of its
close allies instead.

This function returns a numeric vector containing the specified
x or y locations or dimensions, converted to "user" or "data"
units, relative to the current viewport.
\end{Description}
\begin{Usage}
\begin{verbatim}
convertNative(unit, dimension="x", type="location")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{unit}] A unit object. 
\item[\code{dimension}] Either "x" or "y". 
\item[\code{type}] Either "location" or "dimension". 
\end{ldescription}
\end{Arguments}
\begin{Value}
A numeric vector.
\end{Value}
\begin{Section}{WARNING}
If you draw objects based on output from these conversion
functions, then resize your device, the objects will be drawn 
incorrectly -- the base R display list will not recalculate these
conversions.  This means that you can only rely on the results of 
these calculations if the size of your device is fixed.
\end{Section}
\begin{Author}\relax
Paul Murrell
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{grid.convert}{grid.convert}}, \code{\LinkA{unit}{unit}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
grid.newpage()
pushViewport(viewport(width=unit(.5, "npc"),
                       height=unit(.5, "npc")))
grid.rect()
w <- convertNative(unit(1, "inches"))
h <- convertNative(unit(1, "inches"), "y")
# This rectangle starts off life as 1in square, but if you
# resize the device it will no longer be 1in square
grid.rect(width=unit(w, "native"), height=unit(h, "native"),
          gp=gpar(col="red"))
popViewport(1)

# How to use grid.convert(), etc instead
convertNative(unit(1, "inches")) ==
  convertX(unit(1, "inches"), "native", valueOnly=TRUE)
convertNative(unit(1, "inches"), "y", "dimension") ==
  convertHeight(unit(1, "inches"), "native", valueOnly=TRUE)
\end{ExampleCode}
\end{Examples}

