delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/26/08:16:54

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro (bitmap)
Date: Wed, 25 Jun 1997 19:31:29 +0100
Organization: None
Distribution: world
Message-ID: <DThzwPABQWszEw0m@talula.demon.co.uk>
References: <Pine DOT OSF DOT 3 DOT 95 DOT 970625020646 DOT 19827A-100000 AT sendit DOT sendit DOT NoDak DOT edu>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 17
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Adam writes:
>What's the fastest way to get an 'unsigned char Screen[resx*resy]' into an
>Allegro BITMAP?

The best way is to make them share a region of memory. Either allocate
the buffer as an Allegro BITMAP (by calling create_bitmap()) and then
use bmp->line[0] as the base address of your array, or construct a new
bitmap object around your existing array. That would require a fair
amount of messing with the internals of the BITMAP structure, though,
which is obviously more likely to break with future versions of the
code: look at the source for the create_sub_bitmap() routine (in
graphics.c) to get an idea what you'd have to do...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019