Series of known issues articles are showing known issue itself about Small Basic and it's workaround.  In this article, local means Small Basic IDE environment and remote means smallbasic.com/program/?<id> environment with internet browser and Silverlight add-in.

Phenomenon

GraphicsWindow color operations and properties below return "#rrggbb"in local but “#FFrrggbb” in remote.

  • GraphicsWindow.GetPixel()
  • GraphicsWIndow.GetRandomColor()
  • GraphicsWindow.GetColorFromRGB()
  • GraphicsWindow.BrushColor
  • GraphicsWindow.PenColor
  • GraphicsWindow.BackgroundColor

So such as following code doesn't work properly in remote.

If GraphicsWindow.GetPixel(x, y) <> "#FFFFFF" Then
  GraphicsWindow.SetPixel(x, y, "Black")  ' convert to black
EndIf

Top FF in the value returned by GetPixel in remote means that alpha blending is 255.  Alpha blending value represents opacity of that color.  FF (hexadecimal) is completely opaque, 00 is completely transparent.  So such as following code works well even in remote.

GraphicsWindow.FillRectangle(10, 10, 16, 16)
GraphicsWindow.DrawEllipse(11, 11, 14, 14)
For y = 0 To 15
  For x = 0 To 15
    color = GraphicsWindow.GetPixel(x + 10, y + 10)
    GraphicsWindow.BrushColor = color
    GraphicsWindow.FillRectangle(100 + x * 8, 10 + y * 8, 8, 8)
  EndFor
EndFor

Workaround

As following code, you can ignore alpha blending byte.

color = GraphicsWindow.GetPixel(x, y)
len = Text.GetLength(color)
color = "#" + Text.GetSubTextToEnd(color, len - 5)

Sample Program

http://smallbasic.com/program/?KTK906-0

See Also

Small Basic: Difference Between Local and Remote