FabDev 8 Posted May 17, 2022 Hello, I'am looking since a few time, without any success, a function which return me a gradient (Tcolor) from an array of double (or integer) value. For example : Const REVENUE_ARRAY: array [1 .. 5] of integer= (10,15,30,45,60); Result with a gradient from Yellow to red : 10 => Yellow ... 30 => Orange ... 60 => Red My purpose is to fill a MAP ShapeFile items (Devexpress MAP) with a gradient which correspond to a Revenue array ( REVENUE_ARRAY) Share this post Link to post
corneliusdavid 214 Posted May 23, 2022 So since you can't find one, just write your own. It shouldn't be terribly difficult. You could probably even calculate the RGB value based on the number given. Share this post Link to post
Anders Melander 1783 Posted May 23, 2022 https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-gradientfill ...or since you're using DevExpress anyway, use one of their gradient functions. Share this post Link to post
hsauro 40 Posted May 23, 2022 FMX has a TGradient non-visual class, I’ve used it in the past. Might be worth looking at, though I notice your referring to TColor rather than TAlphaColor so it might not be applicable. Share this post Link to post
FabDev 8 Posted May 24, 2022 (edited) Yes it's not so complicated. But find an already done (and tested) function is often less time lost. Some component has this kind of function but not always easy to find/extract. Finally a colleague, which has code a lot on assembler on Atari 68000/68030 (Doom version) , took a nasty pleasure to code this function with a lot of SHR and boolean operator 😉. So it will not take a lot of time to execute even on CPU with 8 Mhz clock speed 😉 Edited May 24, 2022 by FabDev Share this post Link to post