//if color changes, or new ring radius is selected public void ModifyVulnerabilityRing(float vulnerabilityRadius, Color vulnerabilityColor, float h_metersPerPixel, float v_metersPerPixel, Canvas canvas) { bool hasChanged = false; if (_vulnerabilityRadius != vulnerabilityRadius) { _vulnerabilityRadius = vulnerabilityRadius; hasChanged = true; } if (_vulnerabilityColor.Name != vulnerabilityColor.Name) { _vulnerabilityColor = vulnerabilityColor; hasChanged = true; } if (hasChanged) { float height, width; int t_height, t_width; TransformMetersToPixels(vulnerabilityRadius, h_metersPerPixel, v_metersPerPixel, out width, out height); _vulnerabilityWidthPixels = width; _vulnerabilityHeightPixels = height; _vulnerabilityRing = new Obj_Sprite(SpriteFlags.AlphaBlend); //allows transparency _vulnerabilityRadius = vulnerabilityRadius; _vulnerabilityBitmap = new Bitmap(Convert.ToInt32(DefaultDisplayRadius), Convert.ToInt32(DefaultDisplayRadius)); _vulnerabilityColor = vulnerabilityColor; _vulnerabilityBrush = new SolidBrush(_vulnerabilityColor); _vulnerabilityGraphic = Graphics.FromImage(_vulnerabilityBitmap); _vulnerabilityRing.Initialize(canvas); _vulnerabilityGraphic.FillEllipse(_vulnerabilityBrush, 0, 0, DefaultDisplayRadius, DefaultDisplayRadius); //just fill ellipse once, or else you get a solid color. _vulnerabilityTexture = canvas.CreateTexture(_vulnerabilityBitmap, out t_width, out t_height); _vulnerabilityRing.Texture(_vulnerabilityTexture, t_width, t_height); } }
public void SetVulnerabilityRingValues(float vulnerabilityRadius, Color ringColor, Canvas canvas, float h_metersPerPixel, float v_metersPerPixel) { float height, width; int t_height, t_width; try { TransformMetersToPixels(vulnerabilityRadius, h_metersPerPixel, v_metersPerPixel, out width, out height); _vulnerabilityWidthPixels = width; _vulnerabilityHeightPixels = height; _vulnerabilityRing = new Obj_Sprite(SpriteFlags.AlphaBlend); //allows transparency _vulnerabilityRadius = vulnerabilityRadius; _vulnerabilityBitmap = new Bitmap(Convert.ToInt32(DefaultDisplayRadius), Convert.ToInt32(DefaultDisplayRadius)); _vulnerabilityColor = ringColor; //Color.FromArgb(33, 0, 255, 0); _vulnerabilityBrush = new SolidBrush(_vulnerabilityColor); _vulnerabilityGraphic = Graphics.FromImage(_vulnerabilityBitmap); _vulnerabilityRing.Initialize(canvas); _vulnerabilityGraphic.FillEllipse(_vulnerabilityBrush, 0, 0, DefaultDisplayRadius, DefaultDisplayRadius); //just fill ellipse once, or else you get a solid color. _vulnerabilityTexture = canvas.CreateTexture(_vulnerabilityBitmap, out t_width, out t_height); _vulnerabilityRing.Texture(_vulnerabilityTexture, t_width, t_height); } catch (Exception e) { Console.WriteLine("Error Setting Vulnerability Ring Value: {0};\r\n{1}", e.Message, e.StackTrace); } }
public GameTexture CreateTexture(System.IO.Stream stream) { GameTexture texture = GameTexture.Empty; try { texture.texture = _CANVAS_.CreateTexture(stream, out texture.width, out texture.height); return(texture); } catch (ArgumentException e) { throw new Exception(e.Message); } }
//if color changes, or new ring radius is selected public void ModifyVulnerabilityRing(float vulnerabilityRadius, Color vulnerabilityColor, float h_metersPerPixel, float v_metersPerPixel, Canvas canvas) { bool hasChanged = false; if (_vulnerabilityRadius != vulnerabilityRadius) { _vulnerabilityRadius = vulnerabilityRadius; hasChanged = true; } if (_vulnerabilityColor.Name != vulnerabilityColor.Name) { _vulnerabilityColor = vulnerabilityColor; hasChanged = true; } if (hasChanged) { float height, width; int t_height, t_width; TransformMetersToPixels(vulnerabilityRadius, h_metersPerPixel, v_metersPerPixel, out width, out height); _vulnerabilityWidthPixels = width; _vulnerabilityHeightPixels = height; _vulnerabilityRing = new Obj_Sprite(SpriteFlags.AlphaBlend); //allows transparency _vulnerabilityRadius = vulnerabilityRadius; _vulnerabilityBitmap = new Bitmap(Convert.ToInt32(DefaultDisplayRadius), Convert.ToInt32(DefaultDisplayRadius)); _vulnerabilityColor = vulnerabilityColor; _vulnerabilityBrush = new SolidBrush(_vulnerabilityColor); _vulnerabilityGraphic = Graphics.FromImage(_vulnerabilityBitmap); _vulnerabilityRing.Initialize(canvas); _vulnerabilityGraphic.FillEllipse(_vulnerabilityBrush, 0, 0, DefaultDisplayRadius, DefaultDisplayRadius); //just fill ellipse once, or else you get a solid color. _vulnerabilityTexture = canvas.CreateTexture(_vulnerabilityBitmap, out t_width, out t_height); _vulnerabilityRing.Texture(_vulnerabilityTexture, t_width, t_height); } }
public void SetVulnerabilityRingValues(float vulnerabilityRadius, Color ringColor, Canvas canvas, float h_metersPerPixel, float v_metersPerPixel) { float height, width; int t_height, t_width; try { TransformMetersToPixels(vulnerabilityRadius, h_metersPerPixel, v_metersPerPixel, out width, out height); _vulnerabilityWidthPixels = width; _vulnerabilityHeightPixels = height; _vulnerabilityRing = new Obj_Sprite(SpriteFlags.AlphaBlend); //allows transparency _vulnerabilityRadius = vulnerabilityRadius; _vulnerabilityBitmap = new Bitmap(Convert.ToInt32(DefaultDisplayRadius), Convert.ToInt32(DefaultDisplayRadius)); _vulnerabilityColor = ringColor; //Color.FromArgb(33, 0, 255, 0); _vulnerabilityBrush = new SolidBrush(_vulnerabilityColor); _vulnerabilityGraphic = Graphics.FromImage(_vulnerabilityBitmap); _vulnerabilityRing.Initialize(canvas); _vulnerabilityGraphic.FillEllipse(_vulnerabilityBrush, 0, 0, DefaultDisplayRadius, DefaultDisplayRadius); //just fill ellipse once, or else you get a solid color. _vulnerabilityTexture = canvas.CreateTexture(_vulnerabilityBitmap, out t_width, out t_height); _vulnerabilityRing.Texture(_vulnerabilityTexture, t_width, t_height); } catch (Exception e) { Console.WriteLine("Error Setting Vulnerability Ring Value: {0};\r\n{1}", e.Message, e.StackTrace); } }