public void RenderTexture(RTexture texture, Math.Rectangle bounds, RColor color, Matrix matrix, bool font) { RViewport viewport = REngine.Instance._viewport; UpdateQuad(bounds); blendState.PlatformApplyState(); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); defaultShader.Bind(); defaultShader.SetSamplerValue(RTextureLayer.DIFFUSE, texture); vertexQuad2D.Bind(); vertexQuad2D.BindVertexArray(); indexQuad2D.Bind(); defaultShader.SetUniformValue("projection", camera2d.Projection); defaultShader.SetUniformValue("view", camera2d.View); defaultShader.SetUniformValue("diffuse_color", color.ToVector4()); defaultShader.SetUniformValue("model", matrix); defaultShader.SetUniformValue("font", font); vertexQuad2D.VertexDeclaration.Apply(defaultShader, IntPtr.Zero); GL.DrawElements(PrimitiveType.Triangles, indexQuad2D.IndexCount, DrawElementsType.UnsignedShort, IntPtr.Zero); REngine.CheckGLError(); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha); GL.Disable(EnableCap.Blend); indexQuad2D.Unbind(); vertexQuad2D.UnbindVertexArray(); vertexQuad2D.Unbind(); defaultShader.Unbind(); }
/// <summary> /// Get cached solid brush instance for the given color. /// </summary> /// <param name="color">the color to get brush for</param> /// <returns>brush instance</returns> public RBrush GetSolidBrush(RColor color) { RBrush brush; if (!_brushesCache.TryGetValue(color, out brush)) { _brushesCache[color] = brush = CreateSolidBrush(color); } return brush; }
public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl) { if (_useGdiPlusTextRendering) { ReleaseHdc(); SetRtlAlignGdiPlus(rtl); var brush = ((BrushAdapter)_adapter.GetSolidBrush(color)).Brush; _g.DrawString(str, ((FontAdapter)font).Font, brush, (int)(Math.Round(point.X) + (rtl ? size.Width : 0)), (int)Math.Round(point.Y), _stringFormat2); } else { #if !MONO var pointConv = Utils.ConvertRound(point); var colorConv = Utils.Convert(color); if (color.A == 255) { SetFont(font); SetTextColor(colorConv); SetRtlAlignGdi(rtl); Win32Utils.TextOut(_hdc, pointConv.X, pointConv.Y, str, str.Length); } else { InitHdc(); SetRtlAlignGdi(rtl); DrawTransparentText(_hdc, str, font, pointConv, Utils.ConvertRound(size), colorConv); } #endif } }
/// <summary> /// Get cached pen instance for the given color. /// </summary> /// <param name="color">the color to get pen for</param> /// <returns>pen instance</returns> public RPen GetPen(RColor color) { RPen pen; if (!_penCache.TryGetValue(color, out pen)) { _penCache[color] = pen = CreatePen(color); } return pen; }
/// <summary> /// Parses a color value in CSS style; e.g. #ff0000, RED, RGB(255,0,0), RGB(100%, 0, 0) /// </summary> /// <param name="str">color substring value to parse</param> /// <param name="idx">substring start idx </param> /// <param name="length">substring length</param> /// <param name="color">return the parsed color</param> /// <returns>true - valid color, false - otherwise</returns> public bool TryGetColor(string str, int idx, int length, out RColor color) { try { if (!string.IsNullOrEmpty(str)) { if (length > 1 && str[idx] == '#') { return(GetColorByHex(str, idx, length, out color)); } else if (length > 10 && CommonUtils.SubStringEquals(str, idx, 4, "rgb(") && str[length - 1] == ')') { return(GetColorByRgb(str, idx, length, out color)); } else if (length > 13 && CommonUtils.SubStringEquals(str, idx, 5, "rgba(") && str[length - 1] == ')') { return(GetColorByRgba(str, idx, length, out color)); } else { return(GetColorByName(str, idx, length, out color)); } } } catch { } color = RColor.Black; return(false); }
/// <summary> /// Draw the given string using the given font and foreground color at given location. /// </summary> /// <param name="str">the string to draw</param> /// <param name="font">the font to use to draw the string</param> /// <param name="color">the text color to set</param> /// <param name="point">the location to start string draw (top-left)</param> /// <param name="size">used to know the size of the rendered text for transparent text support</param> /// <param name="rtl">is to render the string right-to-left (true - RTL, false - LTR)</param> public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl) { var textSurface = SDL_ttf.TTF_RenderUTF8_Blended(font.ToTTF_Font(), str, color.ToSDL()); if (textSurface.ShowSDLError("Graphics.DrawString: Unable to TTF_RenderUTF8_Blended!")) { return; } var texture_text = SDL.SDL_CreateTextureFromSurface(_renderer, textSurface); if (texture_text.ShowSDLError("Graphics.DrawString: Unable to CreateTextureFromSurface!")) { SDL.SDL_FreeSurface(textSurface); return; } var dst_rect = textSurface.As <SDL.SDL_Surface>().ToSDL_Rect().UpdatedByRPoint(point); if (SDL.SDL_RenderCopy(_renderer, texture_text, IntPtr.Zero, ref dst_rect) < 0) { Helpers.ShowSDLError("Graphics.DrawString:Unable to SDL_RenderCopy!"); } SDL.SDL_DestroyTexture(texture_text); SDL.SDL_FreeSurface(textSurface); }
public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl) { var pointConv = Utils.ConvertRound(point); var colorConv = Utils.Convert(color); if (color.A == 255) { // if (GloablRenderSettings.UseBus) // { _g.DrawString(str, font, new BrushAdapter(new SKPaint { Style = SKPaintStyle.Fill, Color = colorConv }, false), pointConv.X, pointConv.Y, StringFormat.GenericTypographic); // } // else // { // SetFont(font); // SetTextColor(colorConv); // SkRendererAdapter.TextOut(_hdc, pointConv.X, pointConv.Y, str, str.Length); // } } }
//============================================================ // <T>存储设置信息</T> // // @param xconfig 设置信息 //============================================================ public override void OnSaveConfig(FXmlNode xconfig) { base.OnSaveConfig(xconfig); // 存储配置 xconfig.SetNvl("option_visible", _optionVisible); xconfig.SetNvl("option_enable", _optionEnable); // 保存属性 if (_dockCd != ERcDock.None) { xconfig.SetNvl("dock_cd", REnum.ToString(typeof(ERcDock), _dockCd)); } // 存储位置 if (!_location.IsEmpty()) { xconfig.Set("location", _location.ToString()); } // 存储尺寸 if (!_size.IsEmpty()) { xconfig.SetNvl("size", _size.ToString()); } // 加载空白 if (!_margin.IsEmpty()) { xconfig.SetNvl("margin", _margin.ToString()); } if (!_padding.IsEmpty()) { xconfig.SetNvl("padding", _padding.ToString()); } // 存储边框 if (_propertyBorderInner == null || (_propertyBorderInner != null && !_borderInner.EqualsStyleProperty(_propertyBorderInner))) { _borderInner.SaveConfig(xconfig, "border_inner"); } if (_propertyBorderOuter == null || (_propertyBorderOuter != null && !_borderOuter.EqualsStyleProperty(_propertyBorderOuter))) { _borderOuter.SaveConfig(xconfig, "border_outer"); } // 保存前景资源 if ((_propertyForeColor == null) || (_propertyForeColor != null && _foreColor != _propertyForeColor.GetHex())) { xconfig.Set("fore_color", RColor.FormatHtml(_foreColor)); } _foreResource.SaveConfig(xconfig, "fore"); // 保存后景资源 if ((_propertyBackColor == null) || (_propertyBackColor != null && _backColor != _propertyBackColor.GetHex())) { xconfig.Set("back_color", RColor.FormatHtml(_backColor)); } _backResource.SaveConfig(xconfig, "back"); // 存储事件 xconfig.SetNvl("on_click", _onClick); xconfig.SetNvl("on_double_click", _onDoubleClick); xconfig.SetNvl("on_mouse_down", _onMouseDown); xconfig.SetNvl("on_mouse_up", _onMouseUp); xconfig.SetNvl("on_mouse_enter", _onMouseEnter); xconfig.SetNvl("on_mouse_move", _onMouseMove); xconfig.SetNvl("on_mouse_leave", _onMouseLeave); }
public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl) { var text = GetText(str, font); text.Constraint = Util.Convert(size); _g.DrawText(new SolidColorBrush(Util.Convert(color)), Util.Convert(point), text); }
/// <summary> /// Get color by parsing given RGB value color string (RGB(255,180,90)) /// </summary> /// <returns>true - valid color, false - otherwise</returns> private static bool GetColorByRgb(string str, int idx, int length, out RColor color) { var r = -1; var g = -1; var b = -1; if (length > 10) { var s = idx + 4; r = ParseIntAtIndex(str, ref s); if (s < idx + length) { g = ParseIntAtIndex(str, ref s); } if (s < idx + length) { b = ParseIntAtIndex(str, ref s); } } if (r > -1 && g > -1 && b > -1) { color = RColor.FromArgb(r, g, b); return(true); } color = RColor.Empty; return(false); }
/// <summary> /// Get color by parsing given hex value color string (#A28B34). /// </summary> /// <returns>true - valid color, false - otherwise</returns> private static bool GetColorByHex(string str, int idx, int length, out RColor color) { int r = -1; int g = -1; int b = -1; if (length == 7) { r = ParseHexInt(str, idx + 1, 2); g = ParseHexInt(str, idx + 3, 2); b = ParseHexInt(str, idx + 5, 2); } else if (length == 4) { r = ParseHexInt(str, idx + 1, 1); r = r * 16 + r; g = ParseHexInt(str, idx + 2, 1); g = g * 16 + g; b = ParseHexInt(str, idx + 3, 1); b = b * 16 + b; } if (r > -1 && g > -1 && b > -1) { color = RColor.FromArgb(r, g, b); return(true); } color = RColor.Empty; return(false); }
/// <summary> /// Get color by parsing given RGBA value color string (RGBA(255,180,90,180)) /// </summary> /// <returns>true - valid color, false - otherwise</returns> private static bool GetColorByRgba(string str, int idx, int length, out RColor color) { int r = -1; int g = -1; int b = -1; int a = -1; if (length > 13) { int s = idx + 5; r = ParseIntAtIndex(str, ref s); if (s < idx + length) { g = ParseIntAtIndex(str, ref s); } if (s < idx + length) { b = ParseIntAtIndex(str, ref s); } if (s < idx + length) { a = ParseIntAtIndex(str, ref s); } } if (r > -1 && g > -1 && b > -1 && a > -1) { color = RColor.FromArgb(a, r, g, b); return(true); } color = RColor.Empty; return(false); }
public void RenderText(RFont font, Vector2 penPoint, string text, RColor color) { blendState.PlatformApplyState(); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Disable(EnableCap.CullFace); defaultShader.Bind(); defaultShader.SetSamplerValue(RTextureLayer.DIFFUSE, font.Texture); defaultShader.SetUniformValue("projection", camera2d.Projection); defaultShader.SetUniformValue("view", camera2d.View); defaultShader.SetUniformValue("diffuse_color", color.ToVector4()); defaultShader.SetUniformValue("model", Matrix.Identity); font.Render(ref defaultShader, ref vertexQuad2D, ref indexQuad2D, text, penPoint, color, Matrix.Identity); REngine.CheckGLError(); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha); GL.Disable(EnableCap.Blend); defaultShader.Unbind(); /*text = text.Replace("\r\n", "\n"); * char lastChar = '\0'; * Vector2 originalPoint = penPoint; * foreach(char c in text) * { * if(c == ' ') * { * penPoint.X += font.Kerning(lastChar, c).X+font.SpaceWidth; * lastChar = ' '; * continue; * } * if(c == '\t') * { * penPoint.X += (font.Kerning(lastChar, c).X+(font.SpaceWidth * 2)); * continue; * } * if(c == '\r' || c=='\n') * { * penPoint.Y += font.LineHeight + (font.font.Height>>6); * penPoint.X = originalPoint.X+font.Kerning(lastChar, c).X; * continue; * } * penPoint.X += font.Kerning(lastChar, c).X; * RTextureGlyph glyph = font.GetGlyph(c); * int x0 = (int)(penPoint.X + (glyph.bitmapLeft)); * int y0 = (int)(penPoint.Y - (glyph.bitmapTop)); * //penPoint.X += glyph.Offset.X; * * RenderTexture(glyph, new Rectangle(x0, y0, (int)glyph.Bounds.Width, (int)glyph.Bounds.Height), color, Matrix.Identity, true); * penPoint.X += glyph.advance.X; * lastChar = c; * } * //font.RenderText(defaultShader, text, penPoint.X, penPoint.Y, size, size); */ }
public void fromColorTest() { Color c = Color.Red; // TODO: Initialize to an appropriate value RColor expected = new RColor(255,0,0,255); // TODO: Initialize to an appropriate value RColor actual; actual = RColor.fromColor(c); Assert.AreEqual(expected, actual); }
/// <summary> /// Get cached pen instance for the given color. /// </summary> /// <param name="color">the color to get pen for</param> /// <returns>pen instance</returns> public RPen GetPen(RColor color) { if (!_penCache.TryGetValue(color, out var pen)) { _penCache[color] = pen = CreatePen(color); } return(pen); }
public void toColorTest() { RColor target = new RColor(0,128,0,255); // TODO: Initialize to an appropriate value Color expected = Color.FromArgb(0,128,0,255); // TODO: Initialize to an appropriate value Color actual; actual = target.toColor(); Assert.AreEqual(expected, actual); }
protected override RPen CreatePen(RColor color) { return(new PenAdapter(new SKPaint { Style = SKPaintStyle.Stroke, Color = Utils.Convert(color) })); }
//============================================================ // <T>获得字符串内容。</T> // // @return 字符串内容 //============================================================ public override string ToString() { string resule = ""; resule += RColor.FormatHtml(_color); resule += "," + _width; resule += "," + _style.ToString(); return(resule); }
public void SetUniformBySemantic(RShaderSemanticDefinition semantic, RColor value) { if (_semantics.ContainsKey(semantic)) { if (_semantics[semantic].type == "vec4") { SetUniformValue(_semantics[semantic].name, value); } } }
/// <summary> /// Get cached pen instance for the given color. /// </summary> /// <param name="color">the color to get pen for</param> /// <returns>pen instance</returns> public RPen GetPen(RColor color) { RPen pen; if (!this._penCache.TryGetValue(color, out pen)) { this._penCache[color] = pen = this.CreatePen(color); } return(pen); }
//============================================================ // <T>保存资源。</T> //============================================================ public void SaveResource() { _font.FontName = cboFontName.Text; _font.Color = RColor.ParseHex(txtColor.Text); _font.Size = RInt.Parse(txtSize.Text); _font.Bold = chkBold.Checked; _font.Italic = chkItalic.Checked; _font.Underline = chkUnderline.Checked; _font.Strikeout = chkStrikeout.Checked; }
/// <summary> /// Get cached solid brush instance for the given color. /// </summary> /// <param name="color">the color to get brush for</param> /// <returns>brush instance</returns> public RBrush GetSolidBrush(RColor color) { RBrush brush; if (!this._brushesCache.TryGetValue(color, out brush)) { this._brushesCache[color] = brush = this.CreateSolidBrush(color); } return(brush); }
/// <summary> /// Draw video title on top of the iframe if found. /// </summary> private void DrawTitle(RGraphics g, RRect rect) { if (_videoTitle != null && _imageWord.Width > 40 && _imageWord.Height > 40) { var font = HtmlContainer.Adapter.GetFont("Arial", 9f, RFontStyle.Regular); g.DrawRectangle(g.GetSolidBrush(RColor.FromArgb(160, 0, 0, 0)), rect.Left, rect.Top, rect.Width, ActualFont.Height + 7); var titleRect = new RRect(rect.Left + 3, rect.Top + 3, rect.Width - 6, rect.Height - 6); g.DrawString(_videoTitle, font, RColor.WhiteSmoke, titleRect.Location, RSize.Empty, false); } }
public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl) { var colorConv = ((BrushAdapter)_adapter.GetSolidBrush(color)).Brush; bool glyphRendered = false; GlyphTypeface glyphTypeface = ((FontAdapter)font).GlyphTypeface; if (glyphTypeface != null) { double width = 0; ushort[] glyphs = new ushort[str.Length]; double[] widths = new double[str.Length]; int i = 0; for (; i < str.Length; i++) { ushort glyph; if (!glyphTypeface.CharacterToGlyphMap.TryGetValue(str[i], out glyph)) { break; } glyphs[i] = glyph; width += glyphTypeface.AdvanceWidths[glyph]; widths[i] = 96d / 72d * font.Size * glyphTypeface.AdvanceWidths[glyph]; } if (i >= str.Length) { point.Y += glyphTypeface.Baseline * font.Size * 96d / 72d; point.X += rtl ? 96d / 72d * font.Size * width : 0; glyphRendered = true; var wpfPoint = Utils.ConvertRound(point); var glyphRun = new GlyphRun(glyphTypeface, rtl ? 1 : 0, false, 96d / 72d * font.Size, glyphs, wpfPoint, widths, null, null, null, null, null, null); var guidelines = new GuidelineSet(); guidelines.GuidelinesX.Add(wpfPoint.X); guidelines.GuidelinesY.Add(wpfPoint.Y); _g.PushGuidelineSet(guidelines); _g.DrawGlyphRun(colorConv, glyphRun); _g.Pop(); } } if (!glyphRendered) { var formattedText = new FormattedText(str, CultureInfo.CurrentCulture, rtl ? FlowDirection.RightToLeft : FlowDirection.LeftToRight, ((FontAdapter)font).Font, 96d / 72d * font.Size, colorConv); point.X += rtl ? formattedText.Width : 0; _g.DrawText(formattedText, Utils.ConvertRound(point)); } }
//============================================================ // <T>加载资源。</T> // // @param resource 资源 //============================================================ public void LoadResource(FRcFont font) { _font = font; cboFontName.Text = _font.FontName; txtColor.Text = RColor.FormatHtml(_font.Color); txtSize.Text = _font.Size.ToString(); chkBold.Checked = _font.Bold; chkItalic.Checked = _font.Italic; chkUnderline.Checked = _font.Underline; chkStrikeout.Checked = _font.Strikeout; }
public void sampleTest() { int width = 4; // TODO: Initialize to an appropriate value int height = 4; // TODO: Initialize to an appropriate value PRegion target = new PRegion(width, height); // TODO: Initialize to an appropriate value Color v = new RColor(1,10,100,200).toColor(); // TODO: Initialize to an appropriate value int c = 0; // TODO: Initialize to an appropriate value int r = 0; // TODO: Initialize to an appropriate value target.sample(v, c, r); Assert.AreEqual(target.Pixels[c, r].toColor(), v); }
protected override RBrush CreateLinearGradientBrush(RRect rect, RColor color1, RColor color2, double angle) { var startColor = angle <= 180 ? Utils.Convert(color1) : Utils.Convert(color2); var endColor = angle <= 180 ? Utils.Convert(color2) : Utils.Convert(color1); angle = angle <= 180 ? angle : angle - 180; double x = angle < 135 ? Math.Max((angle - 45) / 90, 0) : 1; double y = angle <= 45 ? Math.Max(0.5 - angle / 90, 0) : angle > 135 ? Math.Abs(1.5 - angle / 90) : 0; return(new BrushAdapter(new LinearGradientBrush(startColor, endColor, new Point(x, y), new Point(1 - x, 1 - y)))); }
/** * @brief Class instance constructor * @param none * @retval none */ public TriangleMesh() { normal1 = new Vector3(); normal2 = new Vector3(); normal3 = new Vector3(); vert1 = new Vector3(); vert2 = new Vector3(); vert3 = new Vector3(); col1 = new RColor(); col2 = new RColor(); col3 = new RColor(); }
//============================================================ // <T>获得字符串内容。</T> // // @return 字符串内容 //============================================================ public override string ToString() { string result = (_fontName == "" || _fontName == null) ? "None" : _fontName; result += "," + RColor.FormatHtml(_color); result += "," + _size; result += "," + _bold; result += "," + _italic; result += "," + _strikeout; result += "," + _underline; return(result); }
public void RColorConstructorTest() { byte r = 0; // TODO: Initialize to an appropriate value byte g = 0; // TODO: Initialize to an appropriate value byte b = 0; // TODO: Initialize to an appropriate value byte a = 0; // TODO: Initialize to an appropriate value RColor target = new RColor(r, g, b, a); Assert.AreEqual(r, target.red); Assert.AreEqual(g, target.green); Assert.AreEqual(b, target.blue); Assert.AreEqual(a, target.alpha); }
internal RMaterial(string name) { Name = name; Textures = new RTexture[MAX_MATERIAL_LAYERS]; for (int i = 0; i < Textures.Length; i++) { Textures[i] = RTexture.defaultWhite; } Colors = new RColor[MAX_MATERIAL_COLOR_LAYERS]; Shininess = 1; SpecularPower = 1; Shader = RShader.basicShader; }
private static void Drawing_OnDraw(EventArgs args) { if (Me.IsDead) { return; } if (DrawMenu.GetCheckBoxValue("drawReady")) { if (QColor.BoolValue && Q.IsReady()) { Q.DrawSpell(QColor.GetColor()); } if (WColor.BoolValue && W.IsReady()) { W.DrawSpell(WColor.GetColor()); } if (EColor.BoolValue && E.IsReady()) { E.DrawSpell(EColor.GetColor()); } if (RColor.BoolValue && R.IsReady()) { R.DrawSpell(RColor.GetColor()); } } else { if (QColor.BoolValue) { Q.DrawSpell(Q.IsReady() ? QColor.GetColor() : Color.Red); } if (WColor.BoolValue) { W.DrawSpell(W.IsReady() ? WColor.GetColor() : Color.Red); } if (EColor.BoolValue) { E.DrawSpell(E.IsReady() ? EColor.GetColor() : Color.Red); } if (RColor.BoolValue) { R.DrawSpell(R.IsReady() ? RColor.GetColor() : Color.Red); } } }
//============================================================ // <T>解析字符串。</T> // // @param value 字符串 //============================================================ public bool Parse(string value) { if (RString.IsEmpty(value)) { return(false); } string[] items = value.Split(','); if (items.Length == 3) { _color = RColor.ParseHex(items[0]); _width = RInt.Parse(items[1]); _style = RUiLineStyle.Parse(items[2]); } return(false); }
//============================================================ // <T>序列化内容到输出流。</T> // // @param output 输出流 //============================================================ public override void OnSerialize(IOutput output) { base.OnSerialize(output); // 存储位置 output.WriteInt8((sbyte)_dockCd); _location.Serialize16(output); _size.Serialize16(output); // 存储边距 if (!_margin.IsEmpty()) { _margin.Serialize8(output); } if (!_padding.IsEmpty()) { _padding.Serialize8(output); } // 存储边框 if (!_borderOuter.IsEmpty()) { _borderOuter.Serialize(output); } if (!_borderInner.IsEmpty()) { _borderInner.Serialize(output); } // 存储前景 output.WriteInt32(RColor.ConvertRevert(_foreColor)); if (_foreResource.IsValid()) { _foreResource.Serialize(output); } // 存储后景 output.WriteInt32(RColor.ConvertRevert(_backColor)); if (_backResource.IsValid()) { _backResource.Serialize(output); } // 存储事件 //output.WriteString(_onClick); //output.WriteString(_onDoubleClick); //output.WriteString(_onMouseEnter); //output.WriteString(_onMouseLeave); //output.WriteString(_onMouseDown); //output.WriteString(_onMouseMove); //output.WriteString(_onMouseUp); }
/// <summary> /// Update a single color /// </summary> /// <param name="v">Color value</param> /// <param name="c">Column</param> /// <param name="r">Row</param> public void sample(RColor v, int c, int r) { this.Pixels[c, r] = v; }
public static void SetColor(RColor c) { m_currentColor = c; }
public static void MultiplyColor(RColor c) { m_currentColor.r *= c.r; m_currentColor.g *= c.g; m_currentColor.b *= c.b; m_currentColor.a *= c.a; }
public void sampleTest2() { int width = 3; // TODO: Initialize to an appropriate value int height = 3; // TODO: Initialize to an appropriate value PRegion target = new PRegion(width, height); // TODO: Initialize to an appropriate value int c = 0; // TODO: Initialize to an appropriate value int r = 0; // TODO: Initialize to an appropriate value RColor expected = new RColor(5,10,15,20); // TODO: Initialize to an appropriate value target.sample(expected, c, r); RColor actual; actual = target.sample(c, r); Assert.AreEqual(expected, actual); }
public void sampleTest1() { int width = 3; // TODO: Initialize to an appropriate value int height = 3; // TODO: Initialize to an appropriate value PRegion target = new PRegion(width, height); // TODO: Initialize to an appropriate value RColor v = new RColor(128,25,4,10); // TODO: Initialize to an appropriate value int c = 0; // TODO: Initialize to an appropriate value int r = 0; // TODO: Initialize to an appropriate value target.sample(v, c, r); Assert.AreEqual(target.sample(c, r), v); }
public static void SetColor(RColor r) { }