Solved

Creating and Using a Palette

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PDF library for Delphi 2 103
Delphi Form ownership 4 70
HTML text in the body of an email (delphi code) 12 94
CheckListBox usage 3 48
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
A short film showing how OnPage and Connectwise integration works.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

929 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

15 Experts available now in Live!

Get 1:1 Help Now