Jump to content

Pallet not loading properly


Recommended Posts

So, I was trying to create a custom pallet and found an issue. For reference, here is the file I created (Rainbow.txt):

; Paint.NET Palette File
; Lines that start with a semicolon are comments
; Colors are written as 8-digit hexadecimal numbers: aarrggbb
; For example, this would specify green: FF00FF00
; The alpha ('aa') value specifies how transparent a color is. FF is fully opaque, 00 is fully transparent.
; A palette must consist of ninety six (96) colors. If there are less than this, the remaining color
; slots will be set to white (FFFFFFFF). If there are more, then the remaining colors will be ignored.
FFFFD8D8
FFFFA8A8
FFFF7777
FFFF3A3A
FFFF0000
FFC10000
FF890000
FF4C0000
FFD8FFFF
FFA8FFFF
FF77FFFF
FF3AFFFF
FF00FFFF
FF00BABA
FF008282
FF004444
FFFFDDBF
FFFFBB7F
FFFF8E2B
FFCC6200
FFB55700
FF914800
FF683400
FF381C00
FFD8F1FF
FFA8E0FF
FF77CFFF
FF3ABAFF
FF00A5FF
FF0077B7
FF00527F
FF002F47
FFFFFFD8
FFFFFFA8
FFFFFF77
FFFFFF3A
FFFFFF00
FFBCBC00
FF848400
FF4F4F00
FFD8D8FF
FFA8A8FF
FF7777FF
FF3A3AFF
FF0000FF
FF0000BF
FF000087
FF000051
FFF7FFD8
FFEDFFA8
FFE3FF77
FFD7FF3A
FFCCFF00
FF96BC00
FF6A8400
FF3F4F00
FFE5D8FF
FFC5A8FF
FFA477FF
FF7C3AFF
FF5900FF
FF3E00BC
FF2D0087
FF1B0051
FFD8FFDF
FFA8FFB8
FF77FF90
FF3AFF5E
FF00FF2E
FF00BF23
FF008718
FF00510E
FFFFD8FF
FFFFA8FF
FFFF77FF
FFFF3AFF
FFFF00FF
FFBC00BC
FF840084
FF4F004F
FFE0E0E0
FFC0C0C0
FFA0A0A0
FF808080
FF606060
FF404040
FF202020
FF000000
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF

I noticed that the shades of gray were not being loaded properly.

Here is a quick way to see the issue:

1) Open the color docker and click More>> to expand the box

2) Enter the hex value 202020

3) Save that color into an empty spot on your pallet

4) Select another color on your pallet (like blue or red or something)

5) Select the dark gray color you created in step 3

Notice that the hex value is different than what you created. :?

For me, it comes up as 1E1E1E.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Hmmm, yeah, I get this too. Funny thing is, the "web safe" grey tones seem to work fine.

For example:

303030 -> 2d2d2d

333333 -> 333333

And:

777777 -> 757575

999999 -> 999999

aaaaaa -> a8a8a8

cccccc -> cccccc

Odd...

(format: [hexbox pre-save] -> [hexbox post save])

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

I think you'll find them to be the exact same colour.. well I drew two filled rectangles, one with 202020 and one with 1E1E1E, and they were both the same. Also, if you change your Hex to 202020 and draw a filled rect, then use the eyedropper.. it's 1E1E1E. Maybe it's an automatic conversion or something like that. It doesn't really matter though because they're the same color.

If you're not into numbers, call me Chris!

Link to comment
Share on other sites

Here is a temp. fix. Just click the color twice...

Haha. Nice find. :D

It may be related to setting the HSV sliders when the color well is clicked. I noticed that the HSV color slider does not move when you click the color well the second time. Perhaps, updating the HSV slider is causing an event to fire that then updates the RGB sliders? If so, you're lucky that you didn't cause an endless loop! :D

Is there no direct link (one-to-one relationship) between RGB and HSV? Is there an easy way to convert from one to another? I found this RGB to HSV / HSV to RGB sample code, but I really don't have much expirence color model conversions.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

It's like the deal of thirds

1

3

2

3

3

3

3/3 = .9 repeating, not one, although simplifying it brings one...

so there is no exact even integer for some RBG colors because the value scale only goes to 100...

I suppose when a color is loaded, it first enters the RBG value. It then evens out the HSV sliders to find that. Now since you have not corrected the RBG again because the V slider will be at an even integer, not the exact decimal, the hex will be corrected accoring to the HSV...

Rick? Somebody? Help me!!!

~~

Link to comment
Share on other sites

And yes, 3/3 = 1. Exactly. No ifs ands or buts :)

However, if you take the floating point approximation of 1/3 and multiply it by 3 then you are not certain to get 1.0.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Bleh! I hate this stuff. You're right -- the colors are wonky.

"Wonkey". Heh. I learned a new word today. :D

Rick, would it be possible to fix this by calculating and loading the HSV values first, THEN load the originally requested RGB values?

Of course, you may need to do the same thing when adjusting the RGB sliders manually (or entering RGB/HEX values manually).

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Since the HSV values seem to be less accurate, I was just thinking that update order may be a quick fix.

It could be, I just haven't looked into it yet :) Sometimes I like to do things like watch TV when I get home! There was a new episode of House and whatnot.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

TV? What's that?

I work full-time at Intel, then I go to my wife's business and work full-time. (At least I have the kids with me for the second shift, otherwise I'd never see them.)

Then its an hour drive home, sleep 4 hours, wake up and do it all again. :?

If I wasn't married, have 2 kids, and work 2 full-time jobs, I'd probably finish version 2.0 of my dominoes game. :D

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

When the UserPrimaryColor property is set, it eventually calls a function called SyncHsvFromRgb() which then does the RGB->HSV conversion and sets the controls. Unfortunately there was some code in there that was not suppressing some Changed events, and so the RGB controls were being sync'd again from the HSV stuff. So I had to add in some logic to make it ignore these changes.

15 minutes and 4 lines of code.

That other bug about the PDN images opening and showing a white thumbnail took 6 times as long time fix, what a nightmare.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
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.

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.

×
×
  • Create New...