Jump to content
How to Install Plugins ×

TR's Intense Filtration v 1.3 (Oct 09,2014


TechnoRobbo

Recommended Posts

TechnoRobbo's Intense Filtration v 1.3

PDN 3.5 compatible

 

Based on a Topic conversation about Hue

It's not a hue adjustment it's a color filter and augmenter

 

v1.3 has an anti-clipping algorithm

 

 

Menu: Effects->Color

IntenseFiltration.PNG?raw=1

 

IntenseFiltration2.PNG?raw=1

 

Demo Video

 

CodeLab Source Code

Hidden Content:

 
// Submenu: Color
// Name: TR's Intense Filtration
// Title: TR's Intense Filtration- v1.3
// Author: TechnoRobbo
// URL: http://www.technorobbo.com
 
#region UICode
int Amount1 = 4700; // [0,5999] Hue
double Amount2 = .90; // [0,2] Gain
int Amount3 = 0; // [0,2000] Filter Intensity
byte Amount4 = 0; // [1] Fade To -|Base Image|B&W|Hue
#endregion
 
void Render(Surface dst, Surface src, Rectangle rect)
{
    // Delete any of these lines you don't need
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left;
    int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top;
    ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
    ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
    int BrushWidth = (int)EnvironmentParameters.BrushWidth;
    
        
    float[,] hues = {{1,0,0,1,1,0},
                    {1,1,0,0,1,0},    
                    {0,1,0,0,1,1},       
                    {0,1,1,0,0,1}, 
                    {0,0,1,1,0,1},
                    {1,0,1,1,0,0}};      
                    
    ColorBgra CP;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
 
            float coeff = (float)Amount2;
            float mix =1f - (float)Amount3 / 2000f ;
            
            //hues
            int hueIdx= Amount1/1000;
            float hueshift = (float)(Amount1 % 1000)/1000f;
            float r,g,b;
            r = hues[hueIdx ,3] * hueshift  + hues[hueIdx,0] - hues[hueIdx,0] * hueshift ;
            g = hues[hueIdx ,4 ] * hueshift  + hues[hueIdx ,1] - hues[hueIdx ,1] * hueshift ;
            b = hues[hueIdx ,5] * hueshift  + hues[hueIdx , 2] - hues[hueIdx , 2] * hueshift ;
 
            
            CP = src[x,y];
            
            //hue filtration * gain
            float tmpr = (float)CP.R * coeff * r; 
            tmpr = (tmpr > 255) ? 255: tmpr;
 
            float tmpg = (float)CP.G * coeff * g;  
            tmpg = (tmpg>255) ? 255: tmpg;
 
            float tmpb = (float)CP.B * coeff * b;     
            tmpb = (tmpb>255) ? 255: tmpb;
            
            //grayscale
            float gray = (float)(CP.R + CP.G + CP.B)/3f * coeff ;
            gray = (gray >255) ? 255: gray ;
            
 
            //base image * gain
            float thresh = (coeff>1) ? 128: 255 ;
            float himax = 255f * coeff - thresh ;
            
            float CPR = (float)CP.R * coeff;  
            CPR = (CPR >thresh ) ? (CPR - thresh ) * (255-thresh) /himax  + thresh : CPR;
 
            float CPG = (float)CP.G * coeff;  
            CPG = (CPG >thresh ) ? (CPG - thresh ) * (255-thresh)/himax  + thresh : CPG;
            
            float CPB = (float)CP.B * coeff;  
            CPB = (CPR >thresh ) ? (CPB - thresh ) * (255-thresh)/himax  + thresh : CPB;
            
            //gray * gain
            float graymix = gray/255f;
            float gr = r * graymix * 255 * coeff ;
            gr = (gr >255) ? 255: gr ;
            float gg = g * graymix * 255 * coeff ;
            gg = (gg >255) ? 255: gg ;
            float gb = b * graymix * 255 * coeff ;
            gb = (gb >255)? 255: gb ;
            
 
            if (Amount4==0)
            {
                tmpr = CPR * mix + tmpr - tmpr * mix;
                tmpg = CPG * mix + tmpg - tmpg * mix;
                tmpb = CPB * mix + tmpb - tmpb * mix;
                
            }else if (Amount4==1){
 
                tmpr = gray * mix + tmpr - tmpr * mix;
                tmpg = gray * mix + tmpg - tmpg * mix;
                tmpb = gray * mix + tmpb - tmpb * mix;
                
            }else if (Amount4==2){
 
                tmpr = gr * mix + tmpr - tmpr * mix;
                tmpg = gg * mix + tmpg - tmpg * mix;
                tmpb = gb * mix + tmpb - tmpb * mix;
            }
            CP .R = (byte)tmpr;
            CP .G = (byte)tmpg;
            CP .B = (byte)tmpb;
            CP.A = (byte)CP.A;
            dst[x,y] = CP;
        }
    }
}

 
 
 

TRsIntenseFilteration.zip

  • Upvote 4

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

 

Posted Today, 07:56 PM

Nai, on 03 Oct 2014 - 7:48 PM, said:snapback.png

Where is the download link ?

 

The zip file is attached to the bottom of the first post.

It is now, Nai I was updating to version 1.1  a few minutes ago and you may have seen at at the wrong moment  when I hadn't uploaded the update.

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

TechnoRobbo! I have not been here 2 weeks and so many new beautiful things. Great work, thank you so much.  6ij44rjk.gif

Live as if you were to die tomorrow. Learn as if you were to live forever.

Gandhi

 

mae3426x.png

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