private void RebuildTexture()
{
// Alte Textur entsorgen
if (tex != null)
{
tex.Dispose();
tex = null;
}
Color[] buffer;
switch (LineType)
{
case LineType.None:
break;
case LineType.Solid:
buffer = new Color[LineWidth * LineWidth];
for (int i = 0; i < buffer.Length; i++)
buffer[i] = LineColor;
tex = new Texture2D(Skin.Pix.GraphicsDevice, LineWidth, LineWidth);
tex.SetData(buffer);
MinWidth = MinHeight = (LineWidth * 2) + 1;
break;
case LineType.Dotted:
buffer = new Color[LineWidth * LineWidth * 4];
for (int y = 0; y < LineWidth * 2; y++)
{
for (int x = 0; x < LineWidth * 2; x++)
{
int index = (y * LineWidth * 2) + x;
buffer[index] = (x < LineWidth && y < LineWidth ? Color.White : Color.Transparent);
}
}
tex = new Texture2D(Skin.Pix.GraphicsDevice, LineWidth * 2, LineWidth * 2);
tex.SetData(buffer);
MinWidth = MinHeight = (LineWidth * 2) + 1;
break;
}
}