[futurebasic] PICT files

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2009 : Group Archive : Group : All Groups

From: Bill Zielenbach <bill@...>
Date: Fri, 30 Oct 2009 10:36:58 -0400
A few years ago, Staz helped me with setup for a graph that one of my
programs generates.

It works fine, with one small exception.

When I open the file in Apple's Preview program, the background is dark. The
plotted points are there, as well as all the axis labels. When I "Save As"
the file from Preview, there is a check in a checkbox labelled Alpha. If I
uncheck that box, the file gets saved in the format I wanted, with a "white"
background.

What can I do when creating the file, to generate it correctly with the
"white" background. Even better, when that is fixed, how can I output it as
a pdf instead.

I've collected what I believe is the relevant code (please see some
additional comments regarding compilation that appear after the code):

dim result%
dim gPlotterLocalPictfilename$
dim gMyPictureH AS HANDLE TO Picture

dim gFSRPlotterLocalPictfilename as FSRef
dim gappRef as FSRef// FSRef to folder containing the application
result%=fn FD_ApplicationDirectoryGetFSRef( @gappRef ) // FSRef to folder
containing the application
'
def open "PICT"
'
dim as handle @dummyH
_pictheadersize=512
dummyH=fn NewHandleClear(_pictheadersize)

'
' open the file that will contain the local copy of the PICT file generated
by this program
gPlotterLocalPictfilename$="Programname.Plot"
scratch$=gPlotterLocalPictfilename$
// I've used scratch$ for the file name so that the code for getting FSRef's
// and opening the files can be modularized and reused with minimal retyping
result%=fn FD_PathGetFSRef( fn CFSTR(scratch$), @gappRef,
@gFSRPlotterLocalPictfilename )
'
open "O",37,scratch$,@gappRef
'
'
write file #37,[dummyH],_pictheadersize
'
def disposeH(dummyH)'

//open window #1 for plotting
//generate my plot

call hidepen
picture off, gMyPictureH
write file # 37,[gMyPictureH], fn gethandlesize(gMyPictureH)
close # 37
'
def disposeH(gMyPictureH)
window close #1


Additionally,
The compiler warns me that the def disposeH commands is deprecated. What
should I substitute in its place?

It also warns me

passing argument 1 of 'GetHandleSize' from incompatible pointer type

so I tried changing all instances of gMyPicureH to gMyPicureH& since I
assume handles are supposed to be "long."

That gives me these errors
€€ Can't retype variable in line 31 of Plotterroot.incl: gMyPictureH&
 31:  dim gMyPictureH& AS HANDLE TO Picture
                                         ^
€€ Bad factor in expression in line 440 of Plotterroot.incl: 'gMyPictureH&'
 440:  picture off, gMyPictureH&
                             ^
€€ Bad factor in expression in line 442 of Plotterroot.incl: 'gMyPictureH&'
 442:  write file # 37,[gMyPictureH&], fn gethandlesize(gMyPictureH&)
                                   ^
€€ Bad factor in expression in line 444 of Plotterroot.incl: 'gMyPictureH&'
 444:  def disposeH(gMyPictureH&)


Any help would be appreciated.