Add scale to lcd.drawBitmap. Scale is like in % (50 divides by two, 200 doubles) (#3592)
Default scale to 0 to allow DMA in target function (thx Bertrand)
This commit is contained in:
@@ -395,13 +395,15 @@ void registerBitmapClass(lua_State * L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function lcd.drawBitmap(bitmap, x, y)
|
@function lcd.drawBitmap(bitmap, x, y [, scale])
|
||||||
|
|
||||||
Displays a bitmap at (x,y)
|
Displays a bitmap at (x,y)
|
||||||
|
|
||||||
@param bitmap (pointer) point to a bitmap previously opened with Bipmap.open()
|
@param bitmap (pointer) point to a bitmap previously opened with Bipmap.open()
|
||||||
|
|
||||||
@param x,y (positive numbers) starting coordinate
|
@param x,y (positive numbers) starting coordinates
|
||||||
|
|
||||||
|
@param scale (positive numbers) scale in %, 50 divides size by two, 100 is unchanged, 200 doubles size
|
||||||
|
|
||||||
@notice Only available on color screens
|
@notice Only available on color screens
|
||||||
|
|
||||||
@@ -413,9 +415,10 @@ static int luaLcdDrawBitmap(lua_State *L)
|
|||||||
const BitmapBuffer * bitmap = checkBitmap(L, 1);
|
const BitmapBuffer * bitmap = checkBitmap(L, 1);
|
||||||
int x = luaL_checkinteger(L, 2);
|
int x = luaL_checkinteger(L, 2);
|
||||||
int y = luaL_checkinteger(L, 3);
|
int y = luaL_checkinteger(L, 3);
|
||||||
|
unsigned scale = luaL_optunsigned(L, 4, 0);
|
||||||
|
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
lcd->drawBitmap(x, y, bitmap);
|
lcd->drawBitmap(x, y, bitmap, 0, 0, 0, 0, (float) scale/100);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -426,7 +429,7 @@ static int luaLcdDrawBitmap(lua_State *L)
|
|||||||
|
|
||||||
Draw a bitmap at (x,y)
|
Draw a bitmap at (x,y)
|
||||||
|
|
||||||
@param x,y (positive numbers) starting coordinate
|
@param x,y (positive numbers) starting coordinates
|
||||||
|
|
||||||
@param name (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
|
@param name (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user