Ed Harvey Posted December 21, 2006 Share Posted December 21, 2006 I've been meaning to post this for ages, but I always forgot... Here are a lot of the cool blend modes that Photoshop has, but Paint.NET is missing (horrible grammar, but it's 9am and I've been working all night!) I missed them, and so took the time to code them up These are just code snippets for UserBlendOps.Generated.H.cs - you will also need to add the appropriate DEFINE_STANDARD_OP and name resources. This is probably of limited use unless you know your way around the codebase , but someone might benefit... //Copyright EdHarvey 2006 //DWTFYWWI LICENSE V1. #define HARDLIGHT(A, B, r) \ { \ if (( < 128) \ { \ INT_SCALE(2 * (, (A), r); \ } \ else \ { \ INT_SCALE(2 * (255 - (), 255 - (A), r); \ r = 255 - r; \ } \ } #define SOFTLIGHT(A, B, r) \ { \ int r1 = ((255-() * (A) * ();\ int r2 = ( * (65535-((255-(A)) * (255-())); \ int r3 = r1 + r2 + 32768; \ r = r3 >> 16; \ } #define HARDMIX(A, B, r) \ { \ if (((A)+() <= 255) \ { \ r = 0; \ } \ else \ { \ r = 255; \ } \ } #define EXCLUSION(A, B, r) \ { \ int r1=((255 - () * (A)); \ int r2=(( * (255 - (A))); \ int r3 = r1 + r2;\ r = r3>>8; \ } #define LINEARBURN(A, B, r) \ { \ int sum = (A)+(; \ if (sum <= 255) \ { \ r = 0; \ } \ else \ { \ r = sum - 256; \ } \ } #define LINEARDODGE(A, B, r) \ { \ int sum = (A)+(; \ if (sum >= 255) \ { \ r = 255; \ } \ else \ { \ r = sum; \ } \ } #define LINEARLIGHT(A, B, r) \ { \ r = ((2*A)+(-256); \ if (r > 255) \ { \ r = 255; \ } \ else if (r < 0) \ { \ r = 0; \ } \ } #define PINLIGHT(A, B, r) \ { \ if ((A) < 128) \ { \ r = Math.Min(A*2, ; \ } \ else \ { \ r = Math.Max((A-128)*2, ; \ } \ } #define VIVIDLIGHT(A, B, r) \ { \ if ((A) < 128) \ { \ if ((A) == 0) \ { \ r = 0; \ } \ else \ { \ INT_DIV(((255 - () * 255), (2*A), r); \ r = 255 - r; \ r = Math.Max(0, r); \ } \ } \ else \ { \ if ((A) == 255) \ { \ r = 255; \ } \ else \ { \ INT_DIV((( * 255), (255 - ((A-128)*2)), r); \ r = Math.Min(255, r); \ } \ } \ } #define SOFTDODGE(A, B, r) \ { \ int sum = (A)+(; \ if (sum < 256) \ { \ if (( == 255) \ { \ r = 255; \ } \ else \ { \ int c = ((A) << 7) / (255-(); \ if (c > 255) \ { \ r = 255; \ } \ else \ { \ r = c; \ } \ } \ } \ else \ { \ int c = 255 - (((255-() << 7) / (A)); \ if (c < 0) \ { \ r = 0; \ } \ else \ { \ r = c; \ } \ } \ } #define SOFTBURN(A, B, r) \ { \ int a1 = 255-(A); \ int b1 = 255-(; \ int r1=0; \ int sum = a1+b1; \ if (sum < 256) \ { \ if (b1 == 255) \ { \ r1 = 255; \ } \ else \ { \ int c = (a1 << 7) / (255-b1); \ if (c > 255) \ { \ r1 = 255; \ } \ else \ { \ r1 = c; \ } \ } \ } \ else \ { \ int c = 255 - (((255-b1) << 7) / a1); \ if (c < 0) \ { \ r1 = 0; \ } \ else \ { \ r1 = c; \ } \ } \ r = 255-r1; \ } #define SOFTMULTIPLY(A, B, r) \ { \ int rx = (A) * (; \ r = (byte)Math.Sqrt(rx); \ } Quote Link to comment Share on other sites More sharing options...
usedHONDA Posted December 21, 2006 Share Posted December 21, 2006 Can you do that to winxp.exe? Quote "The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Ezra Pound twtr | dA | tmblr | yt | fb Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 22, 2006 Share Posted December 22, 2006 If you make modifications like this, you won't be able to share files that use these blend modes with people that have "regular" Paint.NET installed. The files just won't work. Just an FYI. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
BoltBait Posted December 22, 2006 Share Posted December 22, 2006 I guess that means you need to include them in the standard build... Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 22, 2006 Share Posted December 22, 2006 Well there's no way they can make it in for 3.0 -- everything's locked down. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Ed Harvey Posted December 22, 2006 Author Share Posted December 22, 2006 If you make modifications like this, you won't be able to share files that use these blend modes with people that have "regular" Paint.NET installed. The files just won't work. Just an FYI. Absolutely - I have the new modes listed after the official ones and the names have an asterisk at the start specifically to remind me not to use them for 'public' stuff Quote Link to comment Share on other sites More sharing options...
Ed Harvey Posted December 22, 2006 Author Share Posted December 22, 2006 Well there's no way they can make it in for 3.0 -- everything's locked down. Yeah, and you wouldn't want to just tack them on as I did; The blend mode drop-down needs to be enhanced because the usability is pretty dreadful with ~20 items in one 'lump' :shock: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.