Applied patch from mantis #3217, which allows Dynamic Images of type RGB (so with no alpha value). Thanks BlueWall.
parent
e77b5d990d
commit
52b2d8732a
|
@ -229,6 +229,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
alpha = temp;
|
||||
}
|
||||
}
|
||||
// Allow a bitmap w/o the alpha component to be created
|
||||
else if (value.ToLower() == "false") {
|
||||
alpha = 256;
|
||||
}
|
||||
break;
|
||||
case "bgcolour":
|
||||
int hex = 0;
|
||||
|
@ -272,24 +276,36 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
}
|
||||
}
|
||||
|
||||
Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
Bitmap bitmap;
|
||||
|
||||
if ( alpha == 256 )
|
||||
{
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
||||
}
|
||||
else {
|
||||
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
}
|
||||
|
||||
Graphics graph = Graphics.FromImage(bitmap);
|
||||
|
||||
// this is really just to save people filling the
|
||||
// background color in their scripts, only do when fully opaque
|
||||
if (alpha == 255)
|
||||
if (alpha >= 255)
|
||||
{
|
||||
graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height);
|
||||
}
|
||||
|
||||
for (int w = 0; w < bitmap.Width; w++)
|
||||
{
|
||||
if (alpha <= 255)
|
||||
{
|
||||
for (int h = 0; h < bitmap.Height; h++)
|
||||
{
|
||||
bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GDIDraw(data, graph);
|
||||
|
||||
|
|
Loading…
Reference in New Issue