Let's call the first value of the first pair pair1X Let's call the second value of the first pair pair1Y Let's call the first value of the second pair pair2X Let's call the second value of the second pair pair2Y So, we have (pair1X, pair1Y) and (pair2X, pair2Y) known values are pair1X, pair1Y, and pair2X if we take the difference in red between pair1X and pair1Y, add that to red of pair2X, and mod 256 ? same for green and blue and then make pair2Y by rgb( red, green, blue ) from the above
function do_it() local pair1X, pair1Y, pair2X, pair2Y pair1X = 0x185A39 pair1Y = 0xA5BDB5 pair2X = 0x31ABE1 = GetPair2Y(@m.pair2Y, m.pair2X, m.pair1X, m.pair1Y) ?transf(pair2Y, '@0') endfunc *_______________________________________________________________________________ function GetPair2Y(pair2Y, pair2X, pair1X, pair1Y) local pair1Xred, pair1Xgreen, pair1Xblue local pair1Yred, pair1Ygreen, pair1Yblue local pair2Xred, pair2Xgreen, pair2Xblue local pair2Yred, pair2Ygreen, pair2Yblue =FromRgb(m.pair1X, @m.pair1Xred, @m.pair1Xgreen, @m.pair1Xblue) =FromRgb(m.pair1Y, @m.pair1Yred, @m.pair1Ygreen, @m.pair1Yblue) =FromRgb(m.pair2X, @m.pair2Xred, @m.pair2Xgreen, @m.pair2Xblue) pair2Yred = mod(m.pair2Xred + (pair1Xred - pair1Yred), 256) pair2Ygreen = mod(m.pair2Xgreen + (pair1Xgreen - pair1Ygreen), 256) pair2Yblue = mod(m.pair2Xblue + (pair1Xblue - pair1Yblue), 256) pair2Y = rgb(pair2Xred, pair2Ygreen , pair2Yblue ) endfunc *_______________________________________________________________________________ function FromRgb(value, red, green, blue) red = bitand(m.value, 0xff) green = bitand(bitrShift(m.value, 8), 0xff) blue = bitand(bitrShift(m.value,16), 0xff) endfunc *_______________________________________________________________________________