Set pixel operation mode when output contents on screen

Description

  All contents output on screen are based on pixels, the display can calculate the old pixel's color with the foreground color then write the pixel with the new color, other than simply copy the foreground color to the pixel.

  There are 6 operation mode:

  1. Copy ('C'), default mode, write the foreground color to the pixel position;
  2. Or ('|'), the pixel's color = old pixel's color bit OR foreground color;
  3. Not ('!' or '~'), the pixel's color= bit not the old pixel's color. Foreground color unused.
  4. And ('&'), the pixel's color = old pixel's color bit AND foreground color;
  5. Xor ('^'), the pixel's color = old pixel's color bit XOR foreground color;
  6. Over write ('O','o'), for characters only, similar with Copy mode, but this mode will not clean the character's box, the background on the screen where the characters is not over write by background color. It's the best mode to write characters on the image/graphics.

Tips: output same contents at "Not" or "Xor" mode, the even output extiguish the contents. 

This command affect all following outputs to screen, until set to a different pattern.

Note: Not apply to the color image at not tranparent mode

Usage:

Direct:

"DMd"

Arduino:

void setMode(uint8_t d)

C:

void Digole_setMode(uint8_t d)

Parameters:

d

The pixel operation mode, must be one of: 'C', '|', '!', '~', '&', '^', 'O', 'o'

Return:

none

Example (Arduino):

mydisp.setMode('^'); //set to XOR mode (or NOT mode)
mydisp.drawStr(5,10,"Hello World!"); //display "Hello World!" on the screen
mydisp.drawStr(5,10,"Hello World!"); //"Hello World!" disappear on the screen

Example(direct)

serial.writeString("DM^"); //set to XOR mode (or NOT mode)
serial.writeString
("TP\x05\x0A"); //set character position
serial.writeString
("TTHello World!\x00"); //display "Hello World!" on the screen

serial.writeString("TP\x05\x0A"); //set character position
serial.writeString("TTHello World!\x00"); //"Hello World!" disappear on the screen

 

Changelog

Version Description
   

See Also

Draw character(s) 

Draw graphic(s)