Sign in to follow this  
TechnoRobbo

TR's Colorizer HMS Plugin

Recommended Posts

TR's Colorizer HMS Plugin


 


(H=Highlight M=Midtones S=Shadow)


 


Smoothly adjust between 3 Colors to achieve effects from Subtle to Extreme


 


Menu: Effects->Color


 


ColorizerHMSMenu.PNG?raw=1.


 


 


More Mila


ColorizerHMS.png?raw=1


 


 


The Code


 


Hidden Content:



// Submenu: Color
// Name: TR's ColorizerHMS
// Title: TR's ColorizerHMS - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo


#region UICode
ColorBgra Amount1 = ColorBgra.FromBgr(0,0,0); // Shadow
ColorBgra Amount2 = ColorBgra.FromBgr(0,0,0); // Mid Tones
ColorBgra Amount3 = ColorBgra.FromBgr(0,0,0); // Highlights
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{
    
    ColorBgra CP;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CP = src[x,y];
            double ColorAvg=(CP.R + CP.G + CP. /3;
            double interp=Math.Abs(ColorAvg/ 128 - 1);
            if (ColorAvg<128){
                CP.R =(byte)((double)Amount1.R * interp + (double)Amount2.R - (double)Amount2.R * interp);
                  CP.G =(byte)((double)Amount1.G * interp + (double)Amount2.G - (double)Amount2.G * interp);
                  CP.B =(byte)((double)Amount1.B * interp + (double)Amount2.B - (double)Amount2.B * interp);
               }else{
                   CP.R =(byte)((double)Amount3.R * interp + (double)Amount2.R - (double)Amount2.R * interp);
                  CP.G =(byte)((double)Amount3.G * interp + (double)Amount2.G - (double)Amount2.G * interp);
                  CP.B =(byte)((double)Amount3.B * interp + (double)Amount2.B - (double)Amount2.B * interp);
               }
            
            dst[x,y] = CP;
        }
    }
}
 


 


TR'sColorizerHMS.zip

Edited by TechnoRobbo

Share this post


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

Sign in to follow this