internal static string ToRgbString(Drawing.Color color) { return($"R {color.R} G {color.G} B {color.B}"); }
public SecretArea() { Color = new Drawing.Color(0, .8f, 0, 0.8f); }
//------------------------------------------------------------------------------- public void FillTriangleStrip(Drawing.Color color, float[] coords, int n) { basicFillShader.FillTriangleStripWithVertexBuffer(coords, n, color); }
public void SetColor(Drawing.Color c1, Drawing.Color c2, Drawing.Color c3) { m_coord_0.color = c1; m_coord_1.color = c2; m_coord_2.color = c3; }
public AmbientSound() { Sprite = SpriteManager.CreateFromImage("images/engine/editor/ambientsound.png"); Sprite.Action = "default"; Color = new Drawing.Color(0, 0, 0.8f, 0.8f); }
public ImgSpanGenRGBA_BilinearClip(Drawing.Color back_color) { BackgroundColor = back_color; }
/// <summary> /// Draw a rectangle on chart. /// </summary> /// <param name="sender">Source Chart.</param> /// <param name="x">XAxis value</param> /// <param name="y">YAxis value</param> /// <param name="width">rectangle width using XAis value.</param> /// <param name="height">rectangle height using YAis value.</param> /// <param name="lineColor">Outline color.</param> /// <param name="name">Annotation name.</param> /// <param name="lineWidth">Line width</param> /// <param name="lineStyle">Line style</param> public static void DrawRectangle(this Chart sender, double x, double y, double width, double height, Drawing.Color lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid) { RectangleAnnotation rect = new RectangleAnnotation(); string chartAreaName = sender.ChartAreas[0].Name; rect.ClipToChartArea = chartAreaName; rect.AxisXName = chartAreaName + "\\rX"; rect.YAxisName = chartAreaName + "\\rY"; rect.BackColor = Drawing.Color.Transparent; rect.ForeColor = Drawing.Color.Transparent; rect.IsSizeAlwaysRelative = false; rect.LineColor = lineColor; rect.LineWidth = lineWidth; rect.LineDashStyle = lineStyle; //Limit rectangle within chart area Axis ptrAxis = sender.ChartAreas[0].AxisX; if (x < ptrAxis.Minimum) { width = width - (ptrAxis.Minimum - x); x = ptrAxis.Minimum; } else if (x > ptrAxis.Maximum) { width = width - (x - ptrAxis.Maximum); x = ptrAxis.Maximum; } if ((x + width) > ptrAxis.Maximum) { width = ptrAxis.Maximum - x; } ptrAxis = sender.ChartAreas[0].AxisY; if (y < ptrAxis.Minimum) { height = height - (ptrAxis.Minimum - y); y = ptrAxis.Minimum; } else if (y > ptrAxis.Maximum) { height = height - (y - ptrAxis.Maximum); y = ptrAxis.Maximum; } if ((y + height) > ptrAxis.Maximum) { height = ptrAxis.Maximum - y; } rect.X = x; rect.Y = y; rect.Width = width; rect.Height = height; rect.LineColor = lineColor; sender.Annotations.Add(rect); if (!string.IsNullOrEmpty(name)) { rect.Name = name; } }
public void FillTriangles(MultiPartTessResult multipartTessResult, int index, Drawing.Color color) { SetCurrent(); CheckViewMatrix(); //-------------------------------------------- u_solidColor.SetValue((float)color.R / 255f, (float)color.G / 255f, (float)color.B / 255f, (float)color.A / 255f); //-------------------------------------------- //note (A): //from https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glVertexAttribPointer.xml //... If a non-zero named buffer object is bound to the GL_ARRAY_BUFFER target (see glBindBuffer) //while a generic vertex attribute array is specified, //pointer is treated as **a byte offset** into the buffer object's data store. VertexBufferObject vbo = multipartTessResult.GetVBO(); int subPathCount = multipartTessResult.PartCount; vbo.Bind(); PartRange p = multipartTessResult.GetPartRange(index); a_position.LoadLatest(p.beginVertexAt * 4); //*4 => see note (A) above, so offset => beginVertexAt * sizeof(float) GL.DrawElements(BeginMode.Triangles, p.elemCount, DrawElementsType.UnsignedShort, p.beginElemIndexAt * 2); //*2 => see note (A) above, so offset=> beginElemIndexAt *sizeof(ushort) vbo.UnBind(); }
public unsafe void DrawLineLoopWithVertexBuffer(float *polygon2dVertices, int nelements, Drawing.Color color) { SetCurrent(); CheckViewMatrix(); //-------------------------------------------- u_solidColor.SetValue((float)color.R / 255f, (float)color.G / 255f, (float)color.B / 255f, (float)color.A / 255f); a_position.UnsafeLoadPureV2f(polygon2dVertices); GL.DrawArrays(BeginMode.LineLoop, 0, nelements); }
public override void Draw(PixelFarm.Drawing.Painter p) { //specific for agg if (!(p is AggPainter)) { return; } AggPainter p2 = (AggPainter)p; AggRenderSurface asx = p2.RenderSurface; if (asx.DestBitmapBlender != null) { IBitmapBlender backBuffer = asx.DestBitmapBlender; //use different pixel blender var redImageBuffer = new SubBitmapBlender(backBuffer, new PixelBlenderGrey()); var greenImageBuffer = new SubBitmapBlender(backBuffer, new PixelBlenderGrey()); var blueImageBuffer = new SubBitmapBlender(backBuffer, new PixelBlenderGrey()); ClipProxyImage clippingProxy = new ClipProxyImage(backBuffer); ClipProxyImage clippingProxyRed = new ClipProxyImage(redImageBuffer); ClipProxyImage clippingProxyGreen = new ClipProxyImage(greenImageBuffer); ClipProxyImage clippingProxyBlue = new ClipProxyImage(blueImageBuffer); // ScanlineRasterizer sclineRas = asx.ScanlineRasterizer; ScanlinePacked8 scline = asx.ScanlinePacked8; Drawing.Color clearColor = this.UseBlackBlackground ? Drawing.Color.FromArgb(0, 0, 0) : Drawing.Color.FromArgb(255, 255, 255); clippingProxy.Clear(clearColor); Drawing.Color fillColor = this.UseBlackBlackground ? new Drawing.Color((byte)(this.AlphaValue), 255, 255, 255) : new Drawing.Color((byte)(this.AlphaValue), 0, 0, 0); DestBitmapRasterizer bmpRas = asx.BitmapRasterizer; using (Tools.BorrowEllipse(out var ellipse)) using (Tools.BorrowVxs(out var v1)) { ellipse.Set(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); sclineRas.AddPath(ellipse.MakeVxs(v1)); v1.Clear();//** bmpRas.RenderWithColor(clippingProxyRed, sclineRas, scline, fillColor); //// ellipse.Set(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); sclineRas.AddPath(ellipse.MakeVxs(v1)); v1.Clear();//*** bmpRas.RenderWithColor(clippingProxyGreen, sclineRas, scline, fillColor); // ellipse.Set(Width / 2, Height / 2 + 50, 100, 100, 100); sclineRas.AddPath(ellipse.MakeVxs(v1)); v1.Clear(); //*** bmpRas.RenderWithColor(clippingProxyBlue, sclineRas, scline, fillColor); } } // else if (graphics2D.DestImageFloat != null) // { //#if false // IImageFloat backBuffer = graphics2D.DestImageFloat; // int distBetween = backBuffer.GetFloatsBetweenPixelsInclusive(); // ImageBufferFloat redImageBuffer = new ImageBufferFloat(); // redImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 2, 8); // ImageBufferFloat greenImageBuffer = new ImageBufferFloat(); // greenImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 1, 8); // ImageBufferFloat blueImageBuffer = new ImageBufferFloat(); // blueImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 0, 8); // ImageClippingProxy clippingProxy = new ImageClippingProxy(backBuffer); // ImageClippingProxy clippingProxyRed = new ImageClippingProxy(redImageBuffer); // ImageClippingProxy clippingProxyGreen = new ImageClippingProxy(greenImageBuffer); // ImageClippingProxy clippingProxyBlue = new ImageClippingProxy(blueImageBuffer); // ScanlineRasterizer ras = new ScanlineRasterizer(); // ScanlineCachePacked8 sl = new ScanlineCachePacked8(); // RGBA_Bytes clearColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(0, 0, 0) : new RGBA_Bytes(255, 255, 255); // clippingProxy.clear(clearColor); // alphaSlider.View.BackGroundColor = clearColor; // RGBA_Bytes FillColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(255, 255, 255, (int)(alphaSlider.Value)) : new RGBA_Bytes(0, 0, 0, (int)(alphaSlider.Value)); // VertexSource.Ellipse er = new AGG.VertexSource.Ellipse(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); // ras.add_path(er); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyRed, ras, sl, FillColor); // VertexSource.Ellipse eg = new AGG.VertexSource.Ellipse(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); // ras.add_path(eg); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyGreen, ras, sl, FillColor); // VertexSource.Ellipse eb = new AGG.VertexSource.Ellipse(Width / 2, Height / 2 + 50, 100, 100, 100); // ras.add_path(eb); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyBlue, ras, sl, FillColor); //#endif // } }
public ImgSpanGenRGBA_BilinearClip(Drawing.Color back_color) { _bgcolor = back_color; }
public void FillGfxPath(Drawing.Color color, InternalGraphicsPath igpth) { switch (SmoothMode) { case SmoothMode.No: { int subPathCount = igpth.FigCount; for (int i = 0; i < subPathCount; ++i) { Figure f = igpth.GetFig(i); if (f.SupportVertexBuffer) { basicFillShader.FillTriangles( f.GetAreaTessAsVBO(tessTool), f.TessAreaVertexCount, color); } else { float[] tessArea = f.GetAreaTess(this.tessTool); if (tessArea != null) { this.basicFillShader.FillTriangles(tessArea, f.TessAreaVertexCount, color); } } } } break; case SmoothMode.Smooth: { int subPathCount = igpth.FigCount; float saved_Width = StrokeWidth; Drawing.Color saved_Color = StrokeColor; //temp set stroke width to 2 amd stroke color //to the same as bg color (for smooth border). //and it will be set back later. // StrokeColor = color; StrokeWidth = 1.5f; //TODO: review this *** // float[] tessArea; for (int i = 0; i < subPathCount; ++i) { //draw each sub-path Figure f = igpth.GetFig(i); if (f.SupportVertexBuffer) { //TODO: review here again //draw area basicFillShader.FillTriangles( f.GetAreaTessAsVBO(tessTool), f.TessAreaVertexCount, color); //draw smooth border smoothLineShader.DrawTriangleStrips( f.GetSmoothBorders(smoothBorderBuilder), f.BorderTriangleStripCount); } else { if ((tessArea = f.GetAreaTess(this.tessTool)) != null) { //draw area basicFillShader.FillTriangles(tessArea, f.TessAreaVertexCount, color); //draw smooth border smoothLineShader.DrawTriangleStrips( f.GetSmoothBorders(smoothBorderBuilder), f.BorderTriangleStripCount); } } } //restore stroke width and color StrokeWidth = saved_Width; //restore back StrokeColor = saved_Color; } break; } }
public void DrawRenderVx(Drawing.Color color, Drawing.RenderVx renderVx) { GLRenderVx glRenderVx = (GLRenderVx)renderVx; DrawGfxPath(color, glRenderVx.gxpth); }
public void FillRenderVx(Drawing.Color color, MultiPartTessResult multiPartTessResult, int index) { FillGfxPath(color, multiPartTessResult, index); }
ActualImage GetTransformedBilinearInterpolation() { //4 points sampling //weight between four point ActualImage destCB = new ActualImage(rect.Width, rect.Height, PixelFormat.ARGB32); MyImageReaderWriter destWriter = new MyImageReaderWriter(); destWriter.ReloadImage(destCB); PointF ptInPlane = new PointF(); int x1, x2, y1, y2; double dab, dbc, dcd, dda; float dx1, dx2, dy1, dy2, dx1y1, dx1y2, dx2y1, dx2y2; int rectWidth = rect.Width; int rectHeight = rect.Height; var ab_vec = this.AB; var bc_vec = this.BC; var cd_vec = this.CD; var da_vec = this.DA; int rectLeft = this.rect.Left; int rectTop = this.rect.Top; for (int y = 0; y < rectHeight; ++y) { for (int x = 0; x < rectWidth; ++x) { PointF srcPt = new PointF(x, y); srcPt.Offset(rectLeft, rectTop); if (!IsOnPlaneABCD(srcPt)) { continue; } //------------------------------------- dab = Math.Abs(MyVectorHelper.NewFromTwoPoints(vertex[0], srcPt).CrossProduct(ab_vec)); dbc = Math.Abs(MyVectorHelper.NewFromTwoPoints(vertex[1], srcPt).CrossProduct(bc_vec)); dcd = Math.Abs(MyVectorHelper.NewFromTwoPoints(vertex[2], srcPt).CrossProduct(cd_vec)); dda = Math.Abs(MyVectorHelper.NewFromTwoPoints(vertex[3], srcPt).CrossProduct(da_vec)); ptInPlane.X = (float)(srcW * (dda / (dda + dbc))); ptInPlane.Y = (float)(srcH * (dab / (dab + dcd))); x1 = (int)ptInPlane.X; y1 = (int)ptInPlane.Y; if (x1 >= 0 && x1 < srcW && y1 >= 0 && y1 < srcH) { //bilinear interpolation *** x2 = (x1 == srcW - 1) ? x1 : x1 + 1; y2 = (y1 == srcH - 1) ? y1 : y1 + 1; dx1 = ptInPlane.X - (float)x1; if (dx1 < 0) { dx1 = 0; } dx1 = 1f - dx1; dx2 = 1f - dx1; dy1 = ptInPlane.Y - (float)y1; if (dy1 < 0) { dy1 = 0; } dy1 = 1f - dy1; dy2 = 1f - dy1; dx1y1 = dx1 * dy1; dx1y2 = dx1 * dy2; dx2y1 = dx2 * dy1; dx2y2 = dx2 * dy2; //use 4 points Drawing.Color x1y1Color = srcCB.GetPixel(x1, y1); Drawing.Color x2y1Color = srcCB.GetPixel(x2, y1); Drawing.Color x1y2Color = srcCB.GetPixel(x1, y2); Drawing.Color x2y2Color = srcCB.GetPixel(x2, y2); float a = (x1y1Color.alpha * dx1y1) + (x2y1Color.alpha * dx2y1) + (x1y2Color.alpha * dx1y2) + (x2y2Color.alpha * dx2y2); float b = (x1y1Color.blue * dx1y1) + (x2y1Color.blue * dx2y1) + (x1y2Color.blue * dx1y2) + (x2y2Color.blue * dx2y2); float g = (x1y1Color.green * dx1y1) + (x2y1Color.green * dx2y1) + (x1y2Color.green * dx1y2) + (x2y2Color.green * dx2y2); float r = (x1y1Color.red * dx1y1) + (x2y1Color.red * dx2y1) + (x1y2Color.red * dx1y2) + (x2y2Color.red * dx2y2); destWriter.SetPixel(x, y, new Drawing.Color((byte)a, (byte)b, (byte)g, (byte)r)); //destCB.SetColorPixel(x, y, new ColorRGBA((byte)b, (byte)g, (byte)r, (byte)a)); } } } return(destCB); }
public void FillTriangleStripWithVertexBuffer(float[] linesBuffer, int nelements, Drawing.Color color) { SetCurrent(); CheckViewMatrix(); //-------------------------------------------- u_solidColor.SetValue((float)color.R / 255f, (float)color.G / 255f, (float)color.B / 255f, (float)color.A / 255f); a_position.LoadPureV2f(linesBuffer); GL.DrawArrays(BeginMode.TriangleStrip, 0, nelements); }
public override void Draw(PixelFarm.Drawing.Painter p) { //specific for agg if (!(p is AggPainter)) { return; } throw new NotSupportedException(); AggPainter p2 = (AggPainter)p; AggRenderSurface aggRdsf = p2.RenderSurface; if (aggRdsf.DestImage != null) { IImageReaderWriter backBuffer = aggRdsf.DestImage; IPixelBlender currentPixelBlender = aggRdsf.PixelBlender; int distBetween = backBuffer.BytesBetweenPixelsInclusive; //use different pixel blender var redImageBuffer = new SubImageRW(backBuffer, new PixelBlenderGray(distBetween), distBetween, CO.R, 8); var greenImageBuffer = new SubImageRW(backBuffer, new PixelBlenderGray(distBetween), distBetween, CO.G, 8); var blueImageBuffer = new SubImageRW(backBuffer, new PixelBlenderGray(distBetween), distBetween, CO.B, 8); ClipProxyImage clippingProxy = new ClipProxyImage(backBuffer); ClipProxyImage clippingProxyRed = new ClipProxyImage(redImageBuffer); ClipProxyImage clippingProxyGreen = new ClipProxyImage(greenImageBuffer); ClipProxyImage clippingProxyBlue = new ClipProxyImage(blueImageBuffer); ScanlineRasterizer sclineRas = aggRdsf.ScanlineRasterizer; ScanlinePacked8 scline = aggRdsf.ScanlinePacked8; Drawing.Color clearColor = this.UseBlackBlackground ? Drawing.Color.FromArgb(0, 0, 0) : Drawing.Color.FromArgb(255, 255, 255); clippingProxy.Clear(clearColor); Drawing.Color fillColor = this.UseBlackBlackground ? new Drawing.Color((byte)(this.AlphaValue), 255, 255, 255) : new Drawing.Color((byte)(this.AlphaValue), 0, 0, 0); ScanlineRasToDestBitmapRenderer sclineRasToBmp = aggRdsf.ScanlineRasToDestBitmap; VertexSource.Ellipse er = new PixelFarm.Agg.VertexSource.Ellipse(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); // var v1 = GetFreeVxs(); sclineRas.AddPath(er.MakeVxs(v1)); v1.Clear(); sclineRasToBmp.RenderWithColor(clippingProxyRed, sclineRas, scline, fillColor); VertexSource.Ellipse eg = new PixelFarm.Agg.VertexSource.Ellipse(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); sclineRas.AddPath(eg.MakeVertexSnap(v1)); v1.Clear(); sclineRasToBmp.RenderWithColor(clippingProxyGreen, sclineRas, scline, fillColor); VertexSource.Ellipse eb = new PixelFarm.Agg.VertexSource.Ellipse(Width / 2, Height / 2 + 50, 100, 100, 100); sclineRas.AddPath(eb.MakeVertexSnap(v1)); v1.Clear(); sclineRasToBmp.RenderWithColor(clippingProxyBlue, sclineRas, scline, fillColor); ReleaseVxs(ref v1); } // else if (graphics2D.DestImageFloat != null) // { //#if false // IImageFloat backBuffer = graphics2D.DestImageFloat; // int distBetween = backBuffer.GetFloatsBetweenPixelsInclusive(); // ImageBufferFloat redImageBuffer = new ImageBufferFloat(); // redImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 2, 8); // ImageBufferFloat greenImageBuffer = new ImageBufferFloat(); // greenImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 1, 8); // ImageBufferFloat blueImageBuffer = new ImageBufferFloat(); // blueImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 0, 8); // ImageClippingProxy clippingProxy = new ImageClippingProxy(backBuffer); // ImageClippingProxy clippingProxyRed = new ImageClippingProxy(redImageBuffer); // ImageClippingProxy clippingProxyGreen = new ImageClippingProxy(greenImageBuffer); // ImageClippingProxy clippingProxyBlue = new ImageClippingProxy(blueImageBuffer); // ScanlineRasterizer ras = new ScanlineRasterizer(); // ScanlineCachePacked8 sl = new ScanlineCachePacked8(); // RGBA_Bytes clearColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(0, 0, 0) : new RGBA_Bytes(255, 255, 255); // clippingProxy.clear(clearColor); // alphaSlider.View.BackGroundColor = clearColor; // RGBA_Bytes FillColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(255, 255, 255, (int)(alphaSlider.Value)) : new RGBA_Bytes(0, 0, 0, (int)(alphaSlider.Value)); // VertexSource.Ellipse er = new AGG.VertexSource.Ellipse(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); // ras.add_path(er); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyRed, ras, sl, FillColor); // VertexSource.Ellipse eg = new AGG.VertexSource.Ellipse(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100); // ras.add_path(eg); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyGreen, ras, sl, FillColor); // VertexSource.Ellipse eb = new AGG.VertexSource.Ellipse(Width / 2, Height / 2 + 50, 100, 100, 100); // ras.add_path(eb); // agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyBlue, ras, sl, FillColor); //#endif // } }
/// <summary> /// we do NOT store vxs /// </summary> /// <param name="vxs"></param> /// <param name="c"></param> public void Render(VertexStore vxs, Drawing.Color c) { Render(new VertexStoreSnap(vxs), c); }
private static string ToRgbString(Drawing.Color color) { return($"R: {color.R}, G: {color.G}, B: {color.B}"); }
public InvertAlphaLineSmoothShader(ShaderSharedResource shareRes) : base(shareRes) { //NOTE: during development, //new shader source may not recompile if you don't clear cache or disable cache feature //like... //EnableProgramBinaryCache = false; if (!LoadCompiledShader()) { //vertex shader source string vs = @" attribute vec4 a_position; uniform mat4 u_mvpMatrix; uniform vec4 u_solidColor; uniform float u_linewidth; varying vec4 v_color; varying float v_distance; varying float p0; void main() { float rad = a_position[3]; v_distance= a_position[2]; float n_x = sin(rad); float n_y = cos(rad); vec4 delta; if(v_distance <1.0){ delta = vec4(-n_x * u_linewidth,n_y * u_linewidth,0,0); }else{ delta = vec4(n_x * u_linewidth,-n_y * u_linewidth,0,0); } if(u_linewidth <= 0.5){ p0 = 0.5; }else if(u_linewidth <=1.0){ p0 = 0.45; }else if(u_linewidth>1.0 && u_linewidth<3.0){ p0 = 0.25; }else{ p0= 0.1; } vec4 pos = vec4(a_position[0],a_position[1],0,1) + delta; gl_Position = u_mvpMatrix* pos; v_color= u_solidColor; } "; //fragment source //this is invert fragment shader *** //so we string fs = @" precision mediump float; varying vec4 v_color; varying float v_distance; varying float p0; void main() { float d0= v_distance; float p1= 1.0-p0; float factor= 1.0 /p0; if(d0 < p0){ gl_FragColor = vec4(v_color[0],v_color[1],v_color[2], 1.0 -(v_color[3] *(d0 * factor))); }else if(d0> p1){ gl_FragColor= vec4(v_color[0],v_color[1],v_color[2],1.0-(v_color[3] *((1.0-d0)* factor))); } else{ gl_FragColor = vec4(0,0,0,0); } } "; //--------------------- if (!_shaderProgram.Build(vs, fs)) { return; } //----------------------- SaveCompiledShader(); } a_position = _shaderProgram.GetAttrV4f("a_position"); u_matrix = _shaderProgram.GetUniformMat4("u_mvpMatrix"); u_solidColor = _shaderProgram.GetUniform4("u_solidColor"); u_linewidth = _shaderProgram.GetUniform1("u_linewidth"); _strokeColor = Drawing.Color.Black; }
protected override void SetWidgetColor(Drawing.Color value) { // Do nothing }
public Climbable() { Color = new Drawing.Color(.8f, .8f, 0, 0.8f); }
public Wind() { Color = new Drawing.Color(.8f, 0, 0.8f, 0.8f); }
public InvisibleWall() { Color = new Drawing.Color(0, 0, 0, 0.8f); }
public ScriptTrigger() { Color = new Drawing.Color(.8f, 0, .8f, 0.8f); }
public InvertAlphaLineSmoothShader(CanvasToShaderSharedResource canvasShareResource) : base(canvasShareResource) { //------------------------------------------------------------------------------- string vs = @" attribute vec4 a_position; uniform mat4 u_mvpMatrix; uniform vec4 u_solidColor; uniform float u_linewidth; varying vec4 v_color; varying float v_distance; varying float p0; void main() { float rad = a_position[3]; v_distance= a_position[2]; float n_x = sin(rad); float n_y = cos(rad); vec4 delta; if(v_distance <1.0){ delta = vec4(-n_x * u_linewidth,n_y * u_linewidth,0,0); }else{ delta = vec4(n_x * u_linewidth,-n_y * u_linewidth,0,0); } if(u_linewidth <= 0.5){ p0 = 0.5; }else if(u_linewidth <=1.0){ p0 = 0.45; }else if(u_linewidth>1.0 && u_linewidth<3.0){ p0 = 0.25; }else{ p0= 0.1; } vec4 pos = vec4(a_position[0],a_position[1],0,1) + delta; gl_Position = u_mvpMatrix* pos; v_color= u_solidColor; } "; //fragment source //this is invert fragment shader *** //so we string fs = @" precision mediump float; varying vec4 v_color; varying float v_distance; varying float p0; void main() { float d0= v_distance; float p1= 1.0-p0; float factor= 1.0 /p0; if(d0 < p0){ gl_FragColor = vec4(v_color[0],v_color[1],v_color[2], 1.0 -(v_color[3] *(d0 * factor))); }else if(d0> p1){ gl_FragColor= vec4(v_color[0],v_color[1],v_color[2],1.0-(v_color[3] *((1.0-d0)* factor))); } else{ gl_FragColor = vec4(0,0,0,0); } } "; //--------------------- if (!shaderProgram.Build(vs, fs)) { return; } //----------------------- a_position = shaderProgram.GetAttrV4f("a_position"); u_matrix = shaderProgram.GetUniformMat4("u_mvpMatrix"); u_solidColor = shaderProgram.GetUniform4("u_solidColor"); u_linewidth = shaderProgram.GetUniform1("u_linewidth"); _strokeColor = Drawing.Color.Black; }
public SequenceTrigger() { Color = new Drawing.Color(.8f, 0, 0, 0.8f); }
public void RenderVertexSnap(VertexStoreSnap s, Drawing.Color c) { m_ren.Color = c; AddPath(s); }