Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to Converta RGB color to a CMYK color?



How to Converta RGB color to a CMYK color?..

Answer / Mr Praveen Kumar Jain

Converting an RGB color to CMYK in Delphi can be done using the following formula:nn```delphinfunction RGBToCMYK(r, g, b: Byte): TColor;nvarn c, m, y, k: Double;nbeginn r := r / 255; g := g / 255; b := b / 255;nn // Find minimum valuen if (r < g) and (r < b) thenn c := r;n else if g < b thenn c := g;n elsen c := b;nn // Calculate remaining valuesn m := (r - c) / (1 - c);n y := (g - c) / (1 - c);n k := (b - c) / (1 - c);nn // Convert CMYK values to TColor and returnn Result := RGBToCMYK_TColor(c, m, y, k);nend;nnfunction RGBToCMYK_TColor(c, m, y, k: Double): TColor;nbeginn // Adjust CMYK values to fit within range (0-255)n c := Round(c * 255); m := Round(m * 255); y := Round(y * 255); k := Round(k * 255);nn // Create a TColor with CMYK values and returnn Result := TColor.CMYKToRGB(c, m, y, k);nend;n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Delphi Interview Questions

How to run executables created in Kylix?

1 Answers  


what is the use of TSocketDispatcher?

1 Answers  


How to Create a non-VCL console project?

1 Answers  


What directory is the ActiveForm in ?

1 Answers  


How to handle exceptions in Thread objects ?

1 Answers  


How to use the Lookup method to return values from multiple columns ?

1 Answers  


How to connect to an InterBase database using the BDE API?

1 Answers  


Does Delphi 5 include Resource Workshop and InstallShield Express?

1 Answers  


How to move Client Objects to a different AS/400?

1 Answers  


How to retrieve a list of assigned properties ?

1 Answers  


How to Create a Worker Thread for Background Processing ?

1 Answers  


How to Keep an application in a minimized state?

1 Answers  


Categories