[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

rgb values change randomly?! TImage?! TBitmap?!

Posted on 2001-06-25
4
Medium Priority
?
176 Views
Last Modified: 2010-04-06
hi,

i'm making a simple colouring program. the program uses a colorbar i made myself. the colorbar consists of 39 rgb colors.

i've filled a simple black & white picture with some colors (using floodfill). now comes the trickiest part..
i've loaded the original black and white picture in a TImage(image1). and i've loaded the painted picture in another TImage(image2). Now, when i try to color the original picture, my program checks if the color i'm using is the same as the color i used before (and that is now on image2).

i'm using canvas.pixels[x,y] to determine to color of the pixel at [x,y] on image2 and i compare it with the current brush color i'm about to use.

in some cases the colors match and that's, cuz that's what i want. but in a lot of cases the colors differ a little. e.g. color about to be used on image1 = rgb(130,189,140) while the original color(image2) = rgb(130,187,139). this doesnt match, thus is wrong.

the essence of the program is, that a color can only be used when it matches. remember i'm only using the 39 colors.

it's very frustating...

thanks in advance
0
Comment
Question by:brutebass
[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
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 300 total points
ID: 6224246
What pixel format are you using? Try setting the pixel format for your two images to be 24 bit:

Image1.Picture.Bitmap.PixelFormat := pf24Bit;

If you're using a 256 colour bitmap or your screen depth isn'y 24 bit then WIndows will either dither the colour (not likely) or go for a close approximation, and it's this that's causing your colour values to differ slightly

The Neil =:)
0
 

Author Comment

by:brutebass
ID: 6224280
both images are already 24bit images. and the timage controls are already set to pf24bit. didnt fix my problem...
0
 

Author Comment

by:brutebass
ID: 6224313
it did fix my problem..hehe ... forgot one thing to test...
thanks man!
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 6224546
Anytime

The Neil =:)
0

Featured Post

Industry Leaders: 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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 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