public static Color ToColor(this char character) { Color color = new Color(); switch (character) { case 'y': color = Color.Yellow; break; case 'r': color = Color.Red; break; case 'g': color = Color.Green; break; case 'o': color = Color.Orange; break; case 'b': color = Color.Blue; break; case 'w': color = Color.White; break; } return color; }
void Start() { currentlySelected = false; ctrl = Camera.main.GetComponent<cameraController>(); startcolor = GetComponent<Renderer>().material.color; factories = GetComponentsInChildren<UIReq>(); }
public Emitter(Vector2 position, Texture2D sprite, Color color, int size) { this.position = position; this.sprite = sprite; this.color = color; this.size = size; }
public void Initialise() { _primitives = new List<Cube>(); var random = new Random(); for (int i = 0; i < Constants.CubeCount; i++) { _primitives.Add(new Cube { Color = Color.Red, Position = new Vector3(random.Next(100) - 50, random.Next(100) - 50, -random.Next(100)), Radius = random.Next(100), Rotation = Vector3.Zero }); } //How to create a kernel and a channel? // _kernel = // _channel = _colour = Color.Beige; _kernel.Factory.NewCoroutine(ChangePosition); _kernel.Factory.NewCoroutine(ChangeColour); }
public Texte(string message, Point position, Color couleur) { this.message = message; this.position = position; this.couleur = couleur; this.police = Fonte.Arial15; }
public CustomLine(int startLineNr, int endLineNr, Color customColor, bool readOnly) { this.StartLineNr = startLineNr; this.EndLineNr = endLineNr; this.Color = customColor; this.ReadOnly = readOnly; }
public void ChangeColor(Color newColor) { nextColor = newColor; currentColor = transitionColor; changingColor = true; colorChangeStartTime = Time.time; }
/// <remarks> /// Returns the Color if the line <code>lineNr</code> has custom bg color /// otherwise returns <code>defaultColor</code> /// </remarks> public Color GetCustomColor(int lineNr, Color defaultColor) { foreach(CustomLine line in lines) if (line.StartLineNr <= lineNr && line.EndLineNr >= lineNr) return line.Color; return defaultColor; }
public static void RenderPolygone(SpriteBatch spriteBatch, Texture2D texture, Polygon polygon, int lineThickness, Color color) { for (int i = 0; i < polygon.Points.Count; ++i) { RenderLine(spriteBatch, texture, polygon.Points[i], polygon.Edges[i], 1, lineThickness, color); } }
/// <summary> /// Draw a rectangle. /// </summary> /// <param name="rectangle">The rectangle to draw.</param> /// <param name="color">The draw color.</param> public void DrawRectangle(Rectangle rectangle, Color color) { this.Draw(this.WhiteTexture, new Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, 1), color); this.Draw(this.WhiteTexture, new Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 1), color); this.Draw(this.WhiteTexture, new Rectangle(rectangle.Left, rectangle.Top, 1, rectangle.Height), color); this.Draw(this.WhiteTexture, new Rectangle(rectangle.Right, rectangle.Top, 1, rectangle.Height + 1), color); }
internal void DrawSpriteGlyph(Texture2D texture, Vector4 dest, Vector4 source, Color color) { if (!m_DrawString_InProgress) Logging.Fatal("BeginDrawString() must be called before DrawSpriteGlyph()"); Vector4 uv = new Vector4( (float)source.X / texture.Width, (float)source.Y / texture.Height, (float)(source.X + source.Z) / texture.Width, (float)(source.Y + source.W) / texture.Height); VertexPositionTextureHueExtra[] v = new VertexPositionTextureHueExtra[4] { new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y, m_DrawString_Depth), new Vector2(uv.X, uv.Y), color, Vector4.Zero), // top left new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y, m_DrawString_Depth), new Vector2(uv.Z, uv.Y), color, Vector4.Zero), // top right new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.X, uv.W), color, Vector4.Zero), // bottom left new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.Z, uv.W), color, Vector4.Zero) // bottom right }; /*if (shadow != null) { Color shadow2 = new Color( shadow.Value.R, shadow.Value.G, shadow.Value.B, 128); for (int i = 0; i < 4; i++) { VertexPositionTextureHueExtra v0 = v[i]; v0.Hue = shadow.Value; v0.Position.Y += 1f; m_DrawString_VertexList.Add(v0); } }*/ for (int i = 0; i < 4; i++) m_DrawString_VertexList.Add(v[i]); }
public Inventory(int SCREEN_WIDTH, int SCREEN_HEIGHT, Pantheon gameReference) { locationBoxes = new List<Rectangle>(); equippedBoxes = new List<Rectangle>(); types = new List<int>(); infoBox = new Rectangle(); movingBox = new Rectangle(); trashBox = new Rectangle(); tempStorage = new Item(); this.SCREEN_WIDTH = SCREEN_WIDTH; this.SCREEN_HEIGHT = SCREEN_HEIGHT; SetBoxes(); selected = -1; hoveredOver = -1; color = new Color(34, 167, 222, 50); trashColor = Color.White; inventorySelector = gameReference.Content.Load<Texture2D>("Inventory/InvSelect"); trashCan = gameReference.Content.Load<Texture2D>("Inventory/TrashCan"); nullImage = new Texture2D(gameReference.GraphicsDevice, 1,1); nullImage.SetData(new[] { new Color(0,0,0,0) }); }
/// <summary> /// Generates a Windows 8 like skin based on a start color. /// </summary> /// <param name="baseColor">The base color</param> /// <param name="fontName">Font name</param> /// <param name="animated">set to true to generate "Hover" and "Clicked" skins</param> /// <returns>The skin</returns> public static YnSkin Generate(Color baseColor, string fontName, bool animated) { Color tempColor; YnSkin skin = new YnSkin(); // Default state skin.FontNameDefault = fontName; skin.FontDefault = YnG.Game.Content.Load<SpriteFont>(fontName); skin.TextColorDefault = Color.White; skin.BackgroundDefault = YnGraphics.CreateTexture(baseColor, 1, 1); skin.BorderDefault = null; // Borders are left blank // If the skin is "animated", generate data for "Hover" and "Clicked" states if (animated) { // Hover state : change only background color tempColor = Add(baseColor, 50, 50, 50); skin.BackgroundHover = YnGraphics.CreateTexture(tempColor, 1, 1); // Clicked state : invert background & text color skin.TextColorClicked = baseColor; skin.BackgroundClicked = YnGraphics.CreateTexture(Color.White, 1, 1); } return skin; }
public string GetHexCode(Color c) { return string.Format("#{0}{1}{2}", c.R.ToString("X2"), c.G.ToString("X2"), c.B.ToString("X2")); }
public override void OnInspectorGUI() { serObj.Update(); EditorGUILayout.LabelField("Overlays animated noise patterns", EditorStyles.miniLabel); EditorGUILayout.PropertyField(dx11Grain, new GUIContent("DirectX 11 Grain")); if (dx11Grain.boolValue && !(target as NoiseAndGrain).Dx11Support()) { EditorGUILayout.HelpBox("DX11 mode not supported (need DX11 GPU and enable DX11 in PlayerSettings)", MessageType.Info); } EditorGUILayout.PropertyField(monochrome, new GUIContent("Monochrome")); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(intensityMultiplier, new GUIContent("Intensity Multiplier")); EditorGUILayout.PropertyField(generalIntensity, new GUIContent(" General")); EditorGUILayout.PropertyField(blackIntensity, new GUIContent(" Black Boost")); EditorGUILayout.PropertyField(whiteIntensity, new GUIContent(" White Boost")); midGrey.floatValue = EditorGUILayout.Slider( new GUIContent(" Mid Grey (for Boost)"), midGrey.floatValue, 0.0f, 1.0f); if (monochrome.boolValue == false) { Color c = new Color(intensities.vector3Value.x,intensities.vector3Value.y,intensities.vector3Value.z,1.0f); c = EditorGUILayout.ColorField(new GUIContent(" Color Weights"), c); intensities.vector3Value = new Vector3(c.r, c.g, c.b); } if (!dx11Grain.boolValue) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Noise Shape"); EditorGUILayout.PropertyField(noiseTexture, new GUIContent(" Texture")); EditorGUILayout.PropertyField(filterMode, new GUIContent(" Filter")); } else { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Noise Shape"); } softness.floatValue = EditorGUILayout.Slider( new GUIContent(" Softness"),softness.floatValue, 0.0f, 0.99f); if (!dx11Grain.boolValue) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Advanced"); if (monochrome.boolValue == false) { Vector3 temp = tiling.vector3Value; temp.x = EditorGUILayout.FloatField(new GUIContent(" Tiling (Red)"), tiling.vector3Value.x); temp.y = EditorGUILayout.FloatField(new GUIContent(" Tiling (Green)"), tiling.vector3Value.y); temp.z = EditorGUILayout.FloatField(new GUIContent(" Tiling (Blue)"), tiling.vector3Value.z); tiling.vector3Value = temp; } else { EditorGUILayout.PropertyField(monochromeTiling, new GUIContent(" Tiling")); } } serObj.ApplyModifiedProperties(); }
ContentPage CreatePage (Color backgroundColor) { _index++; var button = new Button () { Text = "next Page", }; button.Clicked += (sender, e) => { var page = CreatePage (Color.Green); _navigationPage.PushAsync (page); }; var contentPage = new ContentPage () { Content = new StackLayout () { BackgroundColor = backgroundColor, VerticalOptions = LayoutOptions.Fill, Children = { new Label () { Text = "page " + _index, }, } } }; return contentPage; }
// From http://edu.cnzz.cn/show_3281.html public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent) { GraphicsPath graphicsPath = new GraphicsPath(); if (colorTransparent == Color.Empty) colorTransparent = bitmap.GetPixel(0, 0); for(int row = 0; row < bitmap.Height; row ++) { int colOpaquePixel = 0; for(int col = 0; col < bitmap.Width; col ++) { if(bitmap.GetPixel(col, row) != colorTransparent) { colOpaquePixel = col; int colNext = col; for(colNext = colOpaquePixel; colNext < bitmap.Width; colNext ++) if(bitmap.GetPixel(colNext, row) == colorTransparent) break; graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1)); col = colNext; } } } return graphicsPath; }
public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh) { try { Uri inpuri = new Uri(@pictureName, UriKind.Relative); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = inpuri; bi.EndInit(); ImageBrush imagebrush = new ImageBrush(bi); imagebrush.Opacity = 100; imagebrush.Freeze(); Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) }; Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) }; SolidColorBrush modelbrush = new SolidColorBrush(modelColor); Model3DGroup cube = new Model3DGroup(); Point3D uppercircle = startPos; modelbrush.Freeze(); uppercircle.Y = startPos.Y + maxHigh; cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0))); cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0))); cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0)); return cube; } catch (Exception ex) { throw ex; } }
protected override Node Evaluate(Env env) { Guard.ExpectMinArguments(2, Arguments.Count, this, Index); Guard.ExpectMaxArguments(3, Arguments.Count, this, Index); Guard.ExpectAllNodes<Color>(Arguments.Take(2), this, Index); double weight = 50; if (Arguments.Count == 3) { Guard.ExpectNode<Number>(Arguments[2], this, Index); weight = ((Number) Arguments[2]).Value; } var colors = Arguments.Take(2).Cast<Color>().ToArray(); // Note: this algorithm taken from http://github.com/nex3/haml/blob/0e249c844f66bd0872ed68d99de22b774794e967/lib/sass/script/functions.rb var p = weight/100.0; var w = p*2 - 1; var a = colors[0].Alpha - colors[1].Alpha; var w1 = (((w*a == -1) ? w : (w + a)/(1 + w*a)) + 1)/2.0; var w2 = 1 - w1; var rgb = colors[0].RGB.Select((x, i) => x*w1 + colors[1].RGB[i]*w2).ToArray(); var alpha = colors[0].Alpha*p + colors[1].Alpha*(1 - p); var color = new Color(rgb[0], rgb[1], rgb[2], alpha); return color; }
public void SetPixel(int x, int y, Color colour) { PixelData* p = PixelAt(x, y); p->Red = colour.R; p->Green = colour.G; p->Blue = colour.B; }
/** * Pull all of our pixels off the texture (Unity stuff isn't thread safe, and this is faster) */ public BitmapData(Color[] _pixels, int _width, int _height) { height = _height; width = _width; pixels = _pixels; }
public void Generate2DTexture() { texture2D = new Texture2D(n,n,TextureFormat.ARGB32,true); int size = n*n; Color[] cols = new Color[size]; float u,v; int idx = 0; Color c = Color.white; for(int i = 0; i < n; i++) { u = i/(float)n; for(int j = 0; j < n; j++, ++idx) { v = j/(float)n; float noise = Mathf.PerlinNoise(u,v); c.r = c.g = c.b = noise; cols[idx] = c; } } texture2D.SetPixels(cols); texture2D.Apply(); renderer.material.SetTexture("g_tex", texture2D); //Color[] cs = texture3D.GetPixels(); //for(int i = 0; i < 10; i++) // Debug.Log (cs[i]); }
void Start() { Color randColor = new Color(Random.value, Random.value, Random.value); MeshRenderer[] renderers = GetComponentsInChildren<MeshRenderer>(); foreach(MeshRenderer r in renderers) r.material.color = randColor; }
public LandClass(string name, double fractalStart, double fractalEnd, Color baseColor) { this.name = name; this.altStart = fractalStart; this.altEnd = fractalEnd; this.color = baseColor; }
/// <summary> /// Draws a line from point1 to point2 with an offset /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="point1">The first point</param> /// <param name="point2">The second point</param> /// <param name="color">The color to use</param> public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point1, Vector2 point2, Color color) { DrawLine (spriteBatch, point1, point2, color, 1.0f); }
/// <summary> /// Draws a rectangle with the thickness provided /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="rect">The rectangle to draw</param> /// <param name="color">The color to draw the rectangle in</param> /// <param name="thickness">The thickness of the lines</param> public static void DrawRectangle(this SpriteBatch spriteBatch, Microsoft.Xna.Framework.Rectangle rect, Color color, float thickness) { DrawLine (spriteBatch, new Vector2 (rect.X, rect.Y), new Vector2 (rect.Right, rect.Y), color, thickness); // top DrawLine (spriteBatch, new Vector2 (rect.X + 1f, rect.Y), new Vector2 (rect.X + 1f, rect.Bottom + thickness), color, thickness); // left DrawLine (spriteBatch, new Vector2 (rect.X, rect.Bottom), new Vector2 (rect.Right, rect.Bottom), color, thickness); // bottom DrawLine (spriteBatch, new Vector2 (rect.Right + 1f, rect.Y), new Vector2 (rect.Right + 1f, rect.Bottom + thickness), color, thickness); // right }
/// <summary> /// Draw a circle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="x">The center X of the circle</param> /// <param name="y">The center Y of the circle</param> /// <param name="radius">The radius of the circle</param> /// <param name="sides">The number of sides to generate</param> /// <param name="color">The color of the circle</param> public static void DrawCircle(this SpriteBatch spriteBatch, float x, float y, float radius, int sides, Color color) { DrawPoints (spriteBatch, new Vector2 (x, y), CreateCircle (radius, sides), color, 1.0f); }
private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; Color foreColor = (Color)style[Style.ForeColorKey, true]; writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>"); writer.BeginStyleContext(); writer.EnterStyle(labelStyle); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle); writer.EndStyleContext(); writer.Write("</td></tr>\r\n<tr>"); RenderRule(writer, foreColor, 2); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; foreach (ObjectListField field in fields) { if (field.Visible) { writer.Write("<tr><td>"); writer.BeginStyleContext(); writer.EnterStyle(Style); writer.WriteText(field.Title, true); writer.ExitStyle(Style); writer.EndStyleContext(); writer.Write("</td><td>"); writer.BeginStyleContext(); writer.EnterStyle(style); writer.WriteText(item[fieldIndex], true); writer.ExitStyle(style); writer.EndStyleContext(); writer.Write("</td></tr>\r\n"); } fieldIndex++; } RenderRule(writer, foreColor, 2); writer.Write("<tr><td colspan=2>"); writer.BeginStyleContext(); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write("[ "); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterStyle(subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle); writer.Write(" | "); } String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write(" ]"); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EndStyleContext(); writer.Write("</td></tr></table>"); }
private void RenderItemsListWithTableTags(HtmlMobileTextWriter writer) { int pageStart = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; // Determine how to render. bool shouldRenderAsTable = ShouldRenderAsTable(); bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresDetailsScreen = HasItemDetails() || (!onlyHasDefaultCommand && HasCommands()); bool itemRequiresHyperlink = requiresDetailsScreen || hasDefaultCommand; bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand; int fieldCount; int[] fieldIndices = new int[]{}; if (shouldRenderAsTable) { fieldIndices = Control.TableFieldIndices; } Debug.Assert(fieldIndices != null, "fieldIndices is null"); fieldCount = fieldIndices.Length; if(fieldCount == 0) { fieldIndices = new int[1]; fieldIndices[0] = Control.LabelFieldIndex; fieldCount = 1; } Style style = this.Style; Style subCommandStyle = Control.CommandStyle; Style labelStyle = Control.LabelStyle; Color foreColor = (Color)style[Style.ForeColorKey, true]; writer.BeginStyleContext(); writer.WriteLine("<table border=0 width=\"100%\">\r\n<tr>"); for (int field = 0; field < fieldCount; field++) { writer.Write("<td>"); writer.BeginStyleContext(); writer.EnterStyle(labelStyle); writer.WriteText(Control.AllFields[fieldIndices[field]].Title, true); writer.ExitStyle(labelStyle); writer.EndStyleContext(); writer.Write("</td>"); } if (itemRequiresMoreButton) { writer.WriteLine("<td/>"); } writer.WriteLine("\r\n</tr>"); RenderRule(writer, foreColor, fieldCount + 1); for (int i = 0; i < pageSize; i++) { ObjectListItem item = items[pageStart + i]; writer.WriteLine("<tr>"); for (int field = 0; field < fieldCount; field++) { writer.Write("<td>"); if (field == 0 && itemRequiresHyperlink) { writer.BeginStyleContext(); writer.EnterStyle(style); String eventArgument = hasDefaultCommand ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index.ToString(CultureInfo.InvariantCulture)); RenderPostBackEventAsAnchor(writer, eventArgument, item[fieldIndices[0]]); writer.ExitStyle(style); writer.EndStyleContext(); } else { writer.BeginStyleContext(); writer.EnterStyle(style); writer.WriteText(item[fieldIndices[field]], true); writer.ExitStyle(style); writer.EndStyleContext(); } writer.WriteLine("</td>"); } if (itemRequiresMoreButton) { writer.Write("<td align=right>"); writer.BeginStyleContext(); writer.EnterFormat(subCommandStyle); String moreText = Control.MoreText.Length == 0 ? GetDefaultLabel(MoreLabel) : Control.MoreText; RenderPostBackEventAsAnchor(writer, String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), moreText, subCommandStyle); writer.ExitFormat(subCommandStyle); writer.EndStyleContext(); writer.Write("</td>\r\n"); } writer.WriteLine("</tr>"); } RenderRule(writer, foreColor, fieldCount + 1); writer.Write("</table>\r\n"); writer.EndStyleContext(); }
public XPListViewItem(string[] items, int imageIndex, Color foreColor, Color backColor, Font font, int groupIndex) : base(items, imageIndex, foreColor, backColor, font) { this.GroupIndex = groupIndex; }
public XPListViewItem(string[] items, int imageIndex, Color foreColor, Color backColor, Font font) : base(items, imageIndex, foreColor, backColor, font) {}
public Cluster(Dot mean, Color color) { Mean = mean; Color = color; Dots = new(); }
/// <summary> /// Draw a arc /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="center">The center of the arc</param> /// <param name="radius">The radius of the arc</param> /// <param name="sides">The number of sides to generate</param> /// <param name="startingAngle">The starting angle of arc, 0 being to the east, increasing as you go clockwise</param> /// <param name="radians">The number of radians to draw, clockwise from the starting angle</param> /// <param name="color">The color of the arc</param> /// <param name="thickness">The thickness of the arc</param> public static void DrawArc(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, float startingAngle, float radians, Color color, float thickness) { List<Vector2> arc = CreateArc (radius, sides, startingAngle, radians); //List<Vector2> arc = CreateArc2(radius, sides, startingAngle, degrees); DrawPoints (spriteBatch, center, arc, color, thickness); }
/// <summary> /// Draw a circle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="center">The center of the circle</param> /// <param name="radius">The radius of the circle</param> /// <param name="sides">The number of sides to generate</param> /// <param name="color">The color of the circle</param> /// <param name="thickness">The thickness of the lines used</param> public static void DrawCircle(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, Color color, float thickness) { DrawPoints (spriteBatch, center, CreateCircle (radius, sides), color, thickness); }
public static void PutPixel(this SpriteBatch spriteBatch, float x, float y, Color color) { PutPixel (spriteBatch, new Vector2 (x, y), color); }
/// <summary> /// Draws a list of connecting points /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// /// <param name="position">Where to position the points</param> /// <param name="points">The points to connect with lines</param> /// <param name="color">The color to use</param> /// <param name="thickness">The thickness of the lines</param> private static void DrawPoints(SpriteBatch spriteBatch, Vector2 position, List<Vector2> points, Color color, float thickness) { if (points.Count < 2) return; for (int i = 1; i < points.Count; i++) { DrawLine (spriteBatch, points[i - 1] + position, points[i] + position, color, thickness); } }
/// <summary> /// Draws a filled rectangle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="location">Where to draw</param> /// <param name="size">The size of the rectangle</param> /// <param name="angle">The angle in radians to draw the rectangle at</param> /// <param name="color">The color to draw the rectangle in</param> public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float angle) { if (pixel == null) { CreateThePixel (spriteBatch); } // stretch the pixel between the two vectors spriteBatch.Draw (pixel, location, null, color, angle, Vector2.Zero, size, SpriteEffects.None, 0); }
/// <summary> /// Draws a filled rectangle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="x">The X coord of the left side</param> /// <param name="y">The Y coord of the upper side</param> /// <param name="w">Width</param> /// <param name="h">Height</param> /// <param name="color">The color to draw the rectangle in</param> /// <param name="angle">The angle of the rectangle in radians</param> public static void FillRectangle(this SpriteBatch spriteBatch, float x, float y, float w, float h, Color color, float angle) { FillRectangle (spriteBatch, new Vector2 (x, y), new Vector2 (w, h), color, angle); }
/// <summary> /// Draws a filled rectangle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="location">Where to draw</param> /// <param name="size">The size of the rectangle</param> /// <param name="color">The color to draw the rectangle in</param> public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color) { FillRectangle (spriteBatch, location, size, color, 0.0f); }
/// <summary> /// Draw a arc /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="center">The center of the arc</param> /// <param name="radius">The radius of the arc</param> /// <param name="sides">The number of sides to generate</param> /// <param name="startingAngle">The starting angle of arc, 0 being to the east, increasing as you go clockwise</param> /// <param name="radians">The number of radians to draw, clockwise from the starting angle</param> /// <param name="color">The color of the arc</param> public static void DrawArc(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, float startingAngle, float radians, Color color) { DrawArc (spriteBatch, center, radius, sides, startingAngle, radians, color, 1.0f); }
/// <summary> /// Draws a filled rectangle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="rect">The rectangle to draw</param> /// <param name="color">The color to draw the rectangle in</param> public static void FillRectangle(this SpriteBatch spriteBatch, Microsoft.Xna.Framework.Rectangle rect, Color color) { if (pixel == null) { CreateThePixel (spriteBatch); } // Simply use the function already there spriteBatch.Draw (pixel, rect, color); }
/// <summary> /// Draws a filled rectangle /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="rect">The rectangle to draw</param> /// <param name="color">The color to draw the rectangle in</param> /// <param name="angle">The angle in radians to draw the rectangle at</param> public static void FillRectangle(this SpriteBatch spriteBatch, Microsoft.Xna.Framework.Rectangle rect, Color color, float angle) { if (pixel == null) { CreateThePixel (spriteBatch); } spriteBatch.Draw (pixel, rect, null, color, angle, Vector2.Zero, SpriteEffects.None, 0); }
/// <summary> /// Perform color dithering for the specified image. /// </summary> /// /// <param name="sourceImage">Source image to do color dithering for.</param> /// /// <returns>Returns color dithered image. See <see cref="ColorTable"/> for information about format of /// the result image.</returns> /// /// <exception cref="UnsupportedImageFormatException">Unsupported pixel format of the source image. It must 24 or 32 bpp color image.</exception> /// public Bitmap Apply(UnmanagedImage sourceImage) { if ((sourceImage.PixelFormat != PixelFormat.Format24bppRgb) && (sourceImage.PixelFormat != PixelFormat.Format32bppRgb) && (sourceImage.PixelFormat != PixelFormat.Format32bppArgb) && (sourceImage.PixelFormat != PixelFormat.Format32bppPArgb)) { throw new UnsupportedImageFormatException("Unsupported pixel format of the source image."); } cache.Clear(); // make a copy of the original image UnmanagedImage source = sourceImage.Clone(); // get image size width = sourceImage.Width; height = sourceImage.Height; stride = sourceImage.Stride; pixelSize = Bitmap.GetPixelFormatSize(sourceImage.PixelFormat) / 8; int offset = stride - width * pixelSize; // create destination image Bitmap destImage = new Bitmap(width, height, (colorTable.Length > 16) ? PixelFormat.Format8bppIndexed : PixelFormat.Format4bppIndexed); // and init its palette ColorPalette cp = destImage.Palette; for (int i = 0, n = colorTable.Length; i < n; i++) { cp.Entries[i] = colorTable[i]; } destImage.Palette = cp; // lock destination image BitmapData destData = destImage.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, destImage.PixelFormat); // pixel values int r, g, b; // do the job unsafe { byte *ptr = (byte *)source.ImageData.ToPointer(); byte *dstBase = (byte *)destData.Scan0.ToPointer(); byte colorIndex; bool is8bpp = (colorTable.Length > 16); // for each line for (y = 0; y < height; y++) { byte *dst = dstBase + y * destData.Stride; // for each pixels for (x = 0; x < width; x++, ptr += pixelSize) { r = ptr[RGB.R]; g = ptr[RGB.G]; b = ptr[RGB.B]; // get color from palette, which is the closest to current pixel's value Color closestColor = GetClosestColor(r, g, b, out colorIndex); // do error diffusion Diffuse(r - closestColor.R, g - closestColor.G, b - closestColor.B, ptr); // write color index as pixel's value to destination image if (is8bpp) { *dst = colorIndex; dst++; } else { if (x % 2 == 0) { *dst |= (byte)(colorIndex << 4); } else { *dst |= (colorIndex); dst++; } } } ptr += offset; } } destImage.UnlockBits(destData); source.Dispose(); return(destImage); }
/// <summary> /// Draws a rectangle with the thickness provided /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="location">Where to draw</param> /// <param name="size">The size of the rectangle</param> /// <param name="color">The color to draw the rectangle in</param> /// <param name="thickness">The thickness of the line</param> public static void DrawRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float thickness) { DrawRectangle (spriteBatch, new Microsoft.Xna.Framework.Rectangle ((int) location.X, (int) location.Y, (int) size.X, (int) size.Y), color, thickness); }
/// <summary> /// Draws a line from point1 to point2 with an offset /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="point1">The first point</param> /// <param name="point2">The second point</param> /// <param name="color">The color to use</param> /// <param name="thickness">The thickness of the line</param> public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point1, Vector2 point2, Color color, float thickness) { // calculate the distance between the two vectors float distance = Vector2.Distance (point1, point2); // calculate the angle between the two vectors float angle = (float) Math.Atan2 (point2.Y - point1.Y, point2.X - point1.X); DrawLine (spriteBatch, point1, distance, angle, color, thickness); }
/// <summary> /// Draws a line from point1 to point2 with an offset /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="point">The starting point</param> /// <param name="length">The length of the line</param> /// <param name="angle">The angle of this line from the starting point</param> /// <param name="color">The color to use</param> /// <param name="thickness">The thickness of the line</param> public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point, float length, float angle, Color color, float thickness) { if (pixel == null) { CreateThePixel (spriteBatch); } // stretch the pixel between the two vectors spriteBatch.Draw (pixel, point, null, color, angle, Vector2.Zero, new Vector2 (length, thickness), SpriteEffects.None, 0); }
public static SharpDX.Color ToSharpDxColor(this Color color) { return new SharpDX.Color(color.R, color.G, color.B, color.A); }
/// <summary> /// Draws a rectangle with the thickness provided /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="rect">The rectangle to draw</param> /// <param name="color">The color to draw the rectangle in</param> public static void DrawRectangle(this SpriteBatch spriteBatch, Microsoft.Xna.Framework.Rectangle rect, Color color) { DrawRectangle (spriteBatch, rect, color, 1.0f); }
/// <summary> /// Setups the menu. /// </summary> private static void SetupMenu() { Menu = new Menu("Irelia Reloaded", "cmIreliaReloaded", true); // Target Selector var tsMenu = new Menu("Target Selector", "cmTS"); TargetSelector.AddToMenu(tsMenu); Menu.AddSubMenu(tsMenu); // Orbwalker var orbwalkMenu = new Menu("Orbwalking", "cmOrbwalk"); Orbwalker = new Orbwalking.Orbwalker(orbwalkMenu); Menu.AddSubMenu(orbwalkMenu); // Combo var comboMenu = new Menu("Combo Settings", "cmCombo"); comboMenu.AddItem(new MenuItem("Seperator5", ":: Q SETTINGS ::").SetFontStyle(FontStyle.Bold, Color.Aqua.ToSharpDxColor())); comboMenu.AddItem(new MenuItem("useQ", "Use Q").SetValue(true)); comboMenu.AddItem(new MenuItem("useQGapclose", "Gapclose with Q").SetValue(true)); comboMenu.AddItem(new MenuItem("minQRange", "Minimum Q Range")).SetValue(new Slider(250, 20, 400)); comboMenu.AddItem(new MenuItem("Seperator1", ":: W SETTINGS ::").SetFontStyle(FontStyle.Bold, Color.Yellow.ToSharpDxColor())); comboMenu.AddItem(new MenuItem("useW", "Use W").SetValue(true)); comboMenu.AddItem(new MenuItem("useWBeforeQ", "Use W before Q").SetValue(true)); comboMenu.AddItem(new MenuItem("Seperator2", ":: E SETTINGS ::").SetFontStyle(FontStyle.Bold, Color.IndianRed.ToSharpDxColor())); comboMenu.AddItem(new MenuItem("useE", "Use E").SetValue(true)); comboMenu.AddItem(new MenuItem("useEStun", "Only Use E to Stun").SetValue(false)); comboMenu.AddItem(new MenuItem("Seperator3", ":: R SETTINGS ::").SetFontStyle(FontStyle.Bold, Color.Aquamarine.ToSharpDxColor())); comboMenu.AddItem(new MenuItem("useR", "Use R").SetValue(true)); comboMenu.AddItem(new MenuItem("procSheen", "Proc Sheen Before Firing R").SetValue(true)); comboMenu.AddItem(new MenuItem("useRGapclose", "Use R to Weaken Minion to Gapclose").SetValue(true)); comboMenu.AddItem(new MenuItem("Seperator4", ":: OTHER SETTINGS ::").SetFontStyle(FontStyle.Bold, SharpDX.Color.Red)); comboMenu.AddItem(new MenuItem("useIgnite", "Use Ignite").SetValue(true)); Menu.AddSubMenu(comboMenu); // Harass var harassMenu = new Menu("Harass Settings", "cmHarass"); harassMenu.AddItem(new MenuItem("UseQHarass", "Use Q").SetValue(false)); harassMenu.AddItem(new MenuItem("UseWHarass", "Use W").SetValue(false)); harassMenu.AddItem(new MenuItem("UseEHarass", "Use E").SetValue(false)); harassMenu.AddItem(new MenuItem("HarassMana", "Harass Mana %").SetValue(new Slider(75, 0))); Menu.AddSubMenu(harassMenu); // KS var ksMenu = new Menu("KillSteal Settings", "cmKS"); ksMenu.AddItem(new MenuItem("useQKS", "KS With Q").SetValue(true)); ksMenu.AddItem(new MenuItem("useRKS", "KS With R").SetValue(false)); ksMenu.AddItem(new MenuItem("useIgniteKS", "KS with Ignite").SetValue(true)); Menu.AddSubMenu(ksMenu); // Farming var farmingMenu = new Menu("Farming Settings", "cmFarming"); var lastHitMenu = new Menu("Last Hit", "cmLastHit"); lastHitMenu.AddItem(new MenuItem("lastHitQ", "Last Hit with Q").SetValue(false)); lastHitMenu.AddItem(new MenuItem("manaNeededQ", "Last Hit Mana %")).SetValue(new Slider(35)); lastHitMenu.AddItem(new MenuItem("noQMinionTower", "Don't Q Minion Undertower").SetValue(true)); farmingMenu.AddSubMenu(lastHitMenu); farmingMenu.AddItem(new MenuItem("gatotsuTime", "Legit Q Delay (MS)")).SetValue(new Slider(250, 0, 1500)); // Wave Clear SubMenu var waveClearMenu = new Menu("Wave Clear", "cmWaveClear"); waveClearMenu.AddItem(new MenuItem("waveclearQ", "Use Q").SetValue(true)); waveClearMenu.AddItem(new MenuItem("waveclearQKillable", "Only Q Killable Minion").SetValue(true)); waveClearMenu.AddItem(new MenuItem("waveclearW", "Use W").SetValue(true)); waveClearMenu.AddItem(new MenuItem("waveclearR", "Use R").SetValue(false)); waveClearMenu.AddItem(new MenuItem("waveClearMana", "Wave Clear Mana %").SetValue(new Slider(20))); farmingMenu.AddSubMenu(waveClearMenu); var jungleClearMenu = new Menu("Jungle Clear", "cmJungleClear"); jungleClearMenu.AddItem(new MenuItem("UseQJungleClear", "Use Q").SetValue(true)); jungleClearMenu.AddItem(new MenuItem("UseWJungleClear", "Use W").SetValue(true)); jungleClearMenu.AddItem(new MenuItem("UseEJungleClear", "Use E").SetValue(true)); farmingMenu.AddSubMenu(jungleClearMenu); Menu.AddSubMenu(farmingMenu); // Drawing var drawMenu = new Menu("Drawing Settings", "cmDraw"); drawMenu.AddItem(new MenuItem("drawQ", "Draw Q").SetValue(true)); drawMenu.AddItem(new MenuItem("drawE", "Draw E").SetValue(true)); drawMenu.AddItem(new MenuItem("drawR", "Draw R").SetValue(true)); drawMenu.AddItem(new MenuItem("drawDmg", "Draw Combo Damage").SetValue(true)); drawMenu.AddItem(new MenuItem("drawStunnable", "Draw Stunnable").SetValue(true)); drawMenu.AddItem(new MenuItem("drawKillableQ", "Draw Minions Killable with Q").SetValue(false)); Menu.AddSubMenu(drawMenu); // Misc var miscMenu = new Menu("Miscellaneous Settimgs", "cmMisc"); miscMenu.AddItem(new MenuItem("interruptE", "E to Interrupt").SetValue(true)); miscMenu.AddItem(new MenuItem("interruptQE", "Use Q & E to Interrupt").SetValue(true)); miscMenu.AddItem(new MenuItem("gapcloserE", "Use E on Gapcloser").SetValue(true)); Menu.AddSubMenu(miscMenu); var color = Color.FromArgb(124, 252, 0); Menu.AddItem(new MenuItem("Seperator", "")); Menu.AddItem( new MenuItem("Version", "Irelia Reloaded " + Assembly.GetExecutingAssembly().GetName().Version) .SetFontStyle(FontStyle.Bold, new SharpDX.Color(color.R, color.G, color.B, color.A))); Menu.AddItem(new MenuItem("Author", "Made by ChewyMoon")); Menu.AddToMainMenu(); }
/// <summary> /// Draws a line from point1 to point2 with an offset /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="point">The starting point</param> /// <param name="length">The length of the line</param> /// <param name="angle">The angle of this line from the starting point in radians</param> /// <param name="color">The color to use</param> public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point, float length, float angle, Color color) { DrawLine (spriteBatch, point, length, angle, color, 1.0f); }
/// <summary> /// Draws a line from point1 to point2 with an offset /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="x1">The X coord of the first point</param> /// <param name="y1">The Y coord of the first point</param> /// <param name="x2">The X coord of the second point</param> /// <param name="y2">The Y coord of the second point</param> /// <param name="color">The color to use</param> /// <param name="thickness">The thickness of the line</param> public static void DrawLine(this SpriteBatch spriteBatch, float x1, float y1, float x2, float y2, Color color, float thickness) { DrawLine (spriteBatch, new Vector2 (x1, y1), new Vector2 (x2, y2), color, thickness); }
public CashTick(WPos pos, Color color, int value) { this.font = Game.Renderer.Fonts["TinyBold"]; this.pos = pos; this.color = color; this.text = "{0}${1}".F(value < 0 ? "-" : "+", Math.Abs(value)); }
internal void DrawSpriteGlyphDF(Texture2D texture, Vector4 dest, Vector4 source, Color color, float font_scale) { if (!m_DrawString_InProgress) Logging.Fatal("BeginDrawString() must be called before DrawSpriteGlyph()"); Vector4 uv = new Vector4( (float)source.X / texture.Width, (float)source.Y / texture.Height, (float)(source.X + source.Z) / texture.Width, (float)(source.Y + source.W) / texture.Height); float smoothing = 0.4f * Math.Pow(0.333f, font_scale * 2f) + 0.05f; Vector4 extra = new Vector4(0, 0, smoothing, 2); VertexPositionTextureHueExtra[] v = new VertexPositionTextureHueExtra[4] { new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y, m_DrawString_Depth), new Vector2(uv.X, uv.Y), color, extra), // top left new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y, m_DrawString_Depth), new Vector2(uv.Z, uv.Y), color, extra), // top right new VertexPositionTextureHueExtra(new Vector3(dest.X, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.X, uv.W), color, extra), // bottom left new VertexPositionTextureHueExtra(new Vector3(dest.X + dest.Z, dest.Y + dest.W, m_DrawString_Depth), new Vector2(uv.Z, uv.W), color, extra) // bottom right }; for (int i = 0; i < 4; i++) m_DrawString_VertexList.Add(v[i]); }
public Texte(string message, Point position) { this.message = message; this.position = position; this.couleur = Structure.Color.White; this.police = Fonte.Arial15; }
public AreaInfo(Rect theRect, int thePriority, string theName) { itsRect = theRect; itsPriority = thePriority; itsColor = new Color(Random.value,Random.value,Random.value); itsName = theName; }
public Texte(string message, Point position, Color couleur, Fonte police) { this.message = message; this.position = position; this.couleur = couleur; this.police = police; }
public void ShowIcon( string iName, string position, float scale ) { string itemName = iName.Replace(' ', '_'); image.sprite = ItemManager.Instance.GetItemTexture( itemName ); Color col = new Color(); col = Color.white; image.color = col; iconPos pos = new iconPos(); switch( position.ToLower() ) { case "middle": case "mid": case "m": pos = iconPos.middle; break; case "left": case "l": pos = iconPos.left; break; case "right": case "r": pos = iconPos.right; break; } image.GetComponent<Transform>().position = destinationTransforms[(int)pos].position; image.GetComponent<Transform>().localScale *= scale; }