public void SetColor(ColorRGBA aColor) { float red = aColor.R * 0.299f; float green = aColor.G * 0.587f; float blue = aColor.B * 0.114f; data = (byte)(Math.Floor((red + green + blue) * (float)0xff)); }
public Pixel(PixelLayout layout, PixelComponentType pType, ColorRGBA color) { Layout = layout; ComponentType = pType; SetColor(color); }
public RGBAb(ColorRGBA aColor) { red = (byte)(aColor.R * byte.MaxValue); green = (byte)(aColor.G * byte.MaxValue); blue = (byte)(aColor.B * byte.MaxValue); alpha = (byte)(aColor.A * byte.MaxValue); }
public BrickShader(GraphicsInterface gi) : base(gi) { //Console.WriteLine("BrickShader Link Log: \n{0}", InfoLog); GLSLVertexShader vShader = new GLSLVertexShader(gi, Brick_VertexSource); AttachShader(vShader); GLSLFragmentShader fShader = new GLSLFragmentShader(gi, Brick_FragmentSource); AttachShader(fShader); Link(); // Do an initial selection so that all the variables can be located Bind(); BrickColor_Pos = GetUniformLocation("BrickColor"); MortarColor_Pos = GetUniformLocation("MortarColor"); BrickSize_Pos = GetUniformLocation("BrickSize"); BrickPct_Pos = GetUniformLocation("BrickPct"); // From the Vertex Shader LightPosition_Pos = GetUniformLocation("LightPosition"); // Set some initial values BrickColor = new ColorRGBA(1.0f, 0.3f, 0.2f); MortarColor = new ColorRGBA(0.85f, 0.86f, 0.84f); BrickSize = new float2(0.30f, 0.15f); BrickPct = new float2(0.90f, 0.85f); LightPosition = new Vector3f(0.0f, 0.0f, 4.0f); // Unselect so we start in an unselected state Unbind(); }
public virtual void SetColor(int x, int y, ColorRGBA color) { // Create a pixel for the color Pixel pel = new Pixel(PixRectInfo.GetPixelInformation(), Pixel.GetBytesForColor(PixRectInfo.GetPixelInformation(), color)); SetPixel(x, y, pel); }
PixelArray<BGRb> CreateSteppedTestImage(int width, int height) { PixelArray<BGRb> picture = new PixelArray<BGRb>(width, height); ColorRGBA black = new ColorRGBA(0, 0, 0); ColorRGBA white = new ColorRGBA(1, 1, 1); ColorRGBA red = new ColorRGBA(1, 0, 0); ColorRGBA blue = new ColorRGBA(0, 1, 0); ColorRGBA generic = new ColorRGBA(0, 0, 0); for (int y = 0; y < picture.Height; y++) { generic.Red = (float)y / picture.Height - 1.0f; generic.Green = 1.0f - (float)y / picture.Height; //generic.Blue = (float)y / picture.Height - 1.0f; for (int x = 0; x < picture.Width; x++) { //if (x < width / 2) // picture.SetColor(x, y, red); //else // picture.SetColor(x, y, white); generic.Blue = (float)x / picture.Width - 1.0f; picture.SetColor(x, y, generic); } } return picture; }
public GLMaterial(ColorRGBA ambient, ColorRGBA diffuse, ColorRGBA specular, ColorRGBA emissive, float shininess) { fAmbient = ambient; fDiffuse = diffuse; fSpecular = specular; fEmissive = emissive; fShininess = shininess; }
public ColorRGBA Transform(ColorRGBA dst) { float red = (dst.R + fColor.R) / 2.0f; float green = (dst.G + fColor.G) / 2.0f; float blue = (dst.B + fColor.B) / 2.0f; ColorRGBA newColor = new ColorRGBA(red, green, blue, dst.A); return newColor; }
public GLLight(GraphicsInterface gi, GLLightName aName, Point3D position, ColorRGBA aColor) :base(gi, (GLOption)aName) { fLightName = aName; fPosition = position; fAmbient = aColor; fDiffuse = aColor; fSpecular = aColor; fLightAttenuation = GLLightAttenuation.GetDefault(); }
public GLSpear(float3 vec, ColorRGBA shaftColor) { fShaftColor = shaftColor; fVector = vec; fSpearLength = fVector.Length; fDisk = new GLUDisk(fAxisRadius, fAxisRadius, 10, 1); fDisk.DrawingStyle = QuadricDrawStyle.Fill; fDisk.NormalType = QuadricNormalType.Smooth; fDisk.Orientation = QuadricOrientation.Outside; fDisk.UsesTexture = 0; fAxisShaft = new GLUCylinder(fAxisRadius, fSpearLength, 10, 1); fAxisShaft.NormalType = QuadricNormalType.Smooth; fAxisShaft.Orientation = QuadricOrientation.Outside; fAxisShaft.UsesTexture = 0; fArrowHead = new GLUCone(fArrowRadius, fArrowHeight, 10, 1); fArrowHead.NormalType = QuadricNormalType.Smooth; fArrowHead.Orientation = QuadricOrientation.Outside; fArrowHead.UsesTexture = 0; }
public ConstantColor(ColorRGBA aColor) { fColor = aColor; }
public ColorRGBA GetPixel(float x, float y, int m = 0) { int W = GetWidth(m); int H = GetHeight(m); x *= (W - 1); y *= (H - 1); ColorRGBA pixel = new ColorRGBA(); if (Interpolation == TEXTURE_INTERPOLATION.BILINEAR) { BilinearIndex ix = NewBilinearIndex(x, W); BilinearIndex iy = NewBilinearIndex(y, H); int channels = Channels; if (channels > 0) { pixel.r = GetBilinear(ix, iy, 0, m); } if (channels > 1) { pixel.g = GetBilinear(ix, iy, 1, m); } if (channels > 2) { pixel.b = GetBilinear(ix, iy, 2, m); } if (channels > 3) { pixel.a = GetBilinear(ix, iy, 3, m); } } else if (Interpolation == TEXTURE_INTERPOLATION.BICUBIC) { BicubicIndex ix = NewBicubicIndex(x, W); BicubicIndex iy = NewBicubicIndex(y, H); int channels = Channels; if (channels > 0) { pixel.r = GetBicubic(ix, iy, 0, m); } if (channels > 1) { pixel.g = GetBicubic(ix, iy, 1, m); } if (channels > 2) { pixel.b = GetBicubic(ix, iy, 2, m); } if (channels > 3) { pixel.a = GetBicubic(ix, iy, 3, m); } } else { pixel = GetPixel((int)x, (int)y, m); } return(pixel); }
public override void Rectangle(double left, double bottom, double right, double top, ColorRGBA color) { _internalGfx.DrawRectangle(_currentPen, System.Drawing.Rectangle.FromLTRB((int)left, (int)top, (int)right, (int)bottom)); }
public override void Clear(ColorRGBA color) { _internalGfx.Clear(VxsHelper.ToDrawingColor(color)); }
public virtual void BlendVL(int x, int y1, int y2, ColorRGBA sourceColor, byte cover) { linkedImage.BlendVL(x, y1, y2, sourceColor, cover); }
public PlayerText(Player aTextPlayer, float aMaxDistance, ColorRGBA aDefaultColor) : this(null, aTextPlayer, aMaxDistance, aDefaultColor, 1000, true) { }
/// <summary>Creates a mesh consisting of one face, which is represented by individual vertices, and a color.</summary> /// <param name="Vertices">The vertices that make up one face.</param> /// <param name="Color">The color to be applied on the face.</param> internal Mesh(Vertex[] Vertices, ColorRGBA Color) { this.Vertices = Vertices; this.Materials = new MeshMaterial[1]; this.Materials[0].Color = Color; this.Materials[0].DaytimeTextureIndex = -1; this.Materials[0].NighttimeTextureIndex = -1; this.Faces = new MeshFace[1]; this.Faces[0].Material = 0; this.Faces[0].Vertices = new MeshFaceVertex[Vertices.Length]; for (int i = 0; i < Vertices.Length; i++) { this.Faces[0].Vertices[i].Index = (ushort)i; } }
public DataSource(int id, string name, byte r = 0, byte g = 0, byte b = 0, float a = 0.5F) { Id = id; Name = name; Color = new ColorRGBA(r, g, b, a); }
public override void Draw(Graphics2D gx) { var widgetsSubImage = gx.DestImage; var scline = gx.ScanlinePacked8; int width = (int)widgetsSubImage.Width; int height = (int)widgetsSubImage.Height; //change value *** if (isMaskSliderValueChanged) { generate_alpha_mask(gx.ScanlineRasToDestBitmap, gx.ScanlinePacked8, gx.ScanlineRasterizer, width, height); this.isMaskSliderValueChanged = false; } var rasterizer = gx.ScanlineRasterizer; rasterizer.SetClipBox(0, 0, width, height); //alphaMaskImageBuffer.AttachBuffer(alphaByteArray, 0, width, height, width, 8, 1); PixelFarm.Agg.Image.AlphaMaskAdaptor imageAlphaMaskAdaptor = new PixelFarm.Agg.Image.AlphaMaskAdaptor(widgetsSubImage, alphaMask); ClipProxyImage alphaMaskClippingProxy = new ClipProxyImage(imageAlphaMaskAdaptor); ClipProxyImage clippingProxy = new ClipProxyImage(widgetsSubImage); //Affine transform = Affine.NewIdentity(); //transform *= Affine.NewTranslation(-lionShape.Center.x, -lionShape.Center.y); //transform *= Affine.NewScaling(lionScale, lionScale); //transform *= Affine.NewRotation(angle + Math.PI); //transform *= Affine.NewSkewing(skewX / 1000.0, skewY / 1000.0); //transform *= Affine.NewTranslation(Width / 2, Height / 2); Affine transform = Affine.NewMatix( AffinePlan.Translate(-lionShape.Center.x, -lionShape.Center.y), AffinePlan.Scale(lionScale, lionScale), AffinePlan.Rotate(angle + Math.PI), AffinePlan.Skew(skewX / 1000.0, skewY / 1000.0), AffinePlan.Translate(width / 2, height / 2)); clippingProxy.Clear(ColorRGBA.White); ScanlineRasToDestBitmapRenderer sclineRasToBmp = gx.ScanlineRasToDestBitmap; // draw a background to show how the mask is working better int rect_w = 30; for (int i = 0; i < 40; i++) { for (int j = 0; j < 40; j++) { if ((i + j) % 2 != 0) { VertexSource.RoundedRect rect = new VertexSource.RoundedRect(i * rect_w, j * rect_w, (i + 1) * rect_w, (j + 1) * rect_w, 0); rect.NormalizeRadius(); // Drawing as an outline rasterizer.AddPath(rect.MakeVxs()); sclineRasToBmp.RenderWithColor(clippingProxy, rasterizer, scline, ColorRGBA.Make(.9f, .9f, .9f)); } } } //int x, y; // Render the lion //VertexSourceApplyTransform trans = new VertexSourceApplyTransform(lionShape.Path, transform); //var vxlist = new System.Collections.Generic.List<VertexData>(); //trans.DoTransform(vxlist); sclineRasToBmp.RenderSolidAllPaths(alphaMaskClippingProxy, rasterizer, scline, transform.TransformToVxs(lionShape.Path.Vxs), lionShape.Colors, lionShape.PathIndexList, lionShape.NumPaths); /* * // Render random Bresenham lines and markers * agg::renderer_markers<amask_ren_type> m(r); * for(i = 0; i < 50; i++) * { * m.line_color(agg::rgba8(randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * (randGenerator.Next() & 0x7F) + 0x7F)); * m.fill_color(agg::rgba8(randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * (randGenerator.Next() & 0x7F) + 0x7F)); * * m.line(m.coord(randGenerator.Next() % width), m.coord(randGenerator.Next() % height), * m.coord(randGenerator.Next() % width), m.coord(randGenerator.Next() % height)); * * m.marker(randGenerator.Next() % width, randGenerator.Next() % height, randGenerator.Next() % 10 + 5, * agg::marker_e(randGenerator.Next() % agg::end_of_markers)); * } * * * // Render random anti-aliased lines * double w = 5.0; * agg::line_profile_aa profile; * profile.width(w); * * typedef agg::renderer_outline_aa<amask_ren_type> renderer_type; * renderer_type ren(r, profile); * * typedef agg::rasterizer_outline_aa<renderer_type> rasterizer_type; * rasterizer_type ras(ren); * ras.round_cap(true); * * for(i = 0; i < 50; i++) * { * ren.Color = agg::rgba8(randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * //255)); * (randGenerator.Next() & 0x7F) + 0x7F); * ras.move_to_d(randGenerator.Next() % width, randGenerator.Next() % height); * ras.line_to_d(randGenerator.Next() % width, randGenerator.Next() % height); * ras.render(false); * } * * * // Render random circles with gradient * typedef agg::gradient_linear_color<color_type> grad_color; * typedef agg::gradient_circle grad_func; * typedef agg::span_interpolator_linear<> interpolator_type; * typedef agg::span_gradient<color_type, * interpolator_type, * grad_func, * grad_color> span_grad_type; * * agg::trans_affine grm; * grad_func grf; * grad_color grc(agg::rgba8(0,0,0), agg::rgba8(0,0,0)); * agg::ellipse ell; * agg::span_allocator<color_type> sa; * interpolator_type inter(grm); * span_grad_type sg(inter, grf, grc, 0, 10); * agg::renderer_scanline_aa<amask_ren_type, * agg::span_allocator<color_type>, * span_grad_type> rg(r, sa, sg); * for(i = 0; i < 50; i++) * { * x = randGenerator.Next() % width; * y = randGenerator.Next() % height; * double r = randGenerator.Next() % 10 + 5; * grm.reset(); * grm *= agg::trans_affine_scaling(r / 10.0); * grm *= agg::trans_affine_translation(x, y); * grm.invert(); * grc.colors(agg::rgba8(255, 255, 255, 0), * agg::rgba8(randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * randGenerator.Next() & 0x7F, * 255)); * sg.color_function(grc); * ell.init(x, y, r, r, 32); * g_rasterizer.add_path(ell); * agg::render_scanlines(g_rasterizer, g_scanline, rg); * } */ //m_num_cb.Render(g_rasterizer, g_scanline, clippingProxy); }
public GraphicsEngine(VideoBackend backend) { SetVideoBackend(backend); RenderClearColor = new ColorRGBA(140, 180, 200); BorderColor = new ColorRGBA(0, 40, 200); }
public void SetRenderDrawColor(ColorRGBA color) { SDL_SetRenderDrawColor(Renderer, color.Red, color.Green, color.Blue, color.Alpha); }
public Button(String text, String tex, String font, ColorRGBA color, Vec2i pos, Vec2i size, Texture parent, bool isSingleUser, int singleUserID) : this(text, tex, "FONT_DEFAULT.TGA", ColorRGBA.White, pos, size, parent, GUIEvents.LeftClicked, isSingleUser, singleUserID) { }
public ColorRGBA Transform(ColorRGBA dst) { // First convert to a Pixel value so we can twiddle bits BGRAb pixel = new BGRAb(); pixel.SetColor(dst); pixel.Red = (byte)(255 - pixel.Red); pixel.Green = (byte)(255 - pixel.Green); pixel.Blue = (byte)(255 - pixel.Blue); return pixel.GetColor(); }
public PlayerText(Player aTextPlayer, float aMaxDistance, ColorRGBA aDefaultColor, long aDefaultBlendTime) : this(null, aTextPlayer, aMaxDistance, aDefaultColor, aDefaultBlendTime, true) { }
public void Color4(ColorRGBA aColor) { gl.glColor4f(aColor.R, aColor.G, aColor.B, aColor.A); // Don't check for error, because this is called between // glBegin()/glEnd() //CheckException(); }
private void ParseColor(string str) { str = str.Trim(); if (str.StartsWith("rgb(", StringComparison.OrdinalIgnoreCase)) { str = str.Substring(4, str.Length - 5); string[] parts = str.Split(new char[] { ',', ' ', '/' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 3) { throw new DomException(DomExceptionType.SyntaxErr); } try { string red = parts[0].Trim(); string green = parts[1].Trim(); string blue = parts[2].Trim(); string alpha = null; if (parts.Length == 4) { alpha = parts[3].Trim(); } if (string.IsNullOrWhiteSpace(red) || string.IsNullOrWhiteSpace(green) || string.IsNullOrWhiteSpace(blue)) { if (string.IsNullOrWhiteSpace(alpha)) { SetPrimitiveValues(0, 0, 0); } else { SetPrimitiveValues("0", "0", "0", alpha); } } else { if (string.IsNullOrWhiteSpace(alpha)) { SetPrimitiveValues(red, green, blue); } else { SetPrimitiveValues(red, green, blue, alpha); } } } catch { throw new DomException(DomExceptionType.SyntaxErr, "rgb() color in the wrong format: " + str); } } else if (str.StartsWith("rgba(", StringComparison.OrdinalIgnoreCase)) { str = str.Substring(5, str.Length - 6); string[] parts = str.Split(new char[] { ',', ' ', '/' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length != 4) { throw new DomException(DomExceptionType.SyntaxErr); } try { string red = parts[0].Trim(); string green = parts[1].Trim(); string blue = parts[2].Trim(); string alpha = parts[3].Trim(); if (string.IsNullOrWhiteSpace(red) || string.IsNullOrWhiteSpace(green) || string.IsNullOrWhiteSpace(blue)) { if (string.IsNullOrWhiteSpace(alpha)) { SetPrimitiveValues(0, 0, 0, 0); } else { SetPrimitiveValues("0", "0", "0", alpha); } } else { if (string.IsNullOrWhiteSpace(alpha)) { SetPrimitiveValues(red, green, blue); } else { SetPrimitiveValues(red, green, blue, alpha); } } } catch { throw new DomException(DomExceptionType.SyntaxErr, "rgba() color in the wrong format: " + str); } } else if (str.StartsWith("hsl(", StringComparison.OrdinalIgnoreCase)) { str = str.Substring(4, str.Length - 5); string[] parts = str.Split(new char[] { ',', ' ', '/' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 3) { throw new DomException(DomExceptionType.SyntaxErr); } try { string hue = parts[0].Trim(); // An angle of the color circle given in degs, rads, grads, or turns string saturation = parts[1].Trim(); // A percentage. 100% saturation is completely saturated, while 0% is completely unsaturated (gray) string lightness = parts[2].Trim(); // A percentage. 100% lightness is white, 0% lightness is black, and 50% lightness is "normal." string alpha = null; // A number between 0 and 1, or a percentage, where the number 1 corresponds to 100% (full opacity). if (parts.Length == 4) { alpha = parts[3].Trim(); } // Convert the HSL color to an RGB color SetPrimitiveValues(ColorRGBA.FromHsl(hue, saturation, lightness, alpha), alpha); } catch { throw new DomException(DomExceptionType.SyntaxErr, "hsl() color in the wrong format: " + str); } } else if (str.StartsWith("hsla(", StringComparison.OrdinalIgnoreCase)) { str = str.Substring(5, str.Length - 6); string[] parts = str.Split(new char[] { ',', ' ', '/' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length != 4) { throw new DomException(DomExceptionType.SyntaxErr); } try { string hue = parts[0].Trim(); // An angle of the color circle given in degs, rads, grads, or turns string saturation = parts[1].Trim(); // A percentage. 100% saturation is completely saturated, while 0% is completely unsaturated (gray) string lightness = parts[2].Trim(); // A percentage. 100% lightness is white, 0% lightness is black, and 50% lightness is "normal." string alpha = parts[3].Trim(); // A number between 0 and 1, or a percentage, where the number 1 corresponds to 100% (full opacity). // Convert the HSL color to an RGB color SetPrimitiveValues(ColorRGBA.FromHsl(hue, saturation, lightness, alpha), alpha); } catch { throw new DomException(DomExceptionType.SyntaxErr, "hsla() color in the wrong format: " + str); } } else { str = str.ToLower(); // fix a difference in the Windows color table str = str.Replace("grey", "gray"); if (_knownColors.ContainsKey(str)) { _name = str; string color = _knownColors[str]; if (color.Length == 7 && color.StartsWith("#", StringComparison.OrdinalIgnoreCase)) // Expected actually! { color = color.Substring(1); } else { throw new DomException(DomExceptionType.SyntaxErr); } SetPrimitiveValues(int.Parse(color.Substring(0, 2), NumberStyles.HexNumber), int.Parse(color.Substring(2, 2), NumberStyles.HexNumber), int.Parse(color.Substring(4, 2), NumberStyles.HexNumber)); } else if (_systemColorNames.Contains(str)) { _name = str; } else { try { SetPrimitiveValues(ColorRGBA.FromHex(str)); } catch { SetPrimitiveValues(0, 0, 0); } } } }
public virtual void BlendHL(int x1, int y, int x2, ColorRGBA sourceColor, byte cover) { linkedImage.BlendHL(x1, y, x2, sourceColor, cover); }
public static ColorRGBA FromHsl(string hue, string saturation, string lightness, string alpha = null) { hue = hue.ToLower(); saturation = saturation.TrimEnd('%'); lightness = lightness.TrimEnd('%'); string hueUnit = ""; if (hue.EndsWith("deg", StringComparison.OrdinalIgnoreCase)) { hueUnit = "deg"; hue = hue.Replace("deg", ""); } else if (hue.EndsWith("rad", StringComparison.OrdinalIgnoreCase)) { hueUnit = "rad"; hue = hue.Replace("rad", ""); } else if (hue.EndsWith("turn", StringComparison.OrdinalIgnoreCase)) { hueUnit = "turn"; hue = hue.Replace("turn", ""); } else if (hue.EndsWith("grad", StringComparison.OrdinalIgnoreCase)) { hueUnit = "grad"; hue = hue.Replace("grad", ""); } else if (hue.EndsWith("gon", StringComparison.OrdinalIgnoreCase)) { hueUnit = "grad"; hue = hue.Replace("gon", ""); } else if (hue.EndsWith("g", StringComparison.OrdinalIgnoreCase)) { hueUnit = "grad"; hue = hue.Replace("g", ""); } // Get the HSL values in a range from 0 to 1. double h = 0; if (string.IsNullOrWhiteSpace(hueUnit) || string.Equals(hueUnit, "deg", StringComparison.Ordinal)) // Degrees { h = double.Parse(hue) / 360.0; } else if (string.Equals(hueUnit, "rad", StringComparison.Ordinal)) // Radian { h = Math.Round(double.Parse(hue) * 180 / Math.PI, 2) / 360.0; } else if (string.Equals(hueUnit, "grad", StringComparison.Ordinal) || string.Equals(hueUnit, "gon", StringComparison.Ordinal) || string.Equals(hueUnit, "g", StringComparison.Ordinal)) // Gradian { h = Math.Round(double.Parse(hue) * 180 / 200, 2) / 360.0; } else if (string.Equals(hueUnit, "turn", StringComparison.Ordinal)) // Turns { h = double.Parse(hue); } double s = double.Parse(saturation) / 100.0; double l = double.Parse(lightness) / 100.0; int a = -1; if (!string.IsNullOrWhiteSpace(alpha)) { double alphaValue = -1; if (alpha.EndsWith("%", StringComparison.OrdinalIgnoreCase)) { alphaValue = double.Parse(alpha.TrimEnd('%')) / 100.0; } else { alphaValue = double.Parse(alpha); } if (alphaValue >= 0 && alphaValue <= 1) { a = Convert.ToInt16(alphaValue * 255); } } // Convert the HSL color to an RGB color return(ColorRGBA.FromHsl(h, s, l, a)); }
public virtual void SetColor(ColorRGBA color) { fColor = color; GL.LightModel(LightModelParameter.LightModelAmbient, (float[])fColor); }
public virtual void SetPixel(int x, int y, ColorRGBA color) { linkedImage.SetPixel(x, y, color); }
public override void BlendSolidHSpan(int x, int y, int len, ColorRGBA color, byte[] covers, int coversIndex) { byte[] buffer = m_spans; m_mask.combine_hspan(x, y, covers, coversIndex, len); linkedImage.BlendSolidHSpan(x, y, len, color, covers, coversIndex); }
public ColorRGBA Transform(ColorRGBA dst) { return PerformOperation(dst, fColor); }
public override void FillRectangle(double left, double bottom, double right, double top, ColorRGBA fillColor) { System.Drawing.Color prevColor = _currentFillBrush.Color; _currentFillBrush.Color = VxsHelper.ToDrawingColor(fillColor); _internalGfx.FillRectangle(_currentFillBrush, System.Drawing.RectangleF.FromLTRB((float)left, (float)top, (float)right, (float)bottom)); _currentFillBrush.Color = prevColor; }
public virtual void BlendSolidVSpan(int x, int y, int len, ColorRGBA c, byte[] covers, int coversIndex) { linkedImage.BlendSolidVSpan(x, y, len, c, covers, coversIndex); }
private static ColorRGBA[] LoadHalo2Palette() { #region H2Palette byte[] H2PaletteBuffer = new byte[] { 255, 126, 126, 255, 255, 127, 126, 255, 255, 128, 126, 255, 255, 129, 126, 255, 255, 126, 127, 255, 255, 127, 127, 255, 255, 128, 127, 255, 255, 129, 127, 255, 255, 126, 128, 255, 255, 127, 128, 255, 255, 128, 128, 255, 255, 129, 128, 255, 255, 126, 129, 255, 255, 127, 129, 255, 255, 128, 129, 255, 255, 129, 129, 255, 255, 130, 127, 255, 255, 127, 131, 255, 255, 127, 125, 255, 255, 131, 129, 255, 255, 124, 129, 255, 255, 130, 124, 255, 255, 129, 132, 255, 255, 124, 125, 255, 255, 133, 127, 255, 255, 125, 132, 255, 255, 128, 122, 255, 255, 132, 132, 255, 255, 122, 128, 255, 255, 133, 124, 255, 255, 127, 135, 255, 255, 124, 122, 255, 255, 136, 130, 255, 255, 121, 132, 255, 255, 131, 120, 255, 255, 132, 136, 255, 255, 119, 124, 255, 255, 137, 125, 255, 255, 123, 137, 255, 255, 125, 118, 255, 255, 137, 134, 255, 255, 117, 130, 255, 255, 135, 119, 255, 255, 129, 140, 255, 255, 119, 120, 255, 255, 141, 128, 255, 255, 119, 137, 255, 255, 129, 115, 255, 255, 136, 139, 255, 255, 114, 126, 255, 255, 140, 120, 255, 255, 124, 142, 255, 255, 121, 115, 255, 255, 142, 133, 255, 255, 113, 134, 255, 254, 135, 113, 255, 254, 133, 144, 255, 254, 113, 120, 255, 254, 145, 124, 255, 254, 118, 142, 255, 254, 126, 110, 255, 254, 142, 140, 255, 254, 109, 129, 255, 254, 142, 114, 255, 254, 127, 147, 255, 254, 115, 113, 255, 254, 148, 131, 255, 254, 111, 140, 255, 254, 133, 107, 255, 254, 139, 147, 255, 254, 107, 121, 255, 254, 148, 119, 255, 253, 119, 149, 255, 253, 120, 106, 255, 253, 149, 139, 255, 253, 105, 134, 255, 253, 141, 108, 255, 253, 132, 152, 255, 253, 108, 113, 255, 253, 153, 126, 255, 253, 111, 147, 255, 253, 128, 102, 255, 253, 146, 147, 255, 253, 101, 126, 255, 253, 150, 111, 255, 252, 123, 155, 255, 252, 113, 104, 255, 252, 155, 135, 255, 252, 103, 141, 255, 252, 138, 101, 255, 252, 139, 155, 255, 252, 101, 115, 255, 252, 157, 119, 255, 252, 113, 155, 255, 252, 121, 98, 255, 252, 154, 146, 255, 251, 96, 132, 255, 251, 149, 103, 255, 251, 129, 161, 255, 251, 105, 105, 255, 251, 161, 129, 255, 251, 102, 150, 255, 251, 132, 94, 255, 251, 148, 156, 255, 251, 94, 120, 255, 251, 159, 110, 255, 250, 117, 162, 255, 250, 113, 95, 255, 250, 162, 142, 255, 250, 93, 141, 255, 250, 145, 95, 255, 250, 138, 164, 255, 250, 96, 108, 255, 250, 166, 121, 255, 249, 104, 159, 255, 249, 125, 89, 255, 249, 157, 155, 255, 249, 88, 128, 255, 249, 158, 101, 255, 249, 124, 169, 255, 249, 103, 95, 255, 248, 169, 135, 255, 248, 92, 151, 255, 248, 139, 87, 255, 248, 148, 166, 255, 248, 87, 113, 255, 248, 168, 111, 255, 248, 109, 168, 255, 247, 115, 86, 255, 247, 167, 150, 255, 247, 84, 138, 255, 247, 154, 91, 255, 247, 134, 174, 255, 247, 92, 98, 255, 247, 175, 126, 255, 246, 94, 162, 255, 246, 130, 80, 255, 246, 159, 165, 255, 246, 80, 122, 255, 246, 168, 100, 255, 246, 117, 176, 255, 245, 103, 85, 255, 245, 176, 143, 255, 245, 82, 149, 255, 245, 148, 81, 255, 245, 146, 176, 255, 244, 82, 104, 255, 244, 178, 114, 255, 244, 100, 172, 255, 244, 119, 76, 255, 244, 170, 161, 255, 244, 74, 133, 255, 243, 165, 88, 255, 243, 128, 183, 255, 243, 91, 87, 255, 243, 183, 133, 255, 243, 84, 162, 255, 242, 138, 73, 255, 242, 158, 176, 255, 242, 73, 113, 255, 242, 179, 101, 255, 242, 108, 182, 255, 241, 106, 74, 255, 241, 181, 153, 255, 241, 72, 146, 255, 241, 158, 76, 255, 240, 141, 187, 255, 240, 79, 93, 255, 240, 188, 120, 255, 240, 89, 175, 255, 240, 125, 66, 255, 239, 172, 172, 255, 239, 66, 125, 255, 239, 176, 88, 255, 239, 120, 191, 255, 238, 92, 76, 255, 238, 191, 142, 255, 238, 72, 160, 255, 238, 148, 66, 255, 237, 156, 187, 255, 237, 67, 103, 255, 237, 190, 105, 255, 237, 97, 187, 255, 237, 111, 63, 255, 236, 185, 164, 255, 236, 61, 140, 255, 236, 170, 74, 255, 235, 134, 196, 255, 235, 77, 81, 255, 235, 197, 128, 255, 235, 77, 175, 255, 234, 134, 58, 255, 234, 171, 184, 255, 234, 58, 116, 255, 234, 188, 90, 255, 233, 109, 197, 255, 233, 95, 64, 255, 233, 196, 153, 255, 233, 61, 156, 255, 232, 159, 62, 255, 232, 150, 198, 255, 232, 64, 91, 255, 231, 201, 112, 255, 231, 85, 189, 255, 231, 118, 53, 255, 231, 186, 177, 255, 230, 52, 131, 255, 230, 182, 74, 255, 230, 125, 205, 255, 229, 78, 69, 255, 229, 205, 138, 255, 229, 64, 173, 255, 228, 145, 51, 255, 228, 167, 196, 255, 228, 52, 104, 255, 227, 200, 94, 255, 227, 97, 202, 255, 227, 101, 52, 255, 227, 200, 165, 255, 226, 49, 149, 255, 226, 172, 59, 255, 226, 142, 209, 255, 225, 63, 78, 255, 225, 211, 121, 255, 225, 72, 189, 255, 224, 128, 44, 255, 224, 185, 190, 255, 224, 44, 121, 255, 223, 195, 76, 255, 223, 113, 212, 255, 223, 82, 56, 255, 222, 211, 150, 255, 222, 51, 168, 255, 221, 158, 47, 255, 221, 161, 209, 255, 221, 49, 91, 255, 220, 212, 102, 255, 220, 84, 204, 255, 220, 109, 41, 255, 219, 201, 179, 255, 219, 39, 140, 255, 219, 186, 59, 255, 218, 132, 218, 255, 218, 64, 64, 255, 217, 219, 132, 255, 217, 58, 187, 255, 217, 140, 37, 255, 216, 181, 203, 255, 216, 38, 108, 255, 216, 208, 82, 255, 215, 100, 217, 255, 215, 89, 43, 255, 214, 215, 164, 255, 214, 39, 160, 255, 214, 172, 44, 255, 255, 128, 128, 0, }; #endregion ColorRGBA[] H2Palette = new ColorRGBA[256]; for (int x = 0; x < 256; x++) { int r = x * 4; H2Palette[x].r = H2PaletteBuffer[r]; H2Palette[x].g = H2PaletteBuffer[r + 1]; H2Palette[x].b = H2PaletteBuffer[r + 2]; H2Palette[x].a = H2PaletteBuffer[r + 3]; } return(H2Palette); }
public virtual void CopyVL(int x, int y, int len, ColorRGBA sourceColor) { linkedImage.CopyVL(x, y, len, sourceColor); }
public SubtractColor(ColorRGBA aColor) { fColor = aColor; }
public TextArea(int id, String text, String font, Vec2i position, Vec2i size, Texture parent, ColorRGBA color, int resetKey, int startKey, int sendKey) : base(id, position) { this.parent = parent; this.font = font; //Creation: Process process = Process.ThisProcess(); thisView = zCView.Create(Process.ThisProcess(), position.X, position.Y, position.X + size.X, position.Y + size.Y); thisView.SetFont(font); tA = new textArea(process, thisView, size.Y); tA.setText(text); tA.resetKey = resetKey; tA.startWritingKey = startKey; tA.sendKey = sendKey; tA.SendInput += new EventHandler <EventArgs>(tbSended); tA.Inputenabled = false; setColor(color); }
public static ColorRGBA PerformOperation(ColorRGBA dst, ColorRGBA aColor) { float red = Math.Max(0,dst.R - aColor.R); float green = Math.Max(0, dst.G - aColor.G); float blue = Math.Max(0, dst.B - aColor.B); ColorRGBA newColor = new ColorRGBA(red, green, blue, dst.A); return newColor; }
public void BlendPixels(byte[] pDestBuffer, int bufferOffset, ColorRGBA[] sourceColors, int sourceColorsOffset, byte[] sourceCovers, int sourceCoversOffset, bool firstCoverForAll, int count) { if (firstCoverForAll) { //unsafe { if (sourceCovers[sourceCoversOffset] == 255) { for (int i = 0; i < count; i++) { #if false BlendPixel(pDestBuffer, bufferOffset, sourceColors[sourceColorsOffset]); #else ColorRGBA sourceColor = sourceColors[sourceColorsOffset]; if (sourceColor.alpha == 255) { pDestBuffer[bufferOffset + CO.R] = (byte)sourceColor.red; pDestBuffer[bufferOffset + CO.G] = (byte)sourceColor.green; pDestBuffer[bufferOffset + CO.B] = (byte)sourceColor.blue; pDestBuffer[bufferOffset + CO.A] = 255; } else { int OneOverAlpha = BASE_MASK - sourceColor.alpha; unchecked { int r = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.R] * OneOverAlpha + 255) >> 8) + sourceColor.red]; int g = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.G] * OneOverAlpha + 255) >> 8) + sourceColor.green]; int b = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.B] * OneOverAlpha + 255) >> 8) + sourceColor.blue]; int a = pDestBuffer[bufferOffset + CO.A]; pDestBuffer[bufferOffset + CO.R] = (byte)r; pDestBuffer[bufferOffset + CO.G] = (byte)g; pDestBuffer[bufferOffset + CO.B] = (byte)b; pDestBuffer[bufferOffset + CO.A] = (byte)(BASE_MASK - m_Saturate9BitToByte[(OneOverAlpha * (BASE_MASK - a) + 255) >> 8]); } } #endif sourceColorsOffset++; bufferOffset += 4; } } else { for (int i = 0; i < count; i++) { ColorRGBA sourceColor = sourceColors[sourceColorsOffset]; int alpha = (sourceColor.alpha * sourceCovers[sourceCoversOffset] + 255) / 256; if (alpha == 0) { continue; } else if (alpha == 255) { pDestBuffer[bufferOffset + CO.R] = (byte)sourceColor.red; pDestBuffer[bufferOffset + CO.G] = (byte)sourceColor.green; pDestBuffer[bufferOffset + CO.B] = (byte)sourceColor.blue; pDestBuffer[bufferOffset + CO.A] = (byte)alpha; } else { int OneOverAlpha = BASE_MASK - alpha; unchecked { int r = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.R] * OneOverAlpha + 255) >> 8) + sourceColor.red]; int g = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.G] * OneOverAlpha + 255) >> 8) + sourceColor.green]; int b = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.B] * OneOverAlpha + 255) >> 8) + sourceColor.blue]; int a = pDestBuffer[bufferOffset + CO.A]; pDestBuffer[bufferOffset + CO.R] = (byte)r; pDestBuffer[bufferOffset + CO.G] = (byte)g; pDestBuffer[bufferOffset + CO.B] = (byte)b; pDestBuffer[bufferOffset + CO.A] = (byte)(BASE_MASK - m_Saturate9BitToByte[(OneOverAlpha * (BASE_MASK - a) + 255) >> 8]); } } sourceColorsOffset++; bufferOffset += 4; } } } } else { for (int i = 0; i < count; i++) { ColorRGBA sourceColor = sourceColors[sourceColorsOffset]; int alpha = (sourceColor.alpha * sourceCovers[sourceCoversOffset] + 255) / 256; if (alpha == 255) { pDestBuffer[bufferOffset + CO.R] = (byte)sourceColor.red; pDestBuffer[bufferOffset + CO.G] = (byte)sourceColor.green; pDestBuffer[bufferOffset + CO.B] = (byte)sourceColor.blue; pDestBuffer[bufferOffset + CO.A] = (byte)alpha; } else if (alpha > 0) { int OneOverAlpha = BASE_MASK - alpha; unchecked { int r = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.R] * OneOverAlpha + 255) >> 8) + sourceColor.red]; int g = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.G] * OneOverAlpha + 255) >> 8) + sourceColor.green]; int b = m_Saturate9BitToByte[((pDestBuffer[bufferOffset + CO.B] * OneOverAlpha + 255) >> 8) + sourceColor.blue]; int a = pDestBuffer[bufferOffset + CO.A]; pDestBuffer[bufferOffset + CO.R] = (byte)r; pDestBuffer[bufferOffset + CO.G] = (byte)g; pDestBuffer[bufferOffset + CO.B] = (byte)b; pDestBuffer[bufferOffset + CO.A] = (byte)(BASE_MASK - m_Saturate9BitToByte[(OneOverAlpha * (BASE_MASK - a) + 255) >> 8]); } } sourceColorsOffset++; sourceCoversOffset++; bufferOffset += 4; } } }
public ColorRGBA Transform(ColorRGBA dst) { dst.A = fAlpha; return dst; }
public ListText(int id, String text, List list, ColorRGBA aActiveRowColor, ColorRGBA aInactiveRowColor) : base(id, text, list, aActiveRowColor, aInactiveRowColor) { }
public ColorRGBA Transform(ColorRGBA dst) { return dst; }
protected override ColorRGBA TrimColor(ColorRGBA color) { return(ColorConversion.IA4ToColor(ColorConversion.ColorToIA4(color))); }
/// <summary>Creates a new instance of this structure.</summary> /// <param name="color">The base color.</param> /// <param name="alpha">The alpha component.</param> public ColorRGBA(ColorRGBA color, float alpha) { this.R = color.R; this.G = color.G; this.B = color.B; this.A = alpha; }
public virtual void SetColors(ColorRGBA ambient, ColorRGBA diffuse, ColorRGBA specular) { Ambient = ambient; Diffuse = diffuse; Specular = specular; }
public void ColorPointer(ColorRGBA[] pointer) { gl.glColorPointer(4, (int)ColorPointerType.Float, 0, pointer); CheckException(); }
public void SetDiffuse(ColorRGBA diffuse) { fDiffuse = diffuse; GI.Light(fLightName, LightParameter.Diffuse, (float[])fDiffuse); }
/// <summary>Creates a mesh consisting of the specified vertices, faces and color.</summary> /// <param name="Vertices">The vertices used.</param> /// <param name="FaceVertices">A list of faces represented by a list of references to vertices.</param> /// <param name="Color">The color to be applied on all of the faces.</param> internal Mesh(Vertex[] Vertices, int[][] FaceVertices, ColorRGBA Color) { this.Vertices = Vertices; this.Materials = new MeshMaterial[1]; this.Materials[0].Color = Color; this.Materials[0].DaytimeTextureIndex = -1; this.Materials[0].NighttimeTextureIndex = -1; this.Faces = new MeshFace[FaceVertices.Length]; for (int i = 0; i < FaceVertices.Length; i++) { this.Faces[i] = new MeshFace(FaceVertices[i]); } }
public Text3D(float aMaxDistance, ColorRGBA aDefaultColor, World aWorld, Types.Vec3f aPosition) : this(null, aWorld, aMaxDistance, aDefaultColor, 500, aPosition, true) { }
public virtual void SetAmbientDiffuse(ColorRGBA ambient, ColorRGBA diffuse) { Ambient = ambient; Diffuse = diffuse; }
public override void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_displayName = stream.ReadString32(); m_region = new BoardRegion(assetFile, stream); m_startingState = (State)stream.ReadInt32(); m_progressType = (ControlProgressType)stream.ReadInt32(); m_stayControlledUntilOtherTeamCaptures = stream.ReadBoolean(); stream.AlignTo(); m_resetProgressOnceCaptured = stream.ReadBoolean(); stream.AlignTo(); m_resetProgressOnceDisabled = stream.ReadBoolean(); stream.AlignTo(); m_progressNeededForTeamAToCapture = stream.ReadInt32(); m_maxTotalProgressForTeamA = stream.ReadInt32(); m_maxProgressForTeamAOnceControlled = stream.ReadInt32(); m_progressNeededForTeamBToCapture = stream.ReadInt32(); m_maxTotalProgressForTeamB = stream.ReadInt32(); m_maxProgressForTeamBOnceControlled = stream.ReadInt32(); m_maxProgressChangeInOneTurn = stream.ReadInt32(); m_progressDecayPerTurn = stream.ReadInt32(); m_numVacantTurnsUntilProgressDecays = stream.ReadInt32(); m_allowIndependentVacancyDecay = stream.ReadBoolean(); stream.AlignTo(); m_turnsLockedAfterCapture = stream.ReadInt32(); m_turnsLockedAfterActivated = stream.ReadInt32(); m_canContributeProgressWhileContested = stream.ReadBoolean(); stream.AlignTo(); m_startingProgress = stream.ReadInt32(); m_controllingTeamGameplay = new ControlPointGameplay(assetFile, stream); m_otherTeamGameplay = new ControlPointGameplay(assetFile, stream); m_totalObjectivePointsToDispense = stream.ReadInt32(); m_disableWhenDispensedLastObjectivePoint = stream.ReadBoolean(); stream.AlignTo(); m_controlPointsToActivateOnDisabled = new SerializedVector <SerializedGameObject>(assetFile, stream); m_numRandomControlPointsToActivate = stream.ReadInt32(); m_randomActivateTurnsLockedOverride = stream.ReadInt32(); m_randomActivateIgnoreIfEverActivated = stream.ReadBoolean(); stream.AlignTo(); m_visionGranting = (VisionGranting)stream.ReadInt32(); m_visionSeeThroughBrush = stream.ReadBoolean(); stream.AlignTo(); m_visionRegionOverride = new BoardRegion(assetFile, stream); m_whenToApplyHealing = (VisionGranting)stream.ReadInt32(); m_healPerTurn = stream.ReadInt32(); m_healHitSequencePrefab = new SerializedComponent(assetFile, stream); m_spawnForMatchingTeams = stream.ReadBoolean(); stream.AlignTo(); m_spawnersForController = new SerializedArray <SerializedGameObject>(assetFile, stream); m_autoGenerateBoundaryVisuals = stream.ReadBoolean(); stream.AlignTo(); m_boundaryOscillationSpeed = stream.ReadSingle(); m_boundaryOscillationHeight = stream.ReadSingle(); m_nameplateOverridePosition = new SerializedComponent(assetFile, stream); m_boundaryNeutral = new SerializedComponent(assetFile, stream); m_boundaryAllied = new SerializedComponent(assetFile, stream); m_boundaryEnemy = new SerializedComponent(assetFile, stream); m_boundaryDisabled = new SerializedComponent(assetFile, stream); m_primaryColor_friendly = stream.ReadColorRGBA(); m_primaryColor_hostile = stream.ReadColorRGBA(); m_primaryColor_neutral = stream.ReadColorRGBA(); m_secondaryColor_contested = stream.ReadColorRGBA(); m_secondaryColor_friendlyCapturing = stream.ReadColorRGBA(); m_secondaryColor_hostileCapturing = stream.ReadColorRGBA(); m_uiTextColor_Empty = stream.ReadColorRGBA(); m_uiTextColor_Locked = stream.ReadColorRGBA(); m_icon = new SerializedComponent(assetFile, stream); m_miniMapColorNeutral = stream.ReadColorRGBA(); m_miniMapColorAllied = stream.ReadColorRGBA(); m_miniMapColorEnemy = stream.ReadColorRGBA(); m_miniMapColorDisabled = stream.ReadColorRGBA(); m_miniMapImage = new SerializedComponent(assetFile, stream); m_currentMinimapColor = stream.ReadColorRGBA(); m_captureMessages = new SerializedArray <CaptureMessage>(assetFile, stream); }
public void SetAmbient(ColorRGBA ambient) { fAmbient = ambient; GI.Light(fLightName, LightParameter.Ambient, (float[])fAmbient); }
public static int ColorToInt(ColorRGBA rcs) { return((rcs.a << 24) | (rcs.r << 16) | (rcs.g << 8) | rcs.b); }
public void SetSpecular(ColorRGBA specular) { fSpecular = specular; GI.Light(fLightName, LightParameter.Specular, (float[])fSpecular); }
//Set the color of a pixel public static unsafe bool SetPixelColor(byte *bitmapData, int screenWidth, int screenHeight, int pixelHor, int pixelVer, ColorRGBA newColor) { try { //Check width and height if (pixelHor > screenWidth || pixelHor < 0) { return(false); } if (pixelVer > screenHeight || pixelVer < 0) { return(false); } //Capture error correction if (pixelHor == screenWidth) { pixelHor--; } if (pixelVer == 0) { pixelVer++; } //Get start of the pixel int PixelSize = 4; int Pixel = PixelSize * ((screenHeight - pixelVer) * screenWidth + pixelHor); //Set the color to pixel bitmapData[Pixel++] = newColor.B; bitmapData[Pixel++] = newColor.G; bitmapData[Pixel++] = newColor.R; bitmapData[Pixel] = newColor.A; return(true); } catch { Debug.WriteLine("Failed to set pixel color in bitmap data."); return(false); } }
public AmbientLight(GraphicsInterface gi, ColorRGBA color) :base(gi) { fColor = color; }
protected override ColorRGBA TrimColor(ColorRGBA color) { return(ColorConversion.RGB565ToColor(ColorConversion.ColorToRGB565(color))); }
public GLTriangle(float3 v1, float3 v2, float3 v3, ColorRGBA aColor) { fVertex1 = new GLVertex(v1, aColor); fVertex2 = new GLVertex(v1, aColor); fVertex3 = new GLVertex(v1, aColor); }
public ListTextBox(int id, String hardText, String text, List list, ColorRGBA aActiveRowColor, ColorRGBA aInactiveRowColor) : base(id, text, list, aActiveRowColor, aInactiveRowColor) { this.hardText = hardText; }