[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bitmaps and the Mac.
Hi all,
I am attempting to develop a system in the DrScheme environment which
will be portable across PC and Mac computers. However, I'm having a
few problems with the Mac version, and wondered if there are any
other Mac users out there with similar problems / suggestions.
Firstly, I should say I'm writing code on both a PC (under Windows
ME) and the Mac (a G4, with OS 9.1). The PC environment is very
usable, and I am attempting to port working code to the Mac. I've
uncovered problems with bitmaps, their creation and saving to file.
As an example, I use the 'face' drawing routine from the help files
(under Drawing Toolbox Overview). The relevant part is as follows:
; Create a 300 x 300 bitmap
(define face-bitmap (make-object bitmap% 300 300))
; Create a drawing context for the bitmap
(define bm-dc (make-object bitmap-dc%))
; Direct the drawing context to the bitmap
(send bm-dc set-bitmap face-bitmap)
; A new bitmap's initial content is undefined, so clear it before drawing
(send bm-dc clear)
; Draw the face into the bitmap
(draw-face bm-dc)
Problem 1: I am having memory problems with creating a bitmap. e.g.
If I create a large bitmap, say 5000 x 5000, Scheme fails to create a
bitmap, giving error
set-bitmap in memory-dc%: bad bitmap: #<object:bitmap%>
More alarming, if I use a smaller size, 2500x2500, I get the error
message on every other attempt to execute the code. i.e. Execute ->
works, Execute -> fails, Execute -> works, ...
How much space do I need for bitmaps? I am allowing 100Mb to the
MrEd PPC program.
(I haven't tried the larger sizes on my PC, which has a third the RAM
of my Mac, but uncovered the memory problem with the small size of
500x500).
Problem 2: The reason I'm creating a bitmap in my program is merely
so as to save it, i.e. with a (send face-bitmap save-file "file-name"
'pict) command.
This works fine on the PC, but refuses to do anything but return #f on the Mac
("file-name" is selected using the put-file dialog, and has correct path, etc).
Any suggestions? Is there a better way to save the contents of a canvas?
Finally, I find that launchers must be created in the plt directory,
and only aliases can be located elsewhere, such as the Desktop. Is
that a problem with my setup as, again, I don't have that on the PC?
Thanks in advance for any help.
Peter.
--
---------------------------------------------------------------
Dr. Peter Lane
ESRC Centre for Research in Development,
Instruction and Training (CREDIT)
School of Psychology, University of Nottingham
NOTTINGHAM NG7 2RD, England
Email: pcl@psychology.nottingham.ac.uk
Tel: + 44 (0) 115 951 5310
Fax: + 44 (0) 115 951 5324
URL: http://www.psychology.nottingham.ac.uk/staff/Peter.Lane
---------------------------------------------------------------