Esempio n. 1
0
 public static void putPixel(int x, int y, OpenGL gl, Custom_Color color)
 {
     byte[] ptr = new byte[3];
     ptr[0] = color.R;
     ptr[1] = color.G;
     ptr[2] = color.B;
     gl.RasterPos(x, y);
     gl.DrawPixels(1, 1, OpenGL.GL_RGB, ptr);
     gl.Flush();
 }
Esempio n. 2
0
        public static void BoundaryFill(OpenGL gl, int x, int y, Custom_Color fill_color, Custom_Color boundary_color)
        {
            // get color value at coordinate (x,y)
            Custom_Color currentColor = utils.Custom_Color.GetPixels(gl, x, y);

            if (!utils.Custom_Color.IsSameColor(currentColor, boundary_color) && !utils.Custom_Color.IsSameColor(currentColor, fill_color))
            {
                utils.Custom_Color.putPixel(x, y, gl, fill_color);
                BoundaryFill(gl, x - 1, y, fill_color, boundary_color);
                BoundaryFill(gl, x, y + 1, fill_color, boundary_color);
                BoundaryFill(gl, x + 1, y, fill_color, boundary_color);
                BoundaryFill(gl, x, y - 1, fill_color, boundary_color);
            }
        }
Esempio n. 3
0
        public static Custom_Color GetPixels(OpenGL gl, int x, int y)
        {
            byte[] ptr = new byte[3];
            //int actual_y = gl.RenderContextProvider.Height - y;
            gl.ReadPixels(x, y, 1, 1, OpenGL.GL_RGB, OpenGL.GL_BYTE, ptr);

            byte Red   = ptr[0];
            byte Green = ptr[1];
            byte Blue  = ptr[2];
            // assign this value to currentColor variable
            Custom_Color currentColor = new Custom_Color(Red, Green, Blue);

            return(currentColor);
        }
Esempio n. 4
0
        public static bool IsSameColor(Custom_Color currentColor, Custom_Color other)
        {
            bool Flag = false;

            if (currentColor.R != other.R)
            {
                return(Flag);
            }
            if (currentColor.G != other.G)
            {
                return(Flag);
            }
            if (currentColor.B != other.B)
            {
                return(Flag);
            }
            Flag = true;
            return(Flag);
        }