Path: news.cs.au.dk!not-for-mail From: Flemming Gram Christensen Newsgroups: comp.lang.beta Subject: Re: How to copy a bitmap object (nti)? Date: 10 Feb 2000 15:49:09 +0100 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 69 Message-ID: References: <20000208201940.24992.qmail@noatun.mjolner.dk> NNTP-Posting-Host: ull.mjolner.dk X-Trace: xinwen.cs.au.dk 950194155 9460801 255.255.255.255 (10 Feb 2000 14:49:15 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 10 Feb 2000 14:49:15 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 Xref: news.cs.au.dk comp.lang.beta:12238 "Sascha Kimmel \(tricos Mediaservice\)" writes: > Hi! Hi. I think you can do a pixmap.init to get a fresh bitmap. Then use pixmap.drawpixmap to draw the background on this. then pixmap.drawpixmap again to draw the sprite on top. Regards /gram > > I want to copy a bitmap object (on Windows) to realize a simple image buffer > for animation. > (See http://msdn.microsoft.com/library/techart/msdn_anim32.htm and > http://msdn.microsoft.com/library/techart/msdn_flicker.htm for details) > This works as follows: you have a bitmap which is the background, a sprite > (also a bitmap) that you draw onto the background bitmap - and then copy the > resulting bitmap to the screen - this prevents flickering ("single buffer"). > > So I need to copy a bitmap (pixmap in beta): > > ... > screenBitmap,bg,sprite,buffer:^pixmap; > do > (** INIT **) > &pixmap[]->buffer[]; > &pixmap[]->screenBitmap[]; > 'background.bmp'->screenBitmap.read; > &pixmap[]->bg[]; > 'background.bmp'->bg.read; > &pixmap[]->sprite[]; > 'sprite.bmp'->sprite.read; > > ... > > (** Off-screen drawing **) > bg[]->buffer[]; (** well, here's the problem !! **) > (sprite[],(0,0),(5,5),sprite.width,sprite.height)->buffer.drawPixmap; > > > (** Copying buffer to screen bitmap **) > buffer[]->ScreenBitmap[]; (** another problem **) > ... > > > Due to the use of references instead of objects (a->b, (a,b pixmaps) gives a > compiler error) when assigning bg[] to the buffer[] and the following > drawPixmap both buffer[] and bg[] point to the same pixmap, so *both* are > changed. > > Any solution? > > Regards, > Sascha Kimmel > > -- /Flemming Gram Christensen ---------------------------------------------------------- Mjolner Informatics ApS Phone: +45 86 20 20 00 Science Park Aarhus Fax: +45 86 20 12 22 Gustav Wieds Vej 10 DK-8000 Aarhus C Denmark E-mail: gram@mjolner.dk ----------------------------------------------------------