Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-25 Thread Michael Van Canneyt
On Mon, 25 Sep 2017, James Richters wrote: See what I wrote yesterday :) Sorry I had a duplicate message, I was having difficulty with my email and accidentally sent a mail with an alias, I thought it was rejected but it was just delayed. Here is what I have now, and it's working great,

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-25 Thread James Richters
> See what I wrote yesterday :) Sorry I had a duplicate message, I was having difficulty with my email and accidentally sent a mail with an alias, I thought it was rejected but it was just delayed. Here is what I have now, and it's working great, thanks for the help. Function Find_Color(ColorA

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-25 Thread Sven Barth via fpc-pascal
Am 25.09.2017 08:13 schrieb : > I have 2 arrays that are not [0..255], one is [1..14] the other is [0..15] is there a way I could expand this scheme to use those arrays as well? The For loop would need to adjust to the size of the arrays somehow. See what I wrote yesterday :) Regards, Sven ___

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread Jamesmail
should that be Find_Color:=BestChoice; ?? Yes, it should be, Also noticed a typo in my groupings, it wouldn't affect anything but I like to make it clear. So now I have this for the function: function Find_Color(Constref ColorArray :TVGA256Array; R ,G ,B : Word) : Byte; Var Dist,Closest:D

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread Ralf Quint
On 9/24/2017 12:07 PM, James Richters wrote: > Thank you for explaining how to achieve this. > I am curious about the meaning behind the prefixes you used: >> TVGA256Array = Array[0..255] of VGARGBRec; >> PVGA256Array = ^TVGA256Array; > Do the T and P in front of VGA256Array have a special me

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread Sven Barth via fpc-pascal
On 24.09.2017 21:07, James Richters wrote: > Thank you for explaining how to achieve this. > I am curious about the meaning behind the prefixes you used: >> TVGA256Array = Array[0..255] of VGARGBRec; >> PVGA256Array = ^TVGA256Array; > Do the T and P in front of VGA256Array have a special mean

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread James Richters
Thank you for explaining how to achieve this. I am curious about the meaning behind the prefixes you used: > TVGA256Array = Array[0..255] of VGARGBRec; > PVGA256Array = ^TVGA256Array; Do the T and P in front of VGA256Array have a special meaning or significance? I see things like that all

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-24 Thread wkitty42
On 09/24/2017 01:55 AM, Michael Van Canneyt wrote: Then define function Find_Color(anArray :PVGA256Array; r ,g ,b : Word) : Byte;  Var   Dist,closest:Double;   i,bestchoice:Byte; begin    Closest:=20;    For i:= 0 to 255 do   Begin Dist :=  ((R-AnArray^[i].R))*((R-AnArray

Re: [fpc-pascal] Syntax to select constant or variable with function call

2017-09-23 Thread Michael Van Canneyt
On Sat, 23 Sep 2017, James Richters wrote: I have several Similar arrays as follows for translating various color schemes into RGB565, I currently have 5 arrays but may add more. ACI256: Array[0..255] of VGARGBRec = ( (R:$00; G:$00; B:$00; RGB:$), //[ 0] (R:$FF; G:$00; B:$0

[fpc-pascal] Syntax to select constant or variable with function call

2017-09-23 Thread James Richters
I have several Similar arrays as follows for translating various color schemes into RGB565, I currently have 5 arrays but may add more. ACI256: Array[0..255] of VGARGBRec = ( (R:$00; G:$00; B:$00; RGB:$), //[ 0] (R:$FF; G:$00; B:$00; RGB:$F800), //[ 1] (R:$FF; G:$FF;