www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/21/17:15:29

From: "Chris Bailey" <chris DOT bailey AT softhome DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem in Allegro
Date: Tue, 21 Apr 1998 20:45:37 +0100
Lines: 46
NNTP-Posting-Host: nas9-18.thefree.net
Message-ID: <353cf9cf.0@news.thefree.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I am using Allegro v3.0 and DJGPP to write a garden design package. The
program I am writing obviously requires having many drawing objects on
the screen at once (circles = trees, rectangles = sheds, polygons =
ponds). If I use solid fill colours i.e. green tree, brown shed, there
is no problem because the same pallete can be used throughout the
garden. However I have decided to take it to another level where the
objects aren't just coloured in with solid colours but a bitmap is tiled
across the object. I know how to do this but it requires changing the
pallete to the pallete that the bitmap is drawn in so that it displays
correctly. When I do this it seems to change the colours of everything
on the screen to the new pallete even though they aren't being re-drawn.
How do I get around this?

This is an example of the code that causes problems:

{
BITMAP* my_bitmap;
PALLETE my_pallete;
clear (screen);
rectfill(screen,200,200, 799, 599, DARKGRAY);
my_bitmap = load_bitmap("C:\\WINDOWS\\FOREST.BMP", my_pallete);
drawing_mode(DRAW_MODE_COPY_PATTERN, my_bitmap, 0, 0);
set_pallete(my_pallete);
circlefill (screen,400,300,280,RED);
}

After drawing the circlefill using FOREST.BMP to tile it, the rectfill
which was darkgray is now the corresponding colour in the FOREST.BMP's
pallete even though it is not being redrawn.

I want to be able to draw several bitmaps on the screen using different
palletes without the change affecting every other bitmap that is already
on the screen.

Any help is greatly appreciated
C. Bailey

Please eMail suggestions to chris DOT bailey AT softhome DOT net








- Raw text -


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