Jump to content




PAIN - NFP+NFT+BLT+GIF+UCG support, block characters, undo buffer, fill tool, and an infinite scrollable canvas


56 replies to this topic

#1 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 07 April 2016 - 07:50 PM

Posted Image

pastebin get wJQ7jav0 pain
wget https://github.com/LDDestroier/CC/raw/master/pain.lua
std pb wJQ7jav0 pain
std ld pain pain

Syntax:
pain <filename> [view (displays the picture and exits)] [x] [y] [frameNo]
pain [-n] --no argument will also create new image
pain -h/--help

PAIN is an advanced, yet simple-to-use paint program that can be used to make artwork in ComputerCraft better and faster than ever!
PAIN automatically converts images from NFP (used by paint), NFT (used by npaintpro), BLT (used with the BLittle API), GIF (used with real paint programs), and UCG (used by silica). You can export to these formats too!

It also supports frames, which allows you to save multiple images in the native format and BLT as one file.

Controls:
Spoiler

Screenshots:
Spoiler

The bad stuff...
Spoiler

Demonstration video:

Edited by LDDestroier, 04 February 2020 - 02:05 AM.


#2 supernicejohn

  • Members
  • 98 posts
  • LocationSweden

Posted 08 April 2016 - 12:13 PM

I like it, it's nice to have a scrollable canvas! And with a mouse the controls would be excellent (No middleclick or RMB+scroll on my laptop), I'll have to try it out at home with a mouse.
I think the file format is nice, and saving twice reduces file size sometimes, (it saves a pixel multiple times occasionaly).

Good work! :)

#3 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 08 April 2016 - 12:43 PM

View Postsupernicejohn, on 08 April 2016 - 12:13 PM, said:

I like it, it's nice to have a scrollable canvas!
Thanks! Having a scrollable canvas was one of the reasons I have a table-based saving format.

View Postsupernicejohn, on 08 April 2016 - 12:13 PM, said:

And with a mouse the controls would be excellent (No middleclick or RMB+scroll on my laptop), I'll have to try it out at home with a mouse.
Okay, the controls ARE a bit awkward. I can quickly change it to using LSHIFT or LALT instead of rightclick. But putting down text has to be middle click. On my lapop (which runs Ubuntu), I can middleclick by pressing both laptop buttons at the same time. I guess I could have it so that it detects if you leftclick, then rightclick with leftclick still down.

View Postsupernicejohn, on 08 April 2016 - 12:13 PM, said:

I think the file format is nice, and saving twice reduces file size sometimes, (it saves a pixel multiple times occasionaly).
Saving PAIN pictures was kind of troublesome to code. I needed to make SURE that no two (or more) pixels existed in the same X and Y space. But that's really hard, as it means whenever you save, it loops through the amount of pixels squared. I bet it wouldn't lag so much if I didn't use textutils.serialize to compare tables. I changed the way it finds redundant pixels, and now it works just dandy.

Edited by LDDestroier, 08 April 2016 - 02:11 PM.


#4 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 08 April 2016 - 04:16 PM

Could you explain exit?

#5 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 08 April 2016 - 04:56 PM

View PosteveryOS, on 08 April 2016 - 04:16 PM, said:

Could you explain exit?
Exit is a function that makes animatronic arms shoot out of your monitor, make you toast in your DVD drive (not compatible with CD drives), and pours battery acid down your trousers while blaring a looping clip of Nicolas Cage laughing.


<ontopic>

At the time of posting, I fixed the function that deletes pixels that exist within the same X and Y, clearing space.

#6 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 08 April 2016 - 05:22 PM

View PostLDDestroier, on 08 April 2016 - 04:56 PM, said:

Exit is a function that makes animatronic arms shoot out of your monitor, make you toast in your DVD drive (not compatible with CD drives), and pours battery acid down your trousers while blaring a looping clip of Nicolas Cage laughing.
Thanks (;

#7 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 27 April 2016 - 05:12 PM

New update! I pretty nice one, I might add.
+Added a 'metadata' attribute to each pixel drawn. This is only useful when making a game using PAIN, which I might do.
+Added button combination to fill all blank pixels with your selected colors
+Added button to set scroll back to start (0,0)
+Added button to toggle displaying and saving in grayscale. Note this does not mean PAIN is for normal computers.
*Fixed flickering whenever you press any key or scroll the mouse.
*Spit on it to make it shine

* = fix, + = addition

Edited by LDDestroier, 27 April 2016 - 05:33 PM.


#8 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 28 April 2016 - 12:18 PM

yaya more update

Scrolling is now faster and smoother using a parallel.waitForAny and a table with all the pressed keys.
Also, I changed the background of 'o's to an actual grid! The whole grid is rendered in one long, convoluted line.

#9 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 20 May 2016 - 12:24 PM

if supernicejohn has a mac, why not try using gestures?

also, i'm gonna try out the program :) i'll see if i can get to work with blittle aswell :D

Edited by Bomb Bloke, 21 May 2016 - 01:11 AM.


#10 LoganDark

  • Members
  • 231 posts
  • LocationMacintosh HD/Users/LoganDark

Posted 20 May 2016 - 12:26 PM

Mac OS X has no middle click gesture, and you can't scroll while clicking

Edited by Bomb Bloke, 21 May 2016 - 01:12 AM.


#11 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 20 May 2016 - 12:31 PM

well, ik about it having no middle click but true, you can't scroll while clicking.

Edited by Bomb Bloke, 21 May 2016 - 01:12 AM.


#12 supernicejohn

  • Members
  • 98 posts
  • LocationSweden

Posted 20 May 2016 - 08:33 PM

Just to clear things up, that was on my school computer, a windows machine. I'd prefer to have a mac at school too, but they give them to us for free.
I personally think Mac OS is better, but I think it depends on what you start with. Always had Mac OS (since Classic) and I still like it.
Ontopic, this is a better editor than the default one! The file format allows for some pretty cool stuff!

Edited by Bomb Bloke, 21 May 2016 - 01:10 AM.


#13 LoganDark

  • Members
  • 231 posts
  • LocationMacintosh HD/Users/LoganDark

Posted 20 May 2016 - 09:03 PM

Had windows all my life past the release of Windows 10. Got an 8-year-old MacBook (that's now BROKEN, thanks cousin) and on Feb 21, 2016 got a MacBook Pro. Completely ditched my Windows machine for this thing. Awesome. It can run everything but MC shaders with over 60 FPS (CURSE YOU INEFFICIENT RESOURCE-HOGGING OVERDONE SHADERS)

Edited by Bomb Bloke, 21 May 2016 - 01:10 AM.


#14 supernicejohn

  • Members
  • 98 posts
  • LocationSweden

Posted 20 May 2016 - 10:58 PM

Is it just me or has MC gotten less resource efficient over the years? iMac from 2011 =P ( occasionally Powerbook G4 from 2004 <--- 2fps xD)

Edited by Bomb Bloke, 21 May 2016 - 01:11 AM.


#15 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 20 May 2016 - 11:27 PM

Am I the only one with a semi-good amount of FPS? :o

Posted Image

Edited by Bomb Bloke, 21 May 2016 - 01:08 AM.


#16 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 21 May 2016 - 12:56 AM

View PostH4X0RZ, on 20 May 2016 - 11:27 PM, said:

Am I the only one with a semi-good amount of FPS? :o

Posted Image

Semi-good?

WHAT ARE YOU EVEN DOING HERE I THOUGH WE WERE TALKING ABOUT BAD FPS xD

(though seriously, how'd you get it that high? any certain graphics card?)

ontopic (lol):

Thanks heaps for making this program, it can be so useful :D I was thinking of using it with blittle since with the normal paint you can't get as big of pictures.

Edited by Bomb Bloke, 21 May 2016 - 01:09 AM.


#17 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 21 May 2016 - 01:14 AM

C-C-C-Combo edit! Yeah, let's not abuse the forum quote feature.

View PostWaitdev_, on 21 May 2016 - 12:56 AM, said:

I was thinking of using it with blittle since with the normal paint you can't get as big of pictures.

Easier said than done; how will you target which "pixels" you want to draw to? ;)

Sure, you could use BLittle to draw a "preview" next to your main drawing area, but then you've got even less screen space to actually work in...

#18 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 21 May 2016 - 01:46 AM

View PostBomb Bloke, on 21 May 2016 - 01:14 AM, said:

C-C-C-Combo edit! Yeah, let's not abuse the forum quote feature..
what do you mean by that?

and as for the pixel targeting, i mean paint something normal size, then scale it down in a different program:

Posted Image

#19 LoganDark

  • Members
  • 231 posts
  • LocationMacintosh HD/Users/LoganDark

Posted 21 May 2016 - 03:00 AM

View PostBomb Bloke, on 21 May 2016 - 01:14 AM, said:

C-C-C-Combo edit! Yeah, let's not abuse the forum quote feature.
First of all, we weren't abusing it.
Second of all, it wasn't causing any trouble.
Third of all, you don't need to "C-C-C-Combo Edit!" it.

Edited by LoganDark, 16 June 2016 - 02:06 AM.


#20 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 21 May 2016 - 03:09 AM

View PostLoganDark, on 21 May 2016 - 03:00 AM, said:

First of all, we weren't abusing it.
Second of all, it wasn't causing any trouble.
Third of all, you don't need to "C-C-C-Combo Edit!" it.

Having to scroll through the same text repeated half a dozen times is annoying.

Netiquette! :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users