This commit is contained in:
olikraus 2017-01-08 07:14:21 +01:00
parent aea3130eb2
commit 29a570ab39
3 changed files with 48 additions and 2 deletions

View File

@ -89,5 +89,5 @@ https://github.com/olikraus/u8g2 ChangeLog
* Support for DOGM132 (issue 147)
* Fixed a bug in the draw pixel procedure which appears of the full buffer,
if the display width is not a multiple of 8 (issue 148)
* Added XOR mode (setDrawColor 2, issue 56)

View File

@ -255,10 +255,13 @@ void u8g2_xor(uint8_t a) {
u8g2.setDrawColor(2);
for( i = 0; i < 5; i++)
{
u8g2.drawBox(10+i*16, 18 + (i&1)*4, 21,21);
u8g2.drawBox(10+i*16, 18 + (i&1)*4, 21,31);
}
u8g2.drawStr( 5+a, 19, "XOR XOR XOR XOR");
u8g2.setDrawColor(0);
u8g2.drawStr( 5+a, 29, "CLR CLR CLR CLR");
u8g2.setDrawColor(1);
u8g2.drawStr( 5+a, 39, "SET SET SET SET");
u8g2.setFontMode(0);
}

View File

@ -611,6 +611,49 @@ int main(void)
tga_save_png("u8g2_font_direction.png");
/*=========================================*/
/* u8g2_xor.png */
u8x8_ClearDisplay(u8g2_GetU8x8(&desc));
u8g2_SetFontMode(&u8g2, 1);
u8g2_SetFontPosBaseline(&u8g2);
u8g2_SetFontDirection(&u8g2, 0);
u8g2_FirstPage(&u8g2);
do
{
u8g2_SetDrawColor(&u8g2, 1);
u8g2_DrawBox(&u8g2, 22, 2, 35, 50);
u8g2_SetFont(&u8g2, u8g2_font_ncenB14_tf);
u8g2_SetDrawColor(&u8g2, 0);
u8g2_DrawStr(&u8g2, 5, 18, "abcd");
u8g2_SetDrawColor(&u8g2, 1);
u8g2_DrawStr(&u8g2, 5, 33, "abcd");
u8g2_SetDrawColor(&u8g2, 2);
u8g2_DrawStr(&u8g2, 5, 48, "abcd");
} while( u8g2_NextPage(&u8g2) );
u8g2_SetDrawColor(&u8g2, 1);
tga_is_transparent = 1;
u8g2_FirstPage(&desc);
do
{
u8g2_SetFont(&desc, u8g2_font_helvB18_tf);
ra(5,15, "color 0");
ra(5,30, "color 1");
ra(5,45, "color 2");
//vm(62,19-u8g2_GetDescent(&u8g2), -u8g2_GetDescent(&u8g2));
} while( u8g2_NextPage(&desc) );
tga_is_transparent = 0;
u8g2_SetFontPosBaseline(&u8g2);
u8g2_SetFontDirection(&u8g2, 0);
tga_save_png("u8g2_xor.png");
/*=========================================*/
/* u8g2_color.png */