public void Paint(Color color, int highlightIndex = 0, bool cursor = false) { float fsize = 1.4f; var w = LContent.GraphicsDevice.BackBuffer.Width; var u = w/60; LContent.DrawString("Hall of Fame", new Vector2(w*0.5f, u*2), fsize*2, 0.5f, color); for (var i = 0; i < 10; i++) { var entry = LContent.HallOfFame.Entries[i]; var y = u*(7 + i*2); var sz = fsize; if (i == 0) { y -= u/2; sz *= 1.2f; } var name = entry.Name; if (i==highlightIndex && cursor) name += "_"; LContent.DrawString("{0}.".Fmt(i + 1), new Vector2(u*5, y), sz, 1, color); LContent.DrawString("{0:0}".Fmt(entry.Score), new Vector2(u*14, y), sz, 1, color); LContent.DrawString(name, new Vector2(u*17, y), sz, 0, color); LContent.DrawString(entry.When.ToShortDateString(), new Vector2(u*57, y), sz, 1, color); } }
public static void DrawTextCentered(this Font font, string text, Vector2 position, Color color, bool outline = false) { var measure = GetMeasured(font, text); if (outline) { font.DrawText( null, text, (int) (position.X + 1 - measure.Width * 0.5f), (int) (position.Y + 1 - measure.Height * 0.5f), Color.Black); font.DrawText( null, text, (int) (position.X - 1 - measure.Width * 0.5f), (int) (position.Y - 1 - measure.Height * 0.5f), Color.Black); font.DrawText( null, text, (int) (position.X + 1 - measure.Width * 0.5f), (int) (position.Y - measure.Height * 0.5f), Color.Black); font.DrawText( null, text, (int) (position.X - 1 - measure.Width * 0.5f), (int) (position.Y - measure.Height * 0.5f), Color.Black); } font.DrawText( null, text, (int) (position.X - measure.Width * 0.5f), (int) (position.Y - measure.Height * 0.5f), color); }
public VertexPositionColorTextureNormal( Vector3 position, Color color, Vector2 texture, Vector3 normal ) { Position = position; Color = color; Texture = texture; Normal = normal; }
public GradientStop(double offset, Color color) { Init(); Color = color; Offset = offset; Attach(); }
public Vector2I UpdateVertexArray(string text, ref VertexDefinition.PositionTextureColor[] vertices, ref Buffer vertexBuffer, Color defaultColor, List<TexturedRectangle> icons, int positionX = 0, int positionY = 0) { icons.Clear(); Color color = defaultColor; int width = 0; int maxWidth = 0; int height = Characters.First().Value.height; int maxHeight = height; for (int i = 0; i < text.Length; i++) { char letter = text[i]; if (letter == '\n') { maxWidth = Math.Max(maxWidth, width); width = 0; positionX = 0; positionY += height; maxHeight += height; continue; } if (letter == '[') { if (text[i + 1] == '[') continue; string token = text.Substring(i + 1, text.IndexOf(']', i + 1) - (i + 1)); if (!ColorParser.TryParse(token, out color)) { if (token == "-") color = defaultColor; else if (token == "gold") { icons.Add(new TexturedRectangle(_context, _context.TextureManager.Create("gold.png", "Data/UI/Icons/"), new Vector2I(height, height))); positionX += height + 1; width += height + 1; } else throw new InvalidOperationException("Unexpected token : " + token); } i = text.IndexOf(']', i + 1); continue; } Character c = Characters[letter]; Vector4 colorAsVector = color.ToVector4(); vertices[i * 4] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX, positionY, 0.0f), texture = new Vector2(c.uLeft, c.vTop), color = colorAsVector }; //Top left vertices[i * 4 + 1] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX + c.width, positionY + c.height, 0.0f), texture = new Vector2(c.uRight, c.vBottom), color = colorAsVector }; //Right bottom vertices[i * 4 + 2] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX, positionY + c.height, 0.0f), texture = new Vector2(c.uLeft, c.vBottom), color = colorAsVector }; //Left bottom vertices[i * 4 + 3] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX + c.width, positionY, 0.0f), texture = new Vector2(c.uRight, c.vTop), color = colorAsVector }; //Top right positionX += c.width + 1; width += c.width + 1; } DataStream mappedResource; _context.DirectX.Device.ImmediateContext.MapSubresource(vertexBuffer, MapMode.WriteDiscard, SharpDX.Direct3D11.MapFlags.None, out mappedResource); mappedResource.WriteRange(vertices); _context.DirectX.Device.ImmediateContext.UnmapSubresource(vertexBuffer, 0); return new Vector2I(Math.Max(maxWidth, width), maxHeight); }
public override void SetColor(Color color) { if (color == lastColor) return; lastColor = color; solidColorBrush.Color = new Color4(color.PackedArgb); }
public NotificationModel(float time, float v1, float v2, string v3, Color deepSkyBlue) { _time = time; _v1 = v1; _v2 = v2; _v3 = v3; _deepSkyBlue = deepSkyBlue; }
public void DrawBorder(PrimitiveBatch<VertexPositionColor> primitiveBatch, Color color) { VertexPositionColor p1 = new VertexPositionColor(new Vector3(X, Y + Height, 1.0f), color); VertexPositionColor p2 = new VertexPositionColor(new Vector3(X, Y, 1.0f), color); VertexPositionColor p3 = new VertexPositionColor(new Vector3(X + Width, Y, 1.0f), color); VertexPositionColor p4 = new VertexPositionColor(new Vector3(X + Width, Y + Height, 1.0f), color); primitiveBatch.DrawQuad(p1, p2, p3, p4); }
public NotificationModel(float time, float v1, float v2, string v3, Color deepSkyBlue) { this.time = time; this.v1 = v1; this.v2 = v2; this.v3 = v3; this.deepSkyBlue = deepSkyBlue; }
/// <summary> /// Constructor of this class /// </summary> /// <param id="textures">GUITexture of the style</param> /// <param id="font">Font of the style</param> /// <param id="fontColor">Color of the font of this style</param> /// <param id="shadeText">Sets whether the newText is shaded</param> /// <param id="centeredText">Sets whether the newText is centered</param> public GUISkin(GUITexture textures, SpriteFont font, Color fontColor, bool shadeText, bool centeredText) { this.Textures = textures; this.Font = font; this.CenteredText = centeredText; this.ShadedText = shadeText; this.FontColor = fontColor; }
public Color Ambient() { var ambient = new Color(); foreach (var light in _lights) { ambient += Shader.Ambient(light, 1); } return ambient; }
public static void DrawText(Font font, string text, int posX, int posY, Color color) { Rectangle rec = font.MeasureText(null, text, FontDrawFlags.Center); font.DrawText(null, text, posX + 1 + rec.X, posY + 1, Color.Black); font.DrawText(null, text, posX + rec.X, posY + 1, Color.Black); font.DrawText(null, text, posX - 1 + rec.X, posY - 1, Color.Black); font.DrawText(null, text, posX + rec.X, posY - 1, Color.Black); font.DrawText(null, text, posX + rec.X, posY, color); }
/// <summary> /// Dims the color by specific amount /// </summary> /// <param id="color">This color</param> /// <param id="amount">Amount by which the color-fields should be dimmed, alpha channel excluded (-255 to 255)</param> /// <returns>Returns dimmed color</returns> public static Color ColorDim(this Color color, int amount) { Color a = new Color(); a.R = (byte)MathUtil.Clamp(color.R - amount, 0, 255); a.G = (byte)MathUtil.Clamp(color.G - amount, 0, 255); a.B = (byte)MathUtil.Clamp(color.B - amount, 0, 255); a.A = color.A; return a; }
public LightClass(LightType Type, Vector3 Position, Color Ambiant, Color Diffuse, Color Specular, float Range) { this.Type = Type; this.Position = Position; this.Ambiant = Ambiant; this.Diffuse = Diffuse; this.Specular = Specular; this.Range = Range; }
public TSOConfig() { this.ClientSize = new Size(800, 600); screen_color = SharpDX.Color.LightGray; this.Position = new Vector3(0.0f, +10.0f, +44.0f); this.Fov = 30.0f; this.Znear = 1.0f; this.Zfar = 1000.0f; }
/// <summary> /// Converts a given <paramref name="color"/> into a <see cref="Color4"/> where all componets are using relative values (normalized to 1.00). /// </summary> /// <param name="color">Color.</param> /// <returns>Color4.</returns> public static Color4 FromColor(Color color) { Color4 v = new Color4(color.R, color.G, color.B, color.A); v.Alpha /= 255.0f; v.Red /= 255.0f; v.Green /= 255.0f; v.Blue /= 255.0f; return v; }
public AlertDrawStyle(string text, Color textColor, int borderWidth, Color borderColor, Color backgroundColor, int iconIndex) { TextColor = textColor; BorderWidth = borderWidth; BorderColor = borderColor; Text = text; IconIndex = iconIndex; BackgroundColor = backgroundColor; }
public ZombieCharacter(Game game, Vector3 translation, Color color) : this(game) { this.Color = color; this.Translation = translation; this.bodyGraphics = new OrientedCircle(game, translation, this.Color, this.Radius); this.viewTriangleGraphics = new OrientedTriangle(game, GeometryHelper.GetViewTriangle(Vector3.Zero, Settings.DefaultOrientationVector, this.ViewDistance, this.ViewAngle)); this.smellingGraphics = new Circle(game, translation, Color.Gray, this.SmellingRadius); }
public void AddVertex( float x, float y, Color color ) { if( position == Vector2.Zero ) { position = new Vector2( x, y ); } points.Add( new PolygonPoint( x, y ) ); vertexColors.Add( color ); }
public Circle(Game game, Vector3 translation, Color color, float radius) : this(game) { this.Translation = translation; this.Color = color; this.Radius = radius; InitializeEffect(); InitializeVertexBuffer(); }
public ShaderResourceView CreateColor1By1(Color color) { var key = color.ToAbgr().ToString(); if (_textureSRVs.ContainsKey(key)) { return _textureSRVs[key]; } else { var texture = Create1By1Tex(_device, color); _textureSRVs.Add(key, texture); return texture; } }
public InventoryPreviewSettings() { Enable = false; AutoUpdate = true; CellUsedColor = new Color(128, 128, 128, 220); CellFreeColor = new Color(160, 220, 160, 255); CellSize = new RangeNode<int>(20, 1, 100); CellPadding = new RangeNode<int>(0, 0, 10); PositionX = new RangeNode<float>(13.0f, 0.0f, 100.0f); PositionY = new RangeNode<float>(77.0f, 0.0f, 100.0f); }
/// <summary> /// Primitive copy constructor. Inheriting classes implementing a copy constructor must call this. /// </summary> /// <param name="primitive">Primitive to copy.</param> public Primitive(Primitive primitive) { vertexPositionColors = new List<VertexPositionColor>(); vertexColors = new List<Color>(); primitiveType = primitive.primitiveType; color = primitive.color; position = primitive.position; origin = primitive.origin; scale = primitive.scale; degrees = primitive.degrees; alpha = primitive.alpha; filled = primitive.filled; thickness = primitive.thickness; }
/// <summary> /// Primitive copy constructor. Inheriting classes implementing a copy constructor must call this. /// </summary> /// <param name="primitive">Primitive to copy.</param> public Primitive( Primitive primitive ) { this.vertexPositionColors = new List<VertexPositionColor>(); this.vertexColors = new List<Color>(); this.primitiveType = primitive.primitiveType; this.color = primitive.color; this.position = primitive.position; this.origin = primitive.origin; this.scale = primitive.scale; this.degrees = primitive.degrees; this.alpha = primitive.alpha; this.filled = primitive.filled; this.thickness = primitive.thickness; }
public StatusDrawer() { textSize = new Vector2(21); textColor = Color.Orange; var x = HUDInfo.ScreenSizeX(); var evaderTextSize = Drawing.MeasureText(EvaderText, Font, textSize, FontFlags.None); var pathfinderTextSize = Drawing.MeasureText(PathfinderText, Font, textSize, FontFlags.None); evaderTextPosition = new Vector2(x - evaderTextSize.X - 10, evaderTextSize.Y + 25); pathfinderTextPosition = new Vector2( x - pathfinderTextSize.X - 10, pathfinderTextSize.Y + evaderTextPosition.Y); }
public HudTexture(string fileName, MonsterRarity rarity) : this(fileName, Color.White) { switch (rarity) { case MonsterRarity.Magic: color = HudSkin.MagicColor; break; case MonsterRarity.Rare: color = HudSkin.RareColor; break; case MonsterRarity.Unique: color = HudSkin.UniqueColor; break; } }
public void DrawLine(JVector p0, JVector p1, Color color) { lineIndex += 2; if (lineIndex == LineList.Length) { VertexPositionColor[] temp = new VertexPositionColor[LineList.Length + 50]; LineList.CopyTo(temp, 0); LineList = temp; } LineList[lineIndex - 2].Color = color; LineList[lineIndex - 2].Position = PhysicsSystem.toVector3(p0); LineList[lineIndex - 1].Color = color; LineList[lineIndex - 1].Position = PhysicsSystem.toVector3(p1); }
public void DrawTriangle(JVector p0, JVector p1, JVector p2, Color color) { triangleIndex += 3; if (triangleIndex == TriangleList.Length) { VertexPositionColor[] temp = new VertexPositionColor[TriangleList.Length + 300]; TriangleList.CopyTo(temp, 0); TriangleList = temp; } TriangleList[triangleIndex - 2].Color = color; TriangleList[triangleIndex - 2].Position = PhysicsSystem.toVector3(p0); TriangleList[triangleIndex - 1].Color = color; TriangleList[triangleIndex - 1].Position = PhysicsSystem.toVector3(p1); TriangleList[triangleIndex - 3].Color = color; TriangleList[triangleIndex - 3].Position = PhysicsSystem.toVector3(p2); }
/// <summary> /// Converts the given <paramref name="value"/> into a <see cref="Color"/> and returns it as <paramref name="color"/>. /// It supports <c>Color</c> and <see cref="string"/> (color names, #RRGGBB or #AARRGGBB) input values. /// </summary> /// <param name="value">Value.</param> /// <param name="color">Outputs color.</param> /// <returns><c>true if successful.</c></returns> public static bool ConvertColor(object value, out Color color) { if (value is Color) { color = (Color)value; return true; } if (value is System.Drawing.Color) { color = ((System.Drawing.Color)value).FromDrawingColor(); return true; } var convertFrom = new System.Drawing.ColorConverter().ConvertFrom(value); if (convertFrom == null) { color = new Color(); return false; } color = ((System.Drawing.Color)convertFrom).FromDrawingColor(); return true; }
public override void LoadContent() { color = Color.White; switch( style ) { case FadeStyle.FadeInOut: case FadeStyle.FadeIn: fromAlpha = 0; targetAlpha = 255; break; case FadeStyle.FadeOut: fromAlpha = 255; targetAlpha = 0; break; } screenRect = new Rectangle( 0, 0, sceneManager.ViewportWidth, sceneManager.ViewportHeight ); gradient = Texture2D.New( GraphicsDevice, 1, 1, PixelFormat.B8G8R8A8.UNorm ); gradient.SetData( new Color[] { Color.Black } ); base.LoadContent(); }
public static string GetColourString(Color v, string d = ", ") { var c = CultureInfo.InvariantCulture; return(v.R.ToString(c) + d + v.G.ToString(c) + d + v.B.ToString(c) + d + v.A.ToString(c)); }
/// <summary> /// Sets custom text color /// </summary> /// <param name="fontColor"> /// The font color. /// </param> /// <returns> /// The <see cref="Menu" />. /// </returns> public Menu SetFontColor(Color fontColor) { this.Color = fontColor; return(this); }
void AddAtomic(SharpDevice device, AtomicSector_0009 AtomicSector) { if (AtomicSector.atomicSectorStruct.isNativeData) { AddNativeData(device, AtomicSector.atomicSectorExtension, MaterialList, Matrix.Identity); return; } List <VertexColoredTextured> vertexList = new List <VertexColoredTextured>(); foreach (Vertex3 v in AtomicSector.atomicSectorStruct.vertexArray) { vertexList.Add(new VertexColoredTextured(new Vector3(v.X, v.Y, v.Z), new Vector2(), new SharpDX.Color())); vertexListG.Add(new Vector3(v.X, v.Y, v.Z)); } if (!isShadowCollision) { for (int i = 0; i < vertexList.Count; i++) { RenderWareFile.Color c = AtomicSector.atomicSectorStruct.colorArray[i]; VertexColoredTextured v = vertexList[i]; v.Color = new SharpDX.Color(c.R, c.G, c.B, c.A); vertexList[i] = v; } for (int i = 0; i < vertexList.Count; i++) { Vertex2 tc = AtomicSector.atomicSectorStruct.uvArray[i]; VertexColoredTextured v = vertexList[i]; v.TextureCoordinate = new Vector2(tc.X, tc.Y); vertexList[i] = v; } } List <SharpSubSet> SubsetList = new List <SharpSubSet>(); List <int> indexList = new List <int>(); int previousIndexCount = 0; for (int i = 0; i < MaterialList.Count; i++) { for (int j = 0; j < AtomicSector.atomicSectorStruct.triangleArray.Length; j++) // each (Triangle t in AtomicSector.atomicStruct.triangleArray) { Triangle t = AtomicSector.atomicSectorStruct.triangleArray[j]; if (t.materialIndex == i) { indexList.Add(t.vertex1); indexList.Add(t.vertex2); indexList.Add(t.vertex3); if (isShadowCollision) { RenderWareFile.Color c = RenderWareFile.Color.FromString(MaterialList[i]); SharpDX.Color color = new SharpDX.Color(c.R, c.G, c.B, c.A); VertexColoredTextured v1 = vertexList[t.vertex1]; v1.Color = color; vertexList[t.vertex1] = v1; VertexColoredTextured v2 = vertexList[t.vertex2]; v2.Color = color; vertexList[t.vertex2] = v2; VertexColoredTextured v3 = vertexList[t.vertex3]; v3.Color = color; vertexList[t.vertex3] = v3; } triangleList.Add(new Triangle(t.materialIndex, (ushort)(t.vertex1 + triangleListOffset), (ushort)(t.vertex2 + triangleListOffset), (ushort)(t.vertex3 + triangleListOffset))); } } if (indexList.Count - previousIndexCount > 0) { SubsetList.Add(new SharpSubSet(previousIndexCount, indexList.Count - previousIndexCount, TextureManager.GetTextureFromDictionary(MaterialList[i]), MaterialList[i])); } previousIndexCount = indexList.Count(); } triangleListOffset += AtomicSector.atomicSectorStruct.vertexArray.Length; if (SubsetList.Count > 0) { meshList.Add(SharpMesh.Create(device, vertexList.ToArray(), indexList.ToArray(), SubsetList)); } }
void AddNativeData(SharpDevice device, Extension_0003 extension, List <string> MaterialStream, Matrix transformMatrix) { NativeDataGC n = null; foreach (RWSection rw in extension.extensionSectionList) { if (rw is BinMeshPLG_050E binmesh) { if (binmesh.numMeshes == 0) { return; } } if (rw is NativeDataPLG_0510 native) { n = native.nativeDataStruct.nativeData; break; } } if (n == null) { throw new Exception(ChunkName + ChunkNumber.ToString()); } List <Vertex3> vertexList1 = new List <Vertex3>(); List <Vertex3> normalList = new List <Vertex3>(); List <RenderWareFile.Color> colorList = new List <RenderWareFile.Color>(); List <Vertex2> textCoordList = new List <Vertex2>(); foreach (Declaration d in n.declarations) { foreach (object o in d.entryList) { if (d.declarationType == Declarations.Vertex) { vertexList1.Add((Vertex3)o); } else if (d.declarationType == Declarations.Color) { colorList.Add((RenderWareFile.Color)o); } else if (d.declarationType == Declarations.TextCoord) { textCoordList.Add((Vertex2)o); } else if (d.declarationType == Declarations.Normal) { normalList.Add((Vertex3)o); } else { throw new Exception(); } } } List <VertexColoredTextured> vertexList = new List <VertexColoredTextured>(); List <int> indexList = new List <int>(); int k = 0; int previousAmount = 0; List <SharpSubSet> subSetList = new List <SharpSubSet>(); foreach (TriangleDeclaration td in n.triangleDeclarations) { foreach (TriangleList tl in td.TriangleListList) { foreach (int[] objectList in tl.entries) { Vector3 position = new Vector3(); SharpDX.Color color = new SharpDX.Color(255, 255, 255, 255); Vector2 textureCoordinate = new Vector2(); Vector3 normal = new Vector3(); for (int j = 0; j < objectList.Count(); j++) { if (n.declarations[j].declarationType == Declarations.Vertex) { position = (Vector3)Vector3.Transform( new Vector3( vertexList1[objectList[j]].X, vertexList1[objectList[j]].Y, vertexList1[objectList[j]].Z), transformMatrix); } else if (n.declarations[j].declarationType == Declarations.Color) { color = new SharpDX.Color(colorList[objectList[j]].R, colorList[objectList[j]].G, colorList[objectList[j]].B, colorList[objectList[j]].A); if (color.A == 0 || (color.R == 0 && color.G == 0 && color.B == 0)) { color = new SharpDX.Color(255, 255, 255, 255); } } else if (n.declarations[j].declarationType == Declarations.TextCoord) { textureCoordinate.X = textCoordList[objectList[j]].X; textureCoordinate.Y = textCoordList[objectList[j]].Y; } else if (n.declarations[j].declarationType == Declarations.Normal) { normal = new Vector3( normalList[objectList[j]].X, normalList[objectList[j]].Y, normalList[objectList[j]].Z); } } vertexList.Add(new VertexColoredTextured(position, textureCoordinate, color)); indexList.Add(k); k++; vertexListG.Add(position); } subSetList.Add(new SharpSubSet(previousAmount, vertexList.Count() - previousAmount, TextureManager.GetTextureFromDictionary(MaterialStream[td.MaterialIndex]), MaterialStream[td.MaterialIndex])); previousAmount = vertexList.Count(); } } if (vertexList.Count > 0) { for (int i = 2; i < indexList.Count; i++) { triangleList.Add(new Triangle(0, (ushort)(i + triangleListOffset - 2), (ushort)(i + triangleListOffset - 1), (ushort)(i + triangleListOffset))); } triangleListOffset += vertexList.Count; meshList.Add(SharpMesh.Create(device, vertexList.ToArray(), indexList.ToArray(), subSetList, SharpDX.Direct3D.PrimitiveTopology.TriangleStrip)); } }
/// <summary> /// Draws a rounded Box. If Smoothing is true it will draw also a border. /// </summary> /// <param name="x">Position X</param> /// <param name="y">Position Y</param> /// <param name="w">Width</param> /// <param name="h">Height</param> /// <param name="radius">Radius</param> /// <param name="color">Color</param> /// <param name="bcolor">Border Color</param> public static void DrawBoxTopRounded(float x, float y, float w, float h, float radius, Color color, Color bcolor) { Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); // Top-left corner Utils.DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, Utils.CircleType.Quarter, true, 16, color); // Top-right corner Utils.DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, Utils.CircleType.Quarter, true, 16, color); // Bottom-right corner Utils.DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, Utils.CircleType.Quarter, true, 16, color); // Bottom-left corner Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); // Top-left corner Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); // Top-right corner Utils.DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-right corner Utils.DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-left corner Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line }
public static Color ToBGRAColor(this string value) { return(uint.TryParse(value, NumberStyles.HexNumber, null, out var bgra) ? Color.FromBgra(bgra) : Color.Black); }
public static string ToHex(this Color value) { return(ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(value.A, value.R, value.G, value.B))); }
public static void DrawText(Font aFont, String aText, int aPosX, int aPosY, SharpDX.Color aColor) { aFont.DrawText(null, aText, aPosX + 2, aPosY + 2, aColor != SharpDX.Color.Black ? SharpDX.Color.Black : SharpDX.Color.White); aFont.DrawText(null, aText, aPosX, aPosY, aColor); }
/// <summary> /// Create vertex with position from individual components and normal and color /// </summary> /// <param name="pX"></param> /// <param name="pY"></param> /// <param name="pZ"></param> /// <param name="normal"></param> /// <param name="color"></param> public Vertex(float pX, float pY, float pZ, Vector3 normal, SharpDX.Color color) : this(new Vector3(pX, pY, pZ), normal, color) { }