Solved

Creating and Using a Palette

Posted on 1997-03-23
4
205 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now