Jump to content




Image Converter

api computer lua

5 replies to this topic

#1 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 14 October 2012 - 06:41 PM

Today I made a little program, which converts a PNG, JPEG, BMP etc. image file into a format, that my API can read, and construct an image from. This image can then be displayed on advanced computers.

These are the functions and variables, that this API let's you use with:
image.createQuad(x, y, w, h) -- returns a new quad_class

quad_class.x -- number
quad_class.y  -- number
quad_class.width  -- number
quad_class.height  -- number



image.createImage(path) -- returns an image_class
image_class:draw() -- draws the image
image_class:drawq(q) -- draws the image with a quad(google it)
image_class:getWidth() -- returns the width of the image
image_class:getHeight() -- returns the height of the image

image_class.x -- number
image_class.y -- number

This is how to use it:
Spoiler

Example of how to use it:
os.loadAPI(shell.resolve("image"))

term.setBackgroundColor(colours.pink)
term.clear()


local img = image.createImage("data/x.ccimg")
img.x = 3
img:draw()

read("")
term.setBackgroundColor(colours.black)
term.clear()
term.setCursorPos(1, 1)

Screenshots:
Spoiler

NOTE: The color LIGHT GREY is NOT supported.
NOTE: This might be very buggy. I have not have time to test this alot, but I hope for the best.

Download(Includes API and converter)

#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 14 October 2012 - 08:12 PM

sounds cool but i dont have 1.45 working :C

#3 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 15 October 2012 - 06:40 AM

Just download the beta :D/>

#4 arronlee

  • New Members
  • 2 posts

Posted 14 May 2013 - 10:08 PM

Thank you for your sharing first.
I will try it later.
But I'm a little confused by your words.
What do yo exactly mean by saying "advanced computers"?
The image can only be displayed on advanced computers?
And what if I'm using an old one?

#5 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 15 May 2013 - 09:49 AM

Your real life computer doesn't matter, but you have to use the advanced computer ingame. Look it up on the Wiki.

#6 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 15 May 2013 - 09:07 PM

I've got to give you credit for this one, I've tried several times to learn the file structures of the common image files, but every time I give up and decide I'd have better luck writing my own image formats. May not have fancy multiple colour passes, but at least I can read the damn things. (That image format thing goes for CC images and real computer images).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users