Sign in to follow this  
Followers 0
Red ochre

Scintillate (new 24th Aug 13) - may hurt your eyes!

10 posts in this topic

omgpOjb.png
DukOQck.png
Scintillate: Alternately inverts the colours of an image in a tiltable pattern. At small sizes gives a strange moving effect that will probably give you migraine!

Good results on spectrum gradients and interesting patterns when run repeatedly (with different settings) on the same image.
Note: Image resoloution affects the 'scintillation' and jpeg compression generally wipes it out. Also resizing down is problematic. These images will probably change if you resize your browser.

Have fun!

Found under Effects/Stylize. Dll name = scintillate.



Nearly forgot the code:

Hidden Content:
/* =================================================== */
/*     */
/* Scintillate    */
/* (c) 2013 Red Ochre     */
/*     */
/* Description: inverts alternating pixels      */
/*     */
/* ========================================== ======== */

// Name: Scintillate
// Author: Red ochre (John Robbins)
// Submenu: Stylize
// URL: http://www.getpaint.net/redirect/plugins.html
// Title: Scintillate                     Aug 2013        Red Ochre


#region UICode
byte Amount1 = 0; // [1] Pattern|alternate squares|micro-lattice
double Amount2 = 0; // [0,90] Angle
int Amount3 = 20; // [1,100] Size
bool Amount4 = false; // [0,1] Offset pattern
bool Amount5 = false; // [0,1] Invert alpha
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{  
    Rectangle sel = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    int H = sel.Bottom - sel.Top;
    int W = sel.Right - sel.Left;
    ColorBgra cp;    // current pixel
    int B,G,R,A;
    double angle = Math.PI * Amount2/180;
    int K = Amount3;
    double deg90 = Math.PI /2;
    double sina = Math.Sin(angle);
    double sinb = Math.Sin(deg90 - angle);
    double cosa = Math.Cos(angle);
    double cosb = Math.Cos(deg90 - angle);
    int Ox = (int)(sel.Left + (W/2));
    int Oy = (int)(sel.Top + (H/2));

    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        { 
            cp = src[x,y];B = cp.B;G = cp.G;R = cp.R;A = cp.A;
            
          
            int cX =   x  - Ox;   
            int cY =   y  - Oy; 
            double X = ((cX * cosa) + (-cY * cosb));//will be +ve and -ve
            double Y = ((cX * sina) + (cY * sinb)) ;
            
            if(angle == 0){X = cX;Y = cY;}//to get around odd pattern caused by inaccuarcy in trig funcs?

            X = X/K;Y = Y/K;//grid size 
         
            bool Inv = false;
           
            if(Y < 0){Y = -Y + 1;}
            if(X < 0){X = -X + 1;}
          switch(Amount1)
            {case 0:
             if(Y%2 < 1){X = X + 1;}
             if(X%2 < 1){Inv = true;}
             break;
             case 1:
             if(X%2 < 1||Y%2 < 1){Inv = true;} 
             break;
            }
           
            if(!Amount4 && Inv){B = 255 - B;G = 255 - G;R = 255 - R;if(Amount5){A = A - 255;}} 
            if(Amount4 && !Inv){B = 255 - B;G = 255 - G;R = 255 - R;if(Amount5){A = A - 255;}} 

            // re assemble
            cp = ColorBgra.FromBgra( Int32Util.ClampToByte(, Int32Util.ClampToByte(G), Int32Util.ClampToByte(R), Int32Util.ClampToByte(A));
            dst[x,y] = cp;
        }
    }
}


2

Share this post


Link to post
Share on other sites

Oooo - a new toy to play with :PaintBrushTool: I thank you and am off to play :smile: .

0

Share this post


Link to post
Share on other sites

EER, Drew',Pixey, BBQ & TR - many thanks for the support!

 

EER & TR - no-one has noticed my deliberate mistake in the code yet? :D

 

Hidden Content:

(I didn't invert the alpha correctly - really makes no difference as A = 0 is probably all that's needed.)

0

Share this post


Link to post
Share on other sites

Seerose, this is an English only forum.  We mean no disrespect, but the moderators are all English speakers and it's more difficult to moderate posts in other languages.  I translated your post, but please keep that in mind in the future.

0

Share this post


Link to post
Share on other sites

Seerose, this is an English only forum.  We mean no disrespect, but the moderators are all English speakers and it's more difficult to moderate posts in other languages.  I translated your post, but please keep that in mind in the future.

Okay, thank you.  :scanner: 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0