🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.graphics
Article #48

Palette and backgrounds problems using BC++ 4.0

#48
From: Laurent-David HASSON
Date: Thu, 08 Jun 1995 00:00
62 lines
3556 bytes

  I am writing a little program that simply allows someone to make collages 
of several BMP files... It could be usefull if you want to make a gross 
"post it" bord that accepts graphics. However, i am having 2 problems:

  I am using Borland C++ 4.0, and i use DDBs. I create a TDib from a given 
filename, then create a corresponding TBitmap and TPalette, and i blit each 
image to the screen at coordinates specified by the user... It works in 256 
color mode.


 - Palette management.

   When i add a bitmap to the "canvas", the first one works fine, but the 
following ones cause the palette to change... I tried to not change the 
palette after the first image has been put on the canvas, but then, all the 
folowing images come in weird colors... Is there a way to have a common 
palette? Should i "play" with palettes and make an average palette, 
depending on the individual bitmaps i want to assemble? How should i go 
about it? 
   I am sure that what i want is feasible since many programs, including MS 
PowerPoint, allow the user to assemble images from different sources, like 
metafiles, bmp etc... and the colors don't die in the way.


  - Transparent Background

    Generally, people who "post" images on the canvas use a white 
background, with an image on it, text.... whatever could fit in a BMP file. 
When i output the equivalent TBitmap on my DC, the white background is 
shown, and instead of having, let's say, a funny clip art on the background 
of the canvas (which can be complex), the image posted is bounded by a 
white rectangle. Is there a way to specify a transparent background, or do 
a basic fill of all the "outside" of the picture in the bmp (the 
background) with a "transparent" color that won't disrupt the content of 
the DC where i blit the bitmap?
    Again, i know it can be done because many apps, including PowerPoint 
work like that.
    Also, for now, i am using only bitmaps, but i plan on allowing people 
to also send metafiles (they are smaller, and scalable).I think the problem 
would not appear in metafiles because they do not include a background... 
Am i correct?



  I would appreciate any help, including code, pointers to code that sort 
of do what i need... Don't point me to a book because in here (Canada), 
books are quite expensive, and i can't afford buying a new book now.


Thanks,
Laurent.


PS: The system i use gets rid of postings quite rapidly (a couple of days), 
so i would appreciate responses through Email so i am sure i won't miss 
anything. Thanks again.



   
Technical Details
Message-ID: <3r5qil$dd4_003@ldh.interlog.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 124e6c,84b1ef83764e4e53,start
X-Google-Attributes: gid124e6c,public
X-Google-Thread: fbde8,84b1ef83764e4e53,start
X-Google-Attributes: gidfbde8,public
X-Google-Thread: 1120e8,84b1ef83764e4e53,start
X-Google-Attributes: gid1120e8,public
X-Google-Thread: 101278,84b1ef83764e4e53,start
X-Google-Attributes: gid101278,public
X-Google-Thread: 105df1,84b1ef83764e4e53,start
X-Google-Attributes: gid105df1,public
From: ldh@interlog.com (Laurent-David HASSON)
Subject: Palette and backgrounds problems using BC++ 4.0
Date: 1995/06/08
Message-ID: <3r5qil$dd4_003@ldh.interlog.com>
X-Deja-AN: 104039872
distribution: world
organization: Interlog Internet Services -Voice (416) 975-2655 -Data 515-1414
newsgroups: comp.os.ms-windows.programmer.graphics,fr.comp.windows.divers,comp.os.ms-windows.programmer.misc,alt.binaries.pictures.utilities,comp.os.ms-windows.apps.utilities