Page 1 of 1

(VB6) RGB visualizer

Posted: Thu Jun 12, 2008 3:50 pm
by RobertBell
This is a very simple VB6 application that connects to Palette to run this script (defined in an Auto Start macro):

Code: Select all

function newStack()
   return {""}   -- starts with an empty string
end

function addString(stack, s)
  table.insert(stack, s)    -- push 's' into the the stack
  for i=table.getn(stack)-1, 1, -1 do
    if string.len(stack[i]) > string.len(stack[i+1]) then
       break
     end
     stack[i] = stack[i] .. table.remove(stack)
   end
end

function GetRGB(StartFix, EndFix)
  local s = newStack()
  for i = StartFix, EndFix do
    Intensity = tonumber(HC.AttributeGetValue(i))
    addString(s, string.format('%02X', HC.AttributeGetValue(i,'Color A') * (Intensity / 100) * 2.55))
    addString(s, string.format('%02X', HC.AttributeGetValue(i,'Color B') * (Intensity / 100) * 2.55))
    addString(s, string.format('%02X', HC.AttributeGetValue(i,'Color C') * (Intensity / 100) * 2.55))
  end
  s = table.concat(s,'')

  print (s)
end
I found this very handy before we had the colour bubbles in the grid to show RGB FXs.
RGB demo app.jpg
RGB demo app.jpg (90.15 KiB) Viewed 793 times