From 5a3fc739461baa804ea26156c446cef1f91559f4 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 12 Jun 2016 16:01:05 +0200 Subject: [PATCH] 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) --- radio/src/lua/api_lcd.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/radio/src/lua/api_lcd.cpp b/radio/src/lua/api_lcd.cpp index 725aba31e..2c2f0a83c 100644 --- a/radio/src/lua/api_lcd.cpp +++ b/radio/src/lua/api_lcd.cpp @@ -395,13 +395,15 @@ void registerBitmapClass(lua_State * L) } /*luadoc -@function lcd.drawBitmap(bitmap, x, y) +@function lcd.drawBitmap(bitmap, x, y [, scale]) Displays a bitmap at (x,y) @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 @@ -413,9 +415,10 @@ static int luaLcdDrawBitmap(lua_State *L) const BitmapBuffer * bitmap = checkBitmap(L, 1); int x = luaL_checkinteger(L, 2); int y = luaL_checkinteger(L, 3); + unsigned scale = luaL_optunsigned(L, 4, 0); if (bitmap) { - lcd->drawBitmap(x, y, bitmap); + lcd->drawBitmap(x, y, bitmap, 0, 0, 0, 0, (float) scale/100); } return 0; @@ -426,7 +429,7 @@ static int luaLcdDrawBitmap(lua_State *L) 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”)