public static Bitmap DrawCursor(Bitmap display, int x, int y, bool cursorVisible) // inverts 8x8 square where cursor is { if (cursorVisible && !MainWindow.doingFileStuff) { // loop through columns for (int i = x + borderSize; i < 8 + x + borderSize; i++) { // loop through rows for (int j = y + borderSize; j < 8 + y + borderSize; j++) { if (i >= 0 && i < 320 && j >= 0 && j < 200) { // swap light blue and dark blue colours if (display.GetPixel(i, j) == Colours.GetColour(GLOBAL.AppConfig.foreground_colour)) { display.SetPixel(i, j, Colours.GetColour(GLOBAL.AppConfig.background_colour)); } else if (display.GetPixel(i, j) == Colours.GetColour(GLOBAL.AppConfig.background_colour)) { display.SetPixel(i, j, Colours.GetColour(GLOBAL.AppConfig.foreground_colour)); } } } } } // return the new image with the cursor displayed on it return(display); }
public static void DrawBorder() // draws the back border to the screen { // x y width height colour DrawRect(0, 0, width + (borderSize * 2), borderSize, Colours.GetColour(GLOBAL.AppConfig.border_colour), 1); // top DrawRect(0, height + borderSize, width + (borderSize * 2), borderSize, Colours.GetColour(GLOBAL.AppConfig.border_colour), 1); // bottom DrawRect(0, 0, borderSize, height + (borderSize * 2), Colours.GetColour(GLOBAL.AppConfig.border_colour), 1); // left DrawRect(width + borderSize, 0, borderSize, height + (borderSize * 2), Colours.GetColour(GLOBAL.AppConfig.border_colour), 1); // right }
public static void DrawChar(int x, int y, int charID, Bitmap bitmap) // used exclusivley for drawing to the external keyboard gui { for (int i = 0; i < 8; i++) // loop through character rows { for (int j = 0; j < 8; j++) // loop through character columns { if (charID >= 0 && charID <= 127) { // if j column bit is set (1 row is 8 bits, 1 bit for each column, or 1 byte) if ((GLOBAL.C64_ROM.GetCharsetData(charID, i) & (0x80 >> j)) == 0x80 >> j) { DrawPixel(i + y, j + x, Colours.GetColour(0), bitmap); // set pixel black } else { DrawPixel(i + y, j + x, Colours.GetColour(4), bitmap); // set pixel white } } } } }
public static void DrawChar(int x, int y, int charID) // draws the character of ID charID at grid position x, y { for (int i = 0; i < 8; i++) // loop through character rows { for (int j = 0; j < 8; j++) // loop through character columns { if (charID >= 0 && charID <= 127) { // if j column bit is set (1 row is 8 bits, 1 bit for each column, or 1 byte) if ((GLOBAL.C64_ROM.GetCharsetData(charID, i) & (0x80 >> j)) == 0x80 >> j) { DrawPixel(i + y * 8, j + x * 8, Colours.GetColour(GLOBAL.AppConfig.foreground_colour)); // set pixel light } else { DrawPixel(i + y * 8, j + x * 8, Colours.GetColour(GLOBAL.AppConfig.background_colour)); // set pixel dark } } } } }