Solved

Creating and Using a Palette

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

Technology Partners: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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