Spade-Editor / Spade

Cross-platform raster graphics editor inspired by Paint.NET
GNU General Public License v3.0
41 stars 10 forks source link

ColorChooser Dev thread #78

Closed BurntPizza closed 9 years ago

BurntPizza commented 10 years ago

This will mostly be a progress thread for the ColorChooser, feel free to make comments/suggestions at any point.

Latest progress: ColorComponenets are now linkable via ColorListeners:

circleandslider

https://github.com/BurntPizza/Paint.JAVA/commit/bf8fab51e06a0b065d96d1bb30ab847e66420663

Unfortunately Wheel-to-slider events are being stupid, so they aren't done yet.

ColorChooser test frame is here

BurntPizza commented 10 years ago

Events are now distributed via broadcast from the parent ColorChooser:

pallet

https://github.com/BurntPizza/Paint.JAVA/commit/e761e464313b8149fc546d48a2904b1ce4948bc0

sylvia43 commented 10 years ago

This looks pretty sweet.

BurntPizza commented 10 years ago

Silly Swing, that's not how backbuffers work!

lolswing

HeroesGrave commented 10 years ago

Great work. This is amazing.

BurntPizza commented 10 years ago

Unfortunately I didn't get a whole lot done today, but I did get the primary/secondary selector and the beginnings of a layout:

ui

Also you get to finally see it without the gif artifacts!

https://github.com/BurntPizza/Paint.JAVA/commit/8dde6663ca09130130b59234d634aa4573f747b8

BurntPizza commented 10 years ago

Ok, so I re-worked the events again, I think it's good now. Try it out: ColorChooser.jar

HeroesGrave commented 10 years ago

Took me a minute to glitch it:

To reproduce:

(The hue should still be yellow, but it switches to red)

Also note that the border stays around the pallette colour even though I'm not using it anymore.

Apart from that, it works very nicely.

BurntPizza commented 10 years ago

Download it again (new version)

Both things you mentioned are taken care of :) The pallet will select a color if it has a swatch matching the current primary. I plan on adding keyboard support so that arrows keys or WASD will navigate through the pallet. How does that sound?

HeroesGrave commented 10 years ago

I don't have access to my computer right now so I can't test it right now.

Keyboard support sounds good. Could you also get it to work for the sliders?

HeroesGrave commented 9 years ago

@BurntPizza: I've been trying to merge this in but it doesn't work.

The .jar version you linked above works fine, but the one on your branch doesn't allow any of the sliders or the wheel to be moved.

BurntPizza commented 9 years ago

That's weird... the experimental branch? It's the same code I'm pretty sure.

HeroesGrave commented 9 years ago

Yep. I merged in the experimental branch and ran the main method in ColorChooser.java.

If the last version you uploaded was from the commit marked in your comment (https://github.com/BurntPizza/Paint.JAVA/commit/20b43c5235233f869274d6d1bac27bfdeb16eff0) then the bug must have been introduced somewhere in the last two commits.

Edit: Tried again without the last two commits and it still doesn't work.

HeroesGrave commented 9 years ago

Aha. Found the problem. It was my fault. I changed the MathUtils.clamp() method to take the arguments (value, min, max) instead of (value, max, min) because it was more intuitive.

Sorry about that.

I really need to make it throw an IllegalArgumentException when that happens.

HeroesGrave commented 9 years ago

All working now.

HeroesGrave commented 9 years ago

So far I've added some support for left/right click to change primary/secondary, but obviously it isn't possible to do for the sliders.

I've had a look at the layout, and started work on some more components (number input fields next to the sliders), as well as toggling the visibility of different components to have different level of control.

HeroesGrave commented 9 years ago

I've finished my work for now. Here's some screenshots: http://imgur.com/a/Qq4oS

HeroesGrave commented 9 years ago

Actually, I just realised I forgot a hex colour field. I think I'll ditch the 'Settings' button.

BurntPizza commented 9 years ago

Nice!

Couldn't the Less button disappear in the mini version? Might be able to squeeze something in that way. Same with "More" int the fully extended.

HeroesGrave commented 9 years ago

Turns out the hex input field needed more space than I thought (it wouldn't fit on the minimized versions), so instead I made it popup when you right click on the indicator. (Also supports right clicking the secondary colour)

Also, while I was trying to make some buttons smaller, Swing for some reason decides that + was too big for a button, so it instead replaces the text with ... which is even larger.