Mail Archives: djgpp/1996/06/18/07:48:09
Xref: | news2.mv.net comp.os.msdos.djgpp:5123
|
From: | Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: A few more DJGPP Questions...
|
Date: | Tue, 18 Jun 1996 11:49:45 +0100
|
Organization: | The University of York, UK
|
Lines: | 53
|
Message-ID: | <Pine.SGI.3.91.960618112844.15738A-100000@sgi16.york.ac.uk>
|
NNTP-Posting-Host: | sgi16.york.ac.uk
|
Mime-Version: | 1.0
|
In-Reply-To: | <834783710snz@flag.demon.co.uk>
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
On Fri, 14 Jun 1996, Ben Ashley wrote:
> Actually, I was gonna Email you about something, but I didn't know if you
> were still around :). Still, I may aswell ask my Email questions here:
I'm here for a couple more weeks yet (two, to be exact).
> 1. In my picture boxes, I am going to create a bitmap, with the
> dimensions of the client area of the picture boxes. Any
> drawing/writing to this control willl therefore go to the bitmap.
> memory bitmap to screen? Should I create A sub-bitmap or what? I
This could be done with or without a sub-bitmap, it really wouldn't make
much difference. Without a sub-bitmap, your display code would look like:
blit(image, screen, 0, 0, p_box_x, p_box_y, width, height);
With a sub-bitmap, in your setup code you could do:
sub_bitmap = create_sub_bitmap(screen, p_box_x, p_box_y, width, height);
and then display it with:
blit(image, sub_bitmap, 0, 0, 0, 0, width, height);
Using a sub-bitmap has the advantage that you can use zero-based
coordinates, and the sub-bitmap has it's own clipping so you don't need
to worry about setting the screen clip rectangle before you draw to it.
> 2. If the picture box resized, how would I go about resizing the bitmap?
> Do I just put it in a temporary location, delete the old, make a
> new one with the new size, clear it and copy the stored bitmap to
> the new one?
That's how the grabber utility does it when you resize bitmap objects. It
depends if you want the resize to clip them or just scale them: for
scaling you could keep the original memory bitmap and just use
stretch_blit() to display it. If you don't want to scale it, try
something like:
BITMAP *temp = create_bitmap(new_w, new_h);
blit(image, temp, 0, 0, 0, 0, MIN(old_w, new_w), MIN(old_h, new_h));
destroy_bitmap(image);
image = temp;
/*
* Shawn Hargreaves. Why is 'phonetic' spelt with a ph?
* Check out Allegro and FED on http://www.york.ac.uk/~slh100/
*/
- Raw text -