On 05/04/2019 19:58, Ed Stokes wrote:
// background color
Dim c As Color = &cff0000 ' Defaults to Alpha value 0
outputStream.WriteUInt8 (1) ' RGB spec
outputStream.WriteUInt16 (c.Alpha)
outputStream.WriteUInt16 (c.Red)
outputStream.WriteUint16 (c.Green)
outputStream.WriteUInt16 (c.Blue)
outputStream.WriteUInt16 (0) ' padding
Hi Ed,
oops my bad, not for the first time on this. You need to shift the 8-bit
channel values left by 8 bits, without that they will be very near
white, also an alpha channel of &hff is required to make the specified
colour opaque. I recommend writing a subroutine to pack a Xojo Color
value as a QColor value in a BinaryStream:
Public Sub PackColor (os As BinaryStream, c As Variant = Nil)
If c.IsNull Then
os.WriteUInt8 (0) ' Invalid
For i As Integer = 1 To 5
os.WriteUInt16 (0)
Next
Else
os.WriteUInt8 (1) ' RGB
os.WriteUInt16 (Bitwise.ShiftLeft (c.ColorValue.Alpha, 8, 16))
os.WriteUInt16 (Bitwise.ShiftLeft (c.ColorValue.Red, 8, 16))
os.WriteUInt16 (Bitwise.ShiftLeft (c.ColorValue.Green, 8, 16))
os.WriteUInt16 (Bitwise.ShiftLeft (c.ColorValue.Blue, 8, 16))
os.WriteUInt16 (0) ' padding
End If
End Sub
You could then call like:
os.WriteUInt32 (magic_number)
os.WriteUInt32 (schema)
os.WriteUInt32 (13) ' Highlight callsign
PackString (os, "WSJT-X")
PackString (os, "G4WJS")
PackColor (os, &c1f0000ff) ' Light red background colour
PackColor (os) ' No foreground colour
os.WriteBoolean (True)
os.Close
' ...
73
Bill
G4WJS.
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel