Jump to content




Surface 2 - A powerful graphics library

api computer lua

2 replies to this topic

#1 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 14 February 2017 - 11:29 PM

Surface 2 is the successor to the popular Surface API.
It's been remade completely with an emphasis on flexibility, stability and multi-framework support.
Some features include:
  • ComputerCraft, OpenComputers, Love2D, Redirection Arcade and Riko 4 support
  • RGB and multiple palette support
  • NFT, NFP, BMP and RIF image saving and loading
  • Scaling, rotation, flipping
  • Per-layer transparency
  • Stencil stacks (nested clipping regions)
  • Lots of shapes
  • Sprite maps
  • Pixel fonts and text drawing
Download
pastebin get UxweEuqf surface

You can simply load the library using
local surface = dofile("surface")


Getting started
Surface 2 has extensive documentation and examples to get you started.


An example:
-- Loads Surface 2.
local surface = dofile("surface")

-- Loads the color.bmp image.
local surf = surface.load("home/color.bmp")
-- Converts the colours from RGB to CC, with dithering.
surf:toPalette(surface.palette.cc, true)

-- Creates the screen surface.
local screen = surface.create(57, 19)
-- Draws the image surface with smaller pixels.
screen:drawSurfaceSmall(surf, 0, 0)

-- Outputs the screen surface.
screen:output()
-- Waits for a mouse click.
os.pullEvent("mouse_click")
Produces this:
Posted Image

If you have any questions or suggestions, leave a reply.
All feedback is appreciated :D

Edited by CrazedProgrammer, 15 February 2017 - 10:19 PM.


#2 Joseph Stalin

  • Members
  • 5 posts
  • LocationSoviet Russia

Posted 14 February 2017 - 11:37 PM

Wow, nice! I can't wait to use this. I have a question though, can't you make a cool music visualiser (like cli-visualizer or cava) pane for wave-amp with this?

#3 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 14 February 2017 - 11:45 PM

 Joseph Stalin, on 14 February 2017 - 11:37 PM, said:

Wow, nice! I can't wait to use this. I have a question though, can't you make a cool music visualiser (like cli-visualizer or cava) pane for wave-amp with this?
Thanks!
I certainly could, maybe I will do something like this in the future.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users