Exemplo n.º 1
0
        public CurvesNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA)
        {
            Name = "Curves";
            Id   = Guid.NewGuid().ToString();

            width  = w;
            height = h;

            minValue = 0;
            maxValue = 1;

            points = new Dictionary <int, List <Point> >();

            previewProcessor = new BasicImageRenderer();

            tileX = tileY = 1;

            lutBrush = new FloatBitmap(256, 2);

            internalPixelType = p;

            curveLUT = new GLTextuer2D(GLInterfaces.PixelInternalFormat.Rgba8);
            curveLUT.Bind();
            curveLUT.SetFilter((int)GLInterfaces.TextureMinFilter.Nearest, (int)GLInterfaces.TextureMagFilter.Nearest);
            curveLUT.SetWrap((int)GLInterfaces.TextureWrapMode.Repeat);
            GLTextuer2D.Unbind();

            processor = new CurvesProcessor(curveLUT);

            //set defaults
            List <Point> pts = new List <Point>();

            pts.Add(new Point(0, 1));
            pts.Add(new Point(1, 0));

            points[0] = pts;
            points[1] = pts;
            points[2] = pts;
            points[3] = pts;

            input  = new NodeInput(NodeType.Color | NodeType.Gray, this, "Image Input");
            Output = new NodeOutput(NodeType.Color | NodeType.Gray, this);

            input.OnInputAdded   += Input_OnInputAdded;
            input.OnInputChanged += Input_OnInputChanged;
            input.OnInputRemoved += Input_OnInputRemoved;

            Inputs = new List <NodeInput>();
            Inputs.Add(input);

            Outputs = new List <NodeOutput>();
            Outputs.Add(Output);
        }
Exemplo n.º 2
0
        public override void Dispose()
        {
            base.Dispose();

            if (processor != null)
            {
                processor.Release();
                processor = null;
            }

            if (curveLUT != null)
            {
                curveLUT.Release();
                curveLUT = null;
            }
        }