public static void DrawPixcelSelectedLayer(PixcelImage i, double zoomPerCent, ref double layer)
        {
            double zoom = zoomPerCent / 100.0;

            double offsetX;
            double offsetY;
            double w, h;

            offsetX = (i.Rect.OffsetX + i.imageData.actualSize.OffsetX) * zoom;
            offsetY = (i.Rect.OffsetY + (i.Rect.Height - i.imageData.actualSize.OffsetY - i.imageData.actualSize.Height)) * zoom;
            w       = i.imageData.actualSize.Width * zoom;
            h       = i.imageData.actualSize.Height * zoom;

            double texMin = 0, texMax = 1.0;

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (int)TextureEnvMode.Combine);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvColor, OverrayColor);

            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.CombineRgb, (int)TextureEnvModeCombine.Replace);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.Source0Rgb, (int)TextureEnvModeSource.Constant);

            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.CombineAlpha, (int)TextureEnvModeCombine.Modulate);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.Src0Alpha, (int)TextureEnvModeSource.Constant);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.Src1Alpha, (int)TextureEnvModeSource.Texture);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.Operand0Alpha, (int)TextureEnvModeOperandAlpha.SrcAlpha);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.Operand1Alpha, (int)TextureEnvModeOperandAlpha.SrcAlpha);

            IBFramework.OpenGL.Texture.BindTexture(i.imageData.textureNumber);
            {
                GL.Begin(PrimitiveType.Quads);
                {
                    GL.TexCoord2(texMax, texMin);
                    GL.Vertex3(offsetX + w, offsetY + h, layer);
                    GL.TexCoord2(texMin, texMin);
                    GL.Vertex3(offsetX, offsetY + h, layer);
                    GL.TexCoord2(texMin, texMax);
                    GL.Vertex3(offsetX, offsetY, layer);
                    GL.TexCoord2(texMax, texMax);
                    GL.Vertex3(offsetX + w, offsetY, layer);
                }
                GL.End();
                layer += 0.01;
            }
            //IBFramework.OpenGL.Texture.BindTexture(0);

            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (int)TextureEnvMode.Replace);
        }
Esempio n. 2
0
        public void AddNewLayer(string name, bool RURecord = true, ImageTypes type = ImageTypes.LineDrawing)
        {
            IBImage l = null;

            switch (type)
            {
            case ImageTypes.Coloring:
            case ImageTypes.LineDrawing:
                l = new PixcelImage(Width + 300, Height + 300, -150, -150);
                l.imageData.ClearData(new PixelData()
                {
                    r = 255, g = 255, b = 255, a = 0
                });
                break;

            case ImageTypes.SingleColor:
                l      = new SingleColorImage(255, 255, 255, 255);
                l.Rect = new IBRectangle(1920 + 300, 1080 + 300, -150, -150);
                break;

            case ImageTypes.Pixel:
                l = new PixcelImage();
                break;

            default:
                break;
            }

            if (l == null)
            {
                return;
            }

            l.LayerName       = name;
            l.LayerType       = type;
            l.IsSelectedLayer = true;
            l.owner           = this;
            l.imageData.TextureUpdate();

            foreach (IBImage i in Layers)
            {
                if (i.IsSelectedLayer)
                {
                    i.IsSelectedLayer = false;
                    int index = Layers.IndexOf(i);
                    Layers.Insert(index, l);

                    if (RURecord)
                    {
                        RedoUndoManager.Current.Record(new RUAddNewLayer(this, l));
                    }

                    return;
                }
            }

            if (RURecord)
            {
                RedoUndoManager.Current.Record(new RUAddNewLayer(this, l));
            }

            Layers.Insert(0, l);
        }
Esempio n. 3
0
 public override void Blend(PixcelImage source, CLBuffer trg, IBRectangle trgSize, CLBuffer buffer)
 {
     throw new NotImplementedException();
 }
Esempio n. 4
0
 public abstract void Blend(PixcelImage source, CLBuffer trg, IBRectangle trgSize, CLBuffer buffer);