Subversion Repositories bdplot

Rev

Rev 27 | Rev 34 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27 Rev 29
Line 2... Line 2...
2
### Used to open a graphics driver with BDplot.
2
### Used to open a graphics driver with BDplot.
3
 
3
 
4
### In X11, height  and width are scaled to get a nicer window on the screen.
4
### In X11, height  and width are scaled to get a nicer window on the screen.
5
### This hack is ugly. At least there should be a scaling factor in stead so that all measures are scaled (fonts, etc).
5
### This hack is ugly. At least there should be a scaling factor in stead so that all measures are scaled (fonts, etc).
6
 
6
 
7
bdopen <- function(file=bdp()$file,paper=bdp()$paper,mfrow=bdp()$mfrow,scale=TRUE)
7
bdopen <- function(file=bdp()$file,paper=bdp()$paper,mfrow=bdp()$mfrow,scale=TRUE,quality=NULL)
8
{
8
{
9
  .bdcalcsizes(paper=paper,mfrow=mfrow)
9
  .bdcalcsizes(paper=paper,mfrow=mfrow)
10
  prm <- .bdgetpars()
10
  prm <- .bdgetpars()
11
  if( !is.na(file) )
11
  if( !is.na(file) )
12
    {
12
    {
Line 26... Line 26...
26
      } else if ( substr(file,nchars-3,nchars)==".pdf")
26
      } else if ( substr(file,nchars-3,nchars)==".pdf")
27
        {
27
        {
28
          pdf(file=file, width=prm$width, height=prm$height, paper="special",family = "Helvetica")
28
          pdf(file=file, width=prm$width, height=prm$height, paper="special",family = "Helvetica")
29
        } else if (any(substr(file,nchars-3,nchars)==".jpg", substr(file,nchars-4,nchars)==".jpeg")) {
29
        } else if (any(substr(file,nchars-3,nchars)==".jpg", substr(file,nchars-4,nchars)==".jpeg")) {
30
          cat("Writing to jpeg file\n")
30
          cat("Writing to jpeg file\n")
-
 
31
          if(is.null(quality))
-
 
32
            quality=prm$jpeg.quality
31
          jpeg(filename=file,width=prm$width,height=prm$height,units=prm$size.unit,quality=prm$jpeg.quality,res=prm$jpeg.res,type="cairo")
33
          jpeg(filename=file,width=prm$width,height=prm$height,units=prm$size.unit,quality=quality,res=prm$jpeg.res,type="cairo")
32
### bitmap(file=file,type="jpeg",width=prm$width,height=prm$height,units=prm$size.unit,res=prm$jpeg.res,pointsize=.3)
34
### bitmap(file=file,type="jpeg",width=prm$width,height=prm$height,units=prm$size.unit,res=prm$jpeg.res,pointsize=.3)
33
        }
35
        }
34
    }
36
    }
35
  else {
37
  else {
36
 
38