Solved

TImage Bitmap.Vertual Part 2

Posted on 1997-07-05
6
163 Views
Last Modified: 2012-05-04
Part 2.

The question still stands.

I would like to access the true palette of an image without touching the windows colour palette. Can this be done!  I'v tryed different ways and still I miss something.  I remember I found some place that an expert had a way to access the images true colour at a certin pixel, but did not give how this was done and I can't find that question.

The reason for this is I am trying to make a specal text to graphic(Pixel) Code program.  To retain the information for me and my friends to see.  I know I could encript the text but I had something like this working on the AMIGA Systems.  It is what I need for a program I'm working on to Graphic/text the data files for it.
0
Comment
Question by:PPaul
  • 4
  • 2
6 Comments
 
LVL 3

Expert Comment

by:mheacock
ID: 1338256
Thank you for inviting me to answer this question...but I
think I will pass.

Why?  I hate paletting.  It is a gigantic pain in the ass.
And besides, I think it is now becoming a thing of the past.
Why?  4MB video cards (true colour at 1280x1024) are now
dirt cheap.

Anything I write now requires true colour.  I don't write
programs for your regular home user, thus I can do make
this requirement.

You might want to rethink what you are doing and see if you can
make the same requirement.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1338257
If you load a bitmap into a TBitmap, all the colours in the
TBitmap will be mapped to the bitmaps palette.  That's if you
are loading a 256 colour bitmap.

If you load a true colour bitmap into a TBitmap, the colours
should not be mapped until it is displayed in a TImage.

But like I said, I don't do paletting anymore and don't have
the time to test.  I may be wrong.  If I am then this is a
shortcoming of Delphi...it should not map true colour bitmaps
until they are copied into a Display Context (DC).

Anyhow, I hope someone else can answer this question more
thoroughly.
0
 

Author Comment

by:PPaul
ID: 1338258
Thanks for the time and thanks for the help.  I did look into other areas and found another way with the 16 colour that is the windows defults.  It's not what I was looking for but it is close.

Here's how I did it..

I asign a 'array of string'  from 0 to 15. I then enerted the String vales that delphi understands

Ex.: 'clRed'

On the writing of a letter it evaluates the ascii code of the letter and then breaks it down.

 Ex.:
 a = 34. Convert the Integer to a string and get '34', add a '0' in front and get '034'.  I then break that into 3 parts that each coaspond to a number in the array of string list.

0= clBlack
3= clOlive
4= clNavy

I use this to change the pixels color with the pixels command.
When I read the same pixel I revers the proccess and get the letter I started with.

I still would like help on the abily to use he full true color range.  If any one out ther can improve on this please talk to me.

I thanks once more, mheacock,  for the time you sepent on the subject. I did learn somethin from it.
0
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.

 
LVL 3

Accepted Solution

by:
mheacock earned 200 total points
ID: 1338259
Found this in the help file under TColor:

"If the highest-order byte is zero ($00), the color obtained is the closest matching color in the system palette. If the highest-order byte is one ($01), the color obtained is the closest matching color in the currently realized palette. If the highest-order byte is two ($02), the value is matched with the nearest color in the logical palette of the current device context."

Check the high byte and set accordingly...I haven't tested
this...but it is worth a shot.  Grade or reject accordingly.

Cheers,
0
 

Author Comment

by:PPaul
ID: 1338260
I did see that in the delphi help way befor I came here for some help. (I do my reserch!) I tested it and I still got the window palette.  I just relised that a 255 color pattet has to be created for it to use $02.  I'm currently doing test with the relize pallete.  I'm not sure but when relizing a palette, does it take it as you statted.  Well I'll wait for an anaswer for a couple of days and then I'll grade you.  (and it will be good+.)  If you want to see the demo that I have, I can E-Mail you a copy!  And if you want to see the sorce code for it just stat it.

thanks.

0
 
LVL 3

Expert Comment

by:mheacock
ID: 1338261
How much code is there to look at at?  I don't have a lot of
time...what the heck...mail any way...

Code and program...

cerebus@islandnet.com

I'll try to help...ack!  :)  :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

19 Experts available now in Live!

Get 1:1 Help Now