Jump to content

Working on a Reverse Opacity plugin -> Question about blending modes


Go to solution Solved by Rick Brewster,

Recommended Posts

  • 3 weeks later...

Sorry to bother you again, but I was wondering if you could point me in the direction of some resources for / fill me in on HSV blending.

 

Paint.Net seems to support HsvColors, albeit as a second class citizen, and I've found that reversing opacity through HSV (as an option) gives interesting, possibly better results, if the original image had been made in an application whose primary color space was HSV.

 

Additionally, should I support CMYK reverse opacity as well?

Link to comment
Share on other sites

The upcoming update, v4.4, will actually make working with HSV a lot easier.

 

Effects will be able to use Direct2D, including its robust imaging/effects system. There are effects built-in to Direct2D that handle conversion to and from RGB and HSV/HSL. See here and here. And you get full 32-bit floating-point precision per component. On top of that you can write pixel shaders to create your own Direct2D effects that you combine with other Direct2D effects.

 

I don't really know anything about blending in HSV though. I would probably convert to RGB and do the blending there, although obviously the precision afforded by integers in the current release of PDN are not too friendly for that.

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

Indeed.

 

There are some things which trouble me about HSV: Colors approaching white all feature low saturation. But what is the equation that is used to desaturate a color when approaching white? To reverse this, I would need to add saturation to a color.

 

And how should hue be calculated, if it's based off of a 360 degree circle? If I have a hue at 0 and 180 degrees, which halfway point (90 degrees or 270 degrees) is correct? Should I use RGB blending for hints here?

Link to comment
Share on other sites

I do not know the answers to these questions. I am not an expert on HSV/HLS :) Also, it really depends on what you're trying to accomplish. 

 

I suspect that "blending" isn't something you can really do in HSV/HLS color space, at least for Hue, because the coordinate system loops back on itself. I think that's called a closed coordinate system. For any two coordinates that are 180 degrees apart, there are two answers for "what's the halfway point?" Trying to take a simple average, (a+b)/2 will give obviously wrong results in may cases, especially for 0 and 180, or even 1 and 359.

 

But, I don't know. I would just go spelunking in Google to see what you can find out.

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

1 hour ago, Rick Brewster said:

I suspect that "blending" isn't something you can really do in HSV/HLS color space, at least for Hue, because the coordinate system loops back on itself.

 

Applying blending modes isn't dependent on color space. You can use blending modes within any color space. You do have a point that HS* are a closed system, but that can be addressed by taking that into account. It's just not easy to do it at times, and this is why no one bothers (including myself, and I take the easy way out when doing this). HSV blending can be resolved by operating on another color space like YUV/YIQ/YCbCr, and the result can be close enough.

  • Like 2

G'MIC Filter Developer

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...