Solved

Creating and Using a Palette

Posted on 1997-03-23
4
207 Views
Last Modified: 2010-04-04
I need some code explaining how to:
1) Create a palette of colours for use with a TImage object.
I'll basically be plotting pixels on the canvas of the TImage.
2) Alter the palette
3) Save / Load it.

All I really need is some code with comments and I'll be able to figure it out.
Thanks, Andrew
0
Comment
Question by:andrewk032397
  • 2
4 Comments
 
LVL 2

Expert Comment

by:javiertb
ID: 1334828
You should take a look at the file DIBDemo2.zip at Delphi Super Page, but I guess you'll have to deal with these functions: SelectPalette, CreatePalette,RealisePalette and UpdateColors (you'll find more about then in the help documents).

Hope this helps.
0
 
LVL 2

Expert Comment

by:gysbert1
ID: 1334829
What do you want to do with the application ?

Do you really need access to the palette ?

If you use TImage.create you can create an Image (with a canvas and a palette) on which you can plot pixels, access and modify the palette and save the image ...
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 1334830
I've tried working with palettes at length ( D1 ). I managed to get objects to draw in the colour I wanted, but only if you had one on the screen at once! I'd be VERY interested to know if you ever manage to get it working properly!
0
 
LVL 2

Accepted Solution

by:
gysbert1 earned 100 total points
ID: 1334831
Have you had a look at the TImage component ?

Let me know if you still need help. As I said, first decide if you have to use palettes. As andrewjb noted, if your window does not have focus windows will take over the palette and adjust it to accomodate other apps. The only solution is to use the important colors available in palettes, etc, etc ...

Let me know if you do need more. If you need some code I can give it to you but I do not think it will do what you want it to.

I would still strongly suggest you use the TImage component's  
 TImage.Canvas.Pixels(x,y) to draw anything. This will be the  best you can do without hours of struggling.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question