void Process() { GLTextuer2D i1 = (GLTextuer2D)input.Input.Data; if (i1 == null) { return; } if (i1.Id == 0) { return; } CreateBufferIfNeeded(); curveLUT.Bind(); curveLUT.SetData(lutBrush.Image, GLInterfaces.PixelFormat.Rgba, 256, 2); GLTextuer2D.Unbind(); processor.TileX = tileX; processor.TileY = tileY; processor.Process(width, height, i1, buffer); processor.Complete(); Updated(); Output.Data = buffer; Output.Changed(); }
void Process() { GLTextuer2D i1 = (GLTextuer2D)input.Input.Data; if (i1 == null) { return; } if (i1.Id == 0) { return; } CreateBufferIfNeeded(); try { List <Point> mids = curves[0]; List <Point> reds = curves[1]; List <Point> greens = curves[2]; List <Point> blues = curves[3]; foreach (Point p in reds) { int x = 255 - (int)Math.Floor(Math.Min(255, Math.Max(0, p.X * 255))); for (int i = 0; i < 2; i++) { int idx2 = (x + i * 256) * 4; lutBrush.Image[idx2] = (float)p.Y; } } foreach (Point p in greens) { int x = 255 - (int)Math.Floor(Math.Min(255, Math.Max(0, p.X * 255))); for (int i = 0; i < 2; i++) { int idx2 = (x + i * 256) * 4; lutBrush.Image[idx2 + 1] = (float)p.Y; } } foreach (Point p in blues) { int x = 255 - (int)Math.Floor(Math.Min(255, Math.Max(0, p.X * 255))); for (int i = 0; i < 2; i++) { int idx2 = (x + i * 256) * 4; lutBrush.Image[idx2 + 2] = (float)p.Y; } } foreach (Point p in mids) { int x = 255 - (int)Math.Floor(Math.Min(255, Math.Max(0, p.X * 255))); for (int i = 0; i < 2; i++) { int idx2 = (x + i * 256) * 4; lutBrush.Image[idx2 + 3] = (float)p.Y; } } curveLUT.Bind(); curveLUT.SetData(lutBrush.Image, OpenTK.Graphics.OpenGL.PixelFormat.Rgba, 256, 2); GLTextuer2D.Unbind(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } processor.TileX = tileX; processor.TileY = tileY; processor.Process(width, height, i1, buffer); processor.Complete(); Updated(); Output.Data = buffer; Output.Changed(); }