1
0
Fork 0
forked from len0rd/rockbox
foxbox/apps/plugins/lua
William Wilgus af35d19916 Rocklua -- Extend / Fix rliImage
Some devices(1-bit / 2-bit displays) have packed bit formats that
 need to be unpacked in order to work on them at a pixel level.

This caused a few issues on 1 & 2-bit devices:
 Greatly Oversized data arrays for bitmaps
 Improper handling of native image data
 Framebuffer data was near unusable without jumping through hoops

Conversion between native addressing and per pixel addressing
 incurs extra overhead but it is much faster to do it
 on the 'C' side rather than in lua.

Not to mention the advantage of a unified interface for the end programer

-------------------------------------------------------------------
Adds a sane way to access each pixel of image data
Adds:
--------------------------------------------------------------------
img:clear([color],[x1],[y1],[x2],[y2])
 (set whole image or a portion to a particular value)
--------------------------------------------------------------------
img:invert([x1],[y1],[x2],[y2])
 (inverts whole image or a portion)
--------------------------------------------------------------------
img:marshal([x1],[y1],[x2],[y2],[funct])
 (calls funct for each point defined by rect of x1,y1 x2,y2
  returns value and allows setting value of each point return
  nil to terminate early)
--------------------------------------------------------------------
img:points([x1],[y1],[x2],[y2],[dx],[dy])
 (returns iterator function that steps delta-x and delta-y pixels each call
  returns value of pixel each call but doesn't allow setting to a new value
  compare to lua pairs method)
--------------------------------------------------------------------
img:copy(src,[x1],[y1],[x2],[y2],[w],[h],[clip][operation][clr/funct])
 (copies all or part of an image -- straight copy or special ops
  optionally calls funct for each point defined by rect of
  x1, y1, w, h and  x2, y2, w, h for dest and src images
  returns value of dst and src and allows setting value of
  each point return nil to terminate early)
--------------------------------------------------------------------
img:line(x1, y1, x2, y2, color)
--------------------------------------------------------------------
img:ellipse(x1, y1, x2, y2, color, [fillcolor]
--------------------------------------------------------------------
Fixed handling of 2-bit vertical integrated screens

Added direct element access for saving / restoring native image etc.

Added more data to tostring() handler and a way to access individual items

Added equals method to see if two variables reference the same image address
(doesn't check if two separate images contain the same 'picture')

Optimized get and set routines

Fixed out of bound x coord access shifting to next line

Added lua include files to expose new functionality

Finished image saving routine

Static allocation of set_viewport struct faster + saves ram over dynamic

Cleaned up code

Fixed pixel get/set for 1/2 bit devices

Fixed handling for 24-bit devices (32?)

-------------------------------------------------------------------------
Example lua script to follow on forums
-------------------------------------------------------------------------

Change-Id: I8a9ff0ff72aacf4b1662767ccb2b312fc355239c
2018-07-23 05:13:32 +02:00
..
include_lua Rocklua -- Extend / Fix rliImage 2018-07-23 05:13:32 +02:00
action_helper.pl Lua: Add pluginlib_actions wrapper for lua scripts. 2012-01-27 09:15:05 +01:00
button_helper.pl Lua: always expose BUTTON_TOUCHSCREEN and remove BUTTON_ constants from rocklib.c 2009-07-03 23:03:07 +00:00
fscanf.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
gmtime.c Limit more variables to file scope 2015-01-11 21:40:51 +01:00
lapi.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lapi.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lauxlib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lauxlib.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lbaselib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lbitlib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lcode.c Fix lua failure to catch divide by zero and NaN exceptions 2018-06-05 18:47:57 +02:00
lcode.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ldebug.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ldebug.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ldo.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ldo.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ldump.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lfunc.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lfunc.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lgc.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lgc.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
liolib.c Lua liolib 2018-05-28 02:36:23 +02:00
llex.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
llex.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
llimits.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lmathlib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lmem.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lmem.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
loadlib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lobject.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lobject.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lopcodes.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lopcodes.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
loslib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lparser.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lparser.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lstate.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lstate.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lstring.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lstring.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lstrlib.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ltable.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ltable.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ltablib.c Fix misleading indentation as pointed out by the new gcc warning 2016-08-12 15:33:28 +02:00
ltm.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
ltm.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lua.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lua.make Rocklua -- Extend / Fix rliImage 2018-07-23 05:13:32 +02:00
luaconf.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
luadir.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
luadir.h FS#11347 by me: *dir LUA functions: luadir module 2010-06-18 13:10:14 +00:00
lualib.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lundump.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lundump.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lvm.c Fix lua failure to catch divide by zero and NaN exceptions 2018-06-05 18:47:57 +02:00
lvm.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lzio.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
lzio.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
Makefile FS#12144, Use -fPIC -fvisibility=hidden only for plugins on sim and app builds and enable it for 32 bit too. Fixes linking errors on simbuilds. 2011-06-07 11:56:23 +00:00
README lua: Switch memory allocator from dl to tlsf 2013-08-26 09:42:47 +02:00
rockaux.c Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). 2010-06-21 16:53:00 +00:00
rockconf.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
rocklib.c Rocklua -- Extend / Fix rliImage 2018-07-23 05:13:32 +02:00
rocklib.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
rocklib_aux.pl Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
rocklibc.h Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
rocklua.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
SOURCES Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
strcspn.c Revert "Update lua plugin to 5.2.3" 2014-04-02 20:46:06 +02:00
strftime.c Fix yellow & red 2009-05-27 23:02:17 +00:00
strncat.c Fix misleading indentation as pointed out by the new gcc warning 2016-08-12 15:33:28 +02:00
strpbrk.c Initial commit of the Samsung YP-R0 port. 2011-12-24 11:56:46 +00:00
strstr.c Commit FS#9174: Lua scripting language by Dan Everton 2009-05-21 19:01:41 +00:00
strtol.c Commit FS#9174: Lua scripting language by Dan Everton 2009-05-21 19:01:41 +00:00
strtoul.c Commit FS#9174: Lua scripting language by Dan Everton 2009-05-21 19:01:41 +00:00
tlsf_helper.c lua: Switch memory allocator from dl to tlsf 2013-08-26 09:42:47 +02:00

The following files are (with slight modifications for Rockbox) from dietlibc
version 0.31 which is licensed under the GPL version 2:

    gmtime.c
    strcspn.c
    strftime.c
    strncat.c
    strpbrk.c
    strtol.c
    strtoul.c
    strstr.c