Method: Fox.fxdecodeColorData

Defined in:
lib/fox16/core.rb

.fxdecodeColorData(data) ⇒ Object

The drag-and-drop data used for colors is a sequence of unsigned short integers, in native byte ordering. Here, we use the ‘S’ directive for String#unpack (which treats two successive characters as an unsigned short in native byte order) to decode the R, G, B and A values.



367
368
369
370
# File 'lib/fox16/core.rb', line 367

def Fox.fxdecodeColorData(data)
  clr = data.unpack('S4')
  Fox.FXRGBA((clr[0]+128)/257, (clr[1]+128)/257, (clr[2]+128)/257, (clr[3]+128)/257)
end