Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

several TImages, 1 hPalette -> problem

Posted on 1997-10-20
4
Medium Priority
?
524 Views
Last Modified: 2012-08-13
I use several TImages to display data. They all need the same colours, so I made 1 logical palette and 1 hPalette, which I assigned to the Picture.Bitmap.Palette property of all TImages. I use CopyRect to copy part of a memory bitmap to the TImages. This goes OK, unless I mirror the data in the CopyRect. (by passing for the source rect: Bounds(width-1, 0, -width, height-1)). Then the TImage stays black. If I give every TImage its own hPalette, the mirroring goes fine.

My questions:
1- is what I try at all posiible, or do all TImages always need  a unique hPalette?
2- if it is possible, what should I change to make it work?

thanks,

Wim
0
Comment
Question by:cadenza
[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
 

Author Comment

by:cadenza
ID: 1348435
Edited text of question
0
 

Accepted Solution

by:
jorgen.hojdmo earned 600 total points
ID: 1348436
Hi!

I have had the same problem, but could not make it work properly by assigning the palette property. A workaround is to use the WinAPI. Before you draw on the bitmap call:

SelectPalette(Bitmap.Canvas.Handle,YourHPalette,false);
RealizePalette(Bitmap.Canvas.Handle);

This will work fine if you do not assign the Palette.

Call the select and realize everytime your app gets focus.


0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348437
This is fine however better way is to remember the hPalette in your program and use SelectPalette( savedpalette .....
at the end of pgm you must delete this object.

BTW SelectPalette  returns previous palette so you must save this and then restore. You can loose resources if this will not be done !.

prevpal := SelectPalette( ...
...
any code
...
SlelectPalette( prevpal

this is good idea to save resources without loose.

sorry for my english.
0
 

Author Comment

by:cadenza
ID: 1348438
Thanks for the answer and valuable comment. This not only will save me time, but, as I understand from Mirek's comment, resources as well !!!

Wim
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

604 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