[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bitmaps and the Mac.



At 12:29 PM +0100 10/15/01, Peter Lane wrote:
>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%>

Okay, this is not so surprising.  Since a bitmap uses 4 bytes/pixel, 
you're talking about (5000 * 5000 * 4) = ~100 Megabytes of memory. 
That's a very big dynamically allocated object.

>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).

This is probably related to a memory-allocation problem in MrEd, 
whereby collections are not triggered by certain kinds of allocation. 
This should be fixed in the next version of DrScheme (200).

>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?

Yep, but you might not like it.  Try saving with the 'xpm or the 'xbm 
flag.  Of course, then you have to convert the image to a PICT using 
some other tool (GraphicConverter?)

This seems rather a distressing state of affairs; perhaps I'll try to 
add PICT saving for v200.


john clements