public void SetColorRange(
Color color,
double? brightness = 1.0,
int startX = 0,
int startY = 0,
int? width = null,
int? height = null,
IControlToken token = null)
{
IData data = GetFrameBuffer(token, this);
Color injectColor;
if (brightness.GetValueOrDefault(1.0) < 1.0)
injectColor = GetColorFromColorAndBrightness(color, brightness.Value);
else
injectColor = color;
if (!width.HasValue)
width = this.pixelWidth;
if (!height.HasValue)
height = this.pixelHeight;
var bitmap = (Bitmap)data[DataElements.PixelBitmap];
lock (this.lockObject)
{
using (var g = Graphics.FromImage(bitmap))
using (var b = new SolidBrush(injectColor))
{
g.FillRectangle(b, startX, startY, width.Value, height.Value);
}
}
PushOutput(token);
}