SFML.Graphics.Image.SetPixel C# (CSharp) Méthode

SetPixel() public méthode

Change the color of a pixel
public SetPixel ( uint x, uint y, System.Color color ) : void
x uint X coordinate of pixel in the image
y uint Y coordinate of pixel in the image
color System.Color New color for pixel (x, y)
Résultat void
        public void SetPixel(uint x, uint y, Color color)
        {
            sfImage_setPixel(CPointer, x, y, color);
        }

Usage Example

Exemple #1
0
        /*
         * This function draws a full line to the full 512x512 window. It draws from both the left and right name tables at the line specified.
         * It draws a full line and accounts for name table mirroring. From here the data is drawn to the window to be read in later.
         */
        public void drawFullBGLineToWindow(uint lineNumber)
        {
            bool isLineUpperTable;

            if (isNametableMirrored && !isHorizNametableMirror)
            {
                //If name table is vertically mirrored, then draw the top. The bottom is just a copy.
                isLineUpperTable = true;
            }
            else
            {
                //If line is less in the lower half of 512 lines
                isLineUpperTable = (lineNumber < 256);
            }

            Color[] leftTable = drawBGLineFromNameTable(lineNumber % 256, true, isLineUpperTable);
            Color[] rightTable;

            if (isNametableMirrored && isHorizNametableMirror)
            {
                //If name table is horizontally mirrored, the draw the left table for both tables. The right is just a copy.
                rightTable = leftTable;
            }
            else
            {
                rightTable = drawBGLineFromNameTable(lineNumber % 256, false, isLineUpperTable);
            }

            for (int x = 0; x < 256; x++)
            {
                fullWindow.SetPixel((uint)x, lineNumber, leftTable[x]);
                fullWindow.SetPixel((uint)(x + 256), lineNumber, rightTable[x]);
            }
        }
All Usage Examples Of SFML.Graphics.Image::SetPixel