Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
pedrosgali

Paint Plus. ++Now with a library to load the pictures!++

Recommended Posts

**UPDATED**

++Now With Image Lib!!++

 

DrawPlus - http://pastebin.com/3CKz7MDy

 

Image library - http://pastebin.com/yxCUs4hw

 

Call this program with a filename, a width and a height eg: paintPlus myMasterpiece 100 50.

You can leave the numbers out if you are calling a previously saved picture eg: paintPlus myMasterpiece

 

The image library goes in your /lib folder and is used just like this:

local img = require "imglib" --or whatever you called it..

local data = img.load("/Images/yourImage")
img.draw(data, x, y) --x and y being where you want it.

All images loaded by the image lib will be compressed to save your precious RAM. I got it down to about a third of the size of the image! :)

 

"Lets paint a happy little tree here" - Bob Ross.

 

2014_07_14_21_56_32.png

 

Features:

 

Menu:

This is a menu to navigate the features. right click anywhere to toggle visibility of the menu.

 

Palette:

Supports up to 99 palettes of 9 colours (more slots than there are colours by far.)

use the screen buttons < > to navigate the active palettes or use "New" to add a palette to the end of the list

right click on a colour in the palette to bring up the RGB chooser.

 

RGB cooser:

3 sets of buttons to control the RGB. click "Ok" to apply or "Exit" to cancel.

 

Save:

Does what you think it does.

 

Load:

Brings up the file browser to select a different masterpiece.

 

Tools:

Gives 4 basic tool types,

 

Brush.

Edit brush size x and y

 

Line.

Click once to set start point then again to set end point.

 

Box.

Click once to set start point then again to set end point.

 

Circle.

edit radius and choose filled or hollow.

 

Layers:

Brings up the layer menu.  Use "New Layer" to add a new layer to the image. All pixels in the new layer will be set to transparent initially.

Click on a layer number to change the active layer and press the red "H" to show a layer or the green "V" to hide a layer.

Each page only shows up to 10 layers so use "<" and ">" to switch pages.

if you make a mistake on a layer then press "Trans" to toggle transparency as the active colour.

 

Animate:

Hit "Play" to go through each cell layer by layer.

Hit "Loop" to have it loop.  Click on the screen again to stop playback.

Link to post
Share on other sites

Updated to add Layering and animations

 

 

A note on animations:

 

After a bit of testing I have found that animations that run smoothly are a balancing act between image size and the overall complexity of the image.

Full screen is completely out of the picture, I designed these animations to be played in "windows" as a game dev tool. (Watch this space.)

The largest I have tried so far is 30 x 15 and managed about 4 fps.

I am working on a new render method at the minute which is faster but a bit buggy so I've posted the stable but slower version. 

 

The next update will have a render compiler and a stand alone player as I have noticed that these animations can get quite big.

That 30 x 15 with 21 layers came in at 313.5K!

Link to post
Share on other sites

Hey guys, finally added the library for calling images yourself. :)

Sorry it took so long but I wrote a new compression method that will save you a lot of RAM, this is done automatically on loading an image.  It also required a new render method which is only marginally faster but still a little faster.

Happy painting :)

Link to post
Share on other sites

Why the pixels are not square?

local component = require('component')
local event = require('event')
local gpu = component.gpu
local color = 0xFF0000
local tSize = {gpu.getResolution()}

local function clear()
  gpu.setBackground(0x000000)
  gpu.setForeground(0x000000)
  gpu.fill(1, 1, tSize[1], tSize[2], ' ')
end

clear()

while 1 do
  local e = {event.pull()}
  if e[1] == 'touch' or e[1] == 'drag' or e[1] == 'drop' then
    local pixel = {gpu.get(e[3], e[4])}
    if e[5] == 0 then
      gpu.setForeground(color)
      gpu.setBackground(pixel[3])
      gpu.set(e[3], e[4], 'â–„')
    elseif e[5] == 1 then
      gpu.setForeground(pixel[2])
      gpu.setBackground(color)
      gpu.set(e[3], e[4], 'â–„')  
    end
  end
end

Just an idea

Link to post
Share on other sites

Awesome program.

Can you release this program on github?

I'd like to integrate this program and imageLibrary in my GUI-API but therefore I'd need one feature:  Drawing of a specific area of the image

And can you add a menu to save the file with a filename? And maybe an exit-button?

 

And i found a bug that should be fixed: as soon as i press any key the program just exits.. I can't insert any char into the image.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.