Solved

Creating and Using a Palette

Posted on 1997-03-23
4
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

617 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