The R Project SVN R

Rev

Rev 51838 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51838 Rev 52406
Line 1902... Line 1902...
1902
    if (GRecording(call, dd))
1902
    if (GRecording(call, dd))
1903
	GErecordGraphicOperation(op, originalArgs, dd);
1903
	GErecordGraphicOperation(op, originalArgs, dd);
1904
    return R_NilValue;
1904
    return R_NilValue;
1905
}
1905
}
1906
 
1906
 
-
 
1907
SEXP attribute_hidden do_path(SEXP call, SEXP op, SEXP args, SEXP env)
-
 
1908
{
-
 
1909
    /* path(x, y, col, border, lty, ...) */
-
 
1910
    SEXP sx, sy, nper, rule, col, border, lty;
-
 
1911
    int nx, npoly;
-
 
1912
    int ncol, nborder, nlty, i;
-
 
1913
    double *xx, *yy;
-
 
1914
    const void *vmax = NULL /* -Wall */;
-
 
1915
 
-
 
1916
    SEXP originalArgs = args;
-
 
1917
    pGEDevDesc dd = GEcurrentDevice();
-
 
1918
 
-
 
1919
    GCheckState(dd);
-
 
1920
 
-
 
1921
    if (length(args) < 2) error(_("too few arguments"));
-
 
1922
    /* (x,y) is checked in R via xy.coords() ; no need here : */
-
 
1923
    sx = SETCAR(args, coerceVector(CAR(args), REALSXP));  args = CDR(args);
-
 
1924
    sy = SETCAR(args, coerceVector(CAR(args), REALSXP));  args = CDR(args);
-
 
1925
    nx = LENGTH(sx);
-
 
1926
 
-
 
1927
    PROTECT(nper = CAR(args)); args = CDR(args);
-
 
1928
    npoly = LENGTH(nper);
-
 
1929
 
-
 
1930
    PROTECT(rule = CAR(args)); args = CDR(args);
-
 
1931
 
-
 
1932
    PROTECT(col = FixupCol(CAR(args), R_TRANWHITE));	args = CDR(args);
-
 
1933
    ncol = LENGTH(col);
-
 
1934
 
-
 
1935
    PROTECT(border = FixupCol(CAR(args), gpptr(dd)->fg)); args = CDR(args);
-
 
1936
    nborder = LENGTH(border);
-
 
1937
 
-
 
1938
    PROTECT(lty = FixupLty(CAR(args), gpptr(dd)->lty)); args = CDR(args);
-
 
1939
    nlty = length(lty);
-
 
1940
 
-
 
1941
    GSavePars(dd);
-
 
1942
    ProcessInlinePars(args, dd, call);
-
 
1943
 
-
 
1944
    GMode(1, dd);
-
 
1945
 
-
 
1946
    vmax = vmaxget();
-
 
1947
 
-
 
1948
    /*
-
 
1949
     * Work in device coordinates because that is what the
-
 
1950
     * graphics engine needs.
-
 
1951
     */
-
 
1952
    xx = (double*) R_alloc(nx, sizeof(double));
-
 
1953
    yy = (double*) R_alloc(nx, sizeof(double));
-
 
1954
    if (!xx || !yy)
-
 
1955
	error(_("unable to allocate memory (in GPath)"));
-
 
1956
    for (i=0; i<nx; i++) {
-
 
1957
        xx[i] = REAL(sx)[i];
-
 
1958
        yy[i] = REAL(sy)[i];
-
 
1959
        GConvert(&(xx[i]), &(yy[i]), USER, DEVICE, dd);
-
 
1960
        if (!(R_FINITE(xx[i]) && R_FINITE(yy[i])))
-
 
1961
            error(_("invalid x or y (in GPath)"));
-
 
1962
    }
-
 
1963
 
-
 
1964
    if (INTEGER(lty)[0] == NA_INTEGER)
-
 
1965
	gpptr(dd)->lty = dpptr(dd)->lty;
-
 
1966
    else
-
 
1967
	gpptr(dd)->lty = INTEGER(lty)[0];
-
 
1968
 
-
 
1969
    GPath(xx, yy, npoly, INTEGER(nper), INTEGER(rule)[0] == 1,
-
 
1970
          INTEGER(col)[0], INTEGER(border)[0], dd);
-
 
1971
 
-
 
1972
    GMode(0, dd);
-
 
1973
 
-
 
1974
    GRestorePars(dd);
-
 
1975
    UNPROTECT(5);
-
 
1976
    /* NOTE: only record operation if no "error"  */
-
 
1977
    if (GRecording(call, dd))
-
 
1978
	GErecordGraphicOperation(op, originalArgs, dd);
-
 
1979
 
-
 
1980
    vmaxset(vmax);
-
 
1981
    return R_NilValue;
-
 
1982
}
-
 
1983
 
1907
SEXP attribute_hidden do_raster(SEXP call, SEXP op, SEXP args, SEXP env)
1984
SEXP attribute_hidden do_raster(SEXP call, SEXP op, SEXP args, SEXP env)
1908
{
1985
{
1909
    /* raster(image, xl, yb, xr, yt, angle, interpolate, ...) */
1986
    /* raster(image, xl, yb, xr, yt, angle, interpolate, ...) */
1910
    const void *vmax;
1987
    const void *vmax;
1911
    unsigned int *image;
1988
    unsigned int *image;