Code Monkey home page Code Monkey logo

lua-bitmap's Introduction

lua-bitmap

This single-file Lua-only library implements basic read/write support for a subset of the Windows Bitmap/device-independent bitmap file format, version 3.0.

Compatible with Lua5.1, LuaJIT, Lua5.2, Lua5.3, Lua5.4.

Supported file format

Windows Bitmap/device-independent bitmap, version 3.0,

  • 24bpp/32bpp bitmaps only(no 1/2/4/8/16bpp)
  • no bitfields
  • no compression

See doc/FILE_FORMAT.md

Library usage

Library usage is documented in doc/USAGE.md.

Example:

local Bitmap = require("lua-bitmap") -- load module
local bmp = Bitmap.empty_bitmap(width, height, alpha)
--local bmp = Bitmap.from_string(data)
--local bmp = Bitmap.from_file(path)
--local bmp = Bitmap._new_bitmap()
r,g,b,a = bmp:get_pixel(x,y) -- get color value at x,y
bmp:set_pixel(x,y,r,g,b,a) -- set pixel at x,y to r,g,b,a[0-255]

See doc/USAGE.md

Installation

The LuaRocks module is not published on a rocks server yet.

See doc/INSTALLATION.md

Examples

There are currently two runnable examples, bmp2ansi.lua coverts a bitmap to primitive ASCII art, and gen_test_image.lua generates a simple bitmap with a test pattern.

bmp2ansi.lua: doc/examples/bmp2ansi.lua gen_test_image.lua: doc/examples/gen_test_image.lua

See doc/EXAMPLES.md

lua-bitmap's People

Contributors

max1220 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.