This commit is contained in:
olikraus 2016-05-05 11:52:11 +02:00
parent db0cafb67a
commit 3c484fd2fd
6 changed files with 27 additions and 7 deletions

View File

@ -446,7 +446,8 @@ void u8g2_SetDrawColor(u8g2_t *u8g2, uint8_t color) U8G2_NOINLINE; /* u8g: u8g_
/*==========================================*/
/* u8g2_bitmap.c */
void u8g2_DrawHBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b);
void u8g2_DrawHorizontalBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b);
void u8g2_DrawBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t cnt, u8g2_uint_t h, const uint8_t *bitmap);
void u8g2_DrawXBM(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h, const uint8_t *bitmap);

View File

@ -41,7 +41,7 @@
b Pointer to the bitmap line.
*/
void u8g2_DrawHBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
void u8g2_DrawHorizontalBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
{
uint8_t mask;
uint8_t color = u8g2->draw_color;
@ -71,6 +71,28 @@ void u8g2_DrawHBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t le
u8g2->draw_color = color;
}
/* u8glib compatible bitmap draw function */
void u8g2_DrawBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t cnt, u8g2_uint_t h, const uint8_t *bitmap)
{
u8g2_uint_t w;
w = cnt;
w *= 8;
#ifdef U8G2_WITH_INTERSECTION
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
return;
#endif /* U8G2_WITH_INTERSECTION */
while( h > 0 )
{
u8g2_DrawHorizontalBitmap(u8g2, x, y, w, bitmap);
bitmap += cnt;
y++;
h--;
}
}
void u8g2_DrawHXBM(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, const uint8_t *b)
{
uint8_t mask;

View File

@ -66,9 +66,6 @@ Major Changes (Code rework required)
Use the print function with the F() macro instead.
- In U8glib font transparency was defined in the .begin() statement. This is now
handled by setFontMode
- drawBitmap: The width/count argument of the u8glib drawBitmap function
has changed: U8g2 expects the number of pixel. Just multiply the
third argument with 8 for the u8g2 function.
- Screen rotation does not exisit any more:
The functions undoRotation, setRot90, setRot180 and setRot270 are
replaced by the first argument of the constructor

View File

@ -23,8 +23,8 @@ int main(void)
u8g2_FirstPage(&u8g2);
do
{
u8g2_DrawHBitmap(&u8g2, 0, 0, 10, b);
u8g2_DrawStr(&u8g2, 30, 20, "HBitmap");
u8g2_DrawHorizontalBitmap(&u8g2, 0, 0, 10, b);
u8g2_DrawStr(&u8g2, 1, 20, "HorizontalBitmap");
} while( u8g2_NextPage(&u8g2) );
utf8_show();