Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Which libraries should I use?

This thread is locked; no one can reply to it. rss feed Print
Which libraries should I use?
Doctor Cop
Member #16,833
April 2018
avatar

I want to create a paint program, which libraries should I use?

I have an amazing idea for which I need powerful and feature rich libraries.
I don't know how can I implement it without knowing the ability of the libraries but I'm sure to use Allegro5 for UI and main event handling but what else can I use Allegro for?

bamccaig
Member #7,536
July 2006
avatar

Your request is too vague. We call this a "Monday" project because historically we often propose them or ask about them on Mondays. And by Friday the project is abandoned because it was too hard or too much work or the idea wasn't as grand as we thought.

If you don't yet know what other libraries you would need then why do you assume you need other libraries? If you want to create a paint program then start working on it. Don't ask us until you run into a specific problem that you cannot solve. You cannot work on an entire paint program all at once. Nobody can. You need to build any program one piece at a time. If you get distracted looking at the whole thing you'll never get anything done.

You need to use a bit of creativity too. If you cannot figure out how to do simple things on your own then obviously you will not be able to figure out how to do your "amazing idea" either.

This isn't meant to bust your balls. I'm trying to help you focus on something attainable that you can actually achieve. You can always write down your amazing idea, and once you figure out how to get the rest of the program working you can dust it off and try it out. But it'll be a lot more work than you think just to write a paint program from scratch.

Note: there are several open source paint programs already. You may want to play around with the code of those first because it could save you a lot of time if you could skip the whole building a paint program, and jump straight to building your amazing idea for one. You could also learn a lot from them.

Monday projects are a joke around here because we all have these grand ideas, and get excited about new projects, but we never follow through. The most successful projects are always humble secrets until they're already wonderful enough to share.

Edgar Reynaldo
Member #8,592
May 2007
avatar

First of all, here are my feature requests for your paint program ;

1) Persistent layerable objects, that can be manipulated

2) Per layer blending

3) Intelligent magic wand selection, plus tolerance

4) Support for bmp png jpg tga etc...

5) Saving objects and layers to a file

But Paint.NET already does all that. However, only older versions run on anything earlier than Windows 10.

Allegro can draw and display everything you need it to, and when it can't, opengl can, and opengl can be used alongside allegro. Allegro also comes with shader support, which is necessary for many special effects and specialized blending.

The hard part is writing the tools. Pens, brushes, wands, selection tools, color picker, size selection, etc....

Doctor Cop
Member #16,833
April 2018
avatar

thanks bamccaig for the link and yes it's a Monday project.

I just had an idea that I should make a program which can add smoothness to the seen of an anime. But now I found that its already been implemented just that anime studios don't use it. They consider it as a bad design as if it would make anime unpleasant.

jmasterx
Member #11,410
October 2009

The harsh reality is if you can think it, someone's made it - often free.

Gideon Weems
Member #3,925
October 2003

s/harsh/beautiful

Chris Katko
Member #1,881
January 2002
avatar

I want to create a paint program, which libraries should I use?

You NEED a proper file importing and exporting library.

For a game library like Allegro, it's "okay" (though still not ideal) for it to be finicky with file formats. BMP, for example, has many versions spanning decades and some variations of non-standard/different headers, Allegro will barf on. But that's usually okay because 1) You rarely use BMP in 2-D games anymore because PNG is "the" format because it's compressed and lossless. and, 2) If you have an edge case in your game, usually a better editor (or a conversion tool) can simply take the "broken" file and resave it and it works in Allegro.

HOWEVER. If you're making a tool, you've got a problem. You should be able to load EVERYTHING. Your TOOL should not be the finicky one. Except when it's an internal tool that your company made and you HAVE to use it, people are simply going to avoid your tool if they have to be super picky about what files they load.

A paint tool should load an image. End of story. At no point should you, as a user, ever worry if "my bitmap" is the correct version of a bitmap to load--with the sole exception being corrupted files. But when was the last time you even SAW a corrupted file?!

Ironically, Adobe After Effects is such a gigantic piece of !@$! that it can't even load MKV files directly. (KDENLIVE can!) Which happen to be the output file format for my Open Broadcast Software Studio. I could use other formats except... MKV is the BEST format. It supports running out of file space without corrupting the entire file (whereas many formats require "finalizing" by either putting a "header" (footer?) at the end, or, updating the header once the file is done.) As well as other features. So one of the most well known professional products in the industry is too stupid to support many major file formats. But they can get away with it because... they know they're "the big boys" (a "suppliers market") and users will just have to suck it up because there aren't dozens-upon-dozens of competitors to choose from. That is, the opposite case of "I want to make a paint program" which is a users market where choice is king and they can easily ignore your product if you have an arbitrary fault like major file format choice.

I mean, would ANY of us use a paint program that couldn't load PNG and BMP? Or a sound program that couldn't load WAV? None of us would bother using an insanely awesome Amiga paint program if we had to convert all input images to Amiga image format, then work on them, then save them as Amiga, then copy them to a PC and convert them to back to BMP or PNG format. That'd be insane. (Yet that was common practice in the 80's/90's to have to digitize photos with many conversions to the end product! As well as designing on SGI workstations but running on PC / MS-DOS! Apple also required you to use a $10,000 Macintosh Lisa to write software for the more affordable Macintosh 128K in the 80's!)

But I'm digressing. I've made my point. Make sure you can load ANY file formats your users commonly expect. So just get a proper image loading library and figure out how to connect it to Allegro.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Audric
Member #907
January 2001

I don't think bamccaig's original point got the attention it deserves:

bamccaig said:

there are several open source paint programs [www.google.com] already. You may want to play around with the code of those first because it could save you a lot of time if you could skip the whole building a paint program, and jump straight to building your amazing idea for one.

Adding a painting tool to an existing program is certainly way easier than building everything from scratch. Even if the implementation is clunky (such as sacrificing an existing tool) it's an excellent way to test an idea, and see if it justifies further development.

Doctor Cop
Member #16,833
April 2018
avatar

Thanks Chris Katko for the advice and yes Audric I'm onto it.

I am learning some concepts I need to know first, after that i will continue my quest to hack an existing tool and forge it into my own with my ideas.

The things I that I'm learning are :

1. hooking.
2. callbacks.
3. polling.

ZoriaRPG
Member #16,714
July 2017
avatar

Apple also required you to use a $10,000 Macintosh Lisa to write software for the more affordable Macintosh 128K in the 80's!)

Hah!

I still have all of the binders full of Lisa docs. I used to have three of them, and I recall this quite well. I had all of my Mac SW stuff on Twiggy disks. ;)

I dumped Apple dev when they took one on the entire desktop userbase, a few years ago. I pretty much stopped when they phased out PPC, but I still had XServe systems set up for a while thereafter.

I started working on Apple stuff in the days of the Apple II, and through the wilderness years. Now, unless you want to develop for iOS, and their idiotic store, just stay away!

Back on topic:

I want to create a paint program, which libraries should I use?

Why are you latching onto Allegro for this, at all, at all? While AG5 provides some of the kit that you'll need, it's not intended for that sort of thing.

For starters, AG5 doesn't provide the UI stuff that you'll want. (See Eagle5, though.)

Image manipulation tools aren't easy to construct. Rather than a paint clone, perhaps you might start smaller, with a sprite editor, or something of that sort. That kind of tool requires far less to get off of the ground, and there isn't much competition--see: GIMP.

Instead of railroading yourself into a wall, trying to make something wide-scoped, think both smaller, and narrower. You can always build up, once you have something viable.

Edgar Reynaldo
Member #8,592
May 2007
avatar

ZoriaRPG said:

For starters, AG5 doesn't provide the UI stuff that you'll want. (See Eagle5, though.)

There are lots of other options out there too, for User Interface stuff. But for a paint program, all you need is a icon button and a row or column layout and a few miscellaneous color widgets like sliders and color graphs. I remember back in the day when I made my first color picker hue wheel. I thought it was the coolest thing since jello.

{"name":"611764","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/e\/ae28365c716d3be642e5b4a284e9aea2.png","w":802,"h":633,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/e\/ae28365c716d3be642e5b4a284e9aea2"}611764

ZoriaRPG
Member #16,714
July 2017
avatar

I remember back in the day when I made my first color picker hue wheel.

Oooh. Is that using the AG4 0-63 format? Oh, no, I see a value of 64, so it must not be. :/

I was going to ask if we could steal it, as it's heaps better than our present sliders. That 0-63 value range is odd as heck.

Sure, there are other options, including writing your own UI, but my point is that Allegro doesn't provide strong UI features 'out of the box'.

For ZC, we use JWin, written by Jeremy Craner. It's old, and based on the DIALOG implementation seen in say, Grabber, and other included stuff.

Graphic programmes will probably want advanced UI stuff, such as floating and anchorable tooksets. (e.g., attach tyo another toolbarm, or break bree and reposition anywher eon the screen).

You can do that with a series of 2D arrays, or however you want, keeping track of the toolbar position, the widget positions relative to its x/y, and then cursor position relative to both. That requires a lot of forethought, though, and it's a good idea for someone new to this to decide if they want to do all of that work 'up-front', or if they want to use a lib that does all of it for them.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Sure, you can use my color picker if you want.

EDIT
Actually I'll just post it here in case anyone's interested.

It's kind of a mess and was written a long time ago. It just uses some basic vector math to calculate saturation and value and rotation gives you the hue. I'm sure there are way better ways of doing things, but here's the source code and hue wheel demo all packaged up in a zip :

huewheel.zip (src and static win32 binary)

Doctor Cop
Member #16,833
April 2018
avatar

Edgar : thanks for the color wheel. though I'll have to convert it to Allegro 5's format but still thanks for the logic and I already have made many of the GUI functionalities like :- Buttons, radio, check-boxes, etc. I just only lack a text field function, if I ever need a text-box then I may have to approach other libs but for now I'm good.

I'm learning CMake, make and other build and configuration tools, if you know a good tutorial then please refer me, CMake seems too confusing.

jmasterx
Member #11,410
October 2009

Edgar Reynaldo
Member #8,592
May 2007
avatar

CMake's manual kind of sucks. Pages and pages on things you don't need, and the tutorials only scratch the surface.

Use CMake-Gui, and open CMakeLists.txt in a text editor. It will give you more insight than the manual will in this case.

Doctor Cop
Member #16,833
April 2018
avatar

Thanks Edgar and nice stocking cap!

Chris Katko
Member #1,881
January 2002
avatar

I 100% support making your own paint program though. It doesn't matter if other people did it. Doing it yourself is a great learning experience and those skills you learn, you will take with you to your new projects.

Also, ASESprite on Steam uses Allegro! The trial version is free (duh) and supports all major operating systems.

https://www.aseprite.org/

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Doctor Cop
Member #16,833
April 2018
avatar

Thanks Chris for your support. Right now I'm looking for some tutorials which can teach me how to integrate between different APIs. If you don't know then I must tell you that I'm a beginner and I'm struggling through various topics of Software development.

I thought that if I work on some projects then I'll soon master it but whenever I try something it comes out to be very complex and difficult without mostly relying on Allegro 5. I made few small games and a file compression program with the help of Allegro and a minimal compression library (miniz). Whenever I build a third party library I go through dependency hell.

Go to: