Jump to content
How to Install Plugins ×

TR's Croquis V 1.4 (Dwarf Horde Collaboration)


TechnoRobbo

Recommended Posts

TechnoRobbo's Croquis

(Dwarf Horde Collaboration)


​Quick Sketch Filter

3.5 compatible

v1.2 Slider and angle control by Red Ochre

v1.3 RetainColor and Invert Controls by BoltBait

v1.4 Pastel Effect by BoltBait


Menu: Effects->Artistic




CodeLab Source Code (it's a divide algorithm)

Hidden Content:

// Submenu: Artistic
// Name: TRs Croquis
// Title: TRs Croquis - v1.4
// Author: TechnoRobbo & Red Ochre & BoltBait
// URL: http://www.technorobbo.com
#region UICode
int Amount1 = 210; // [0,225] Contrast
int Amount2 = 0; // [0,255] Clip Lo
int Amount3 = 222; // [129,255] Clip Hi
double Amount4 = 0.5; // [0.1,10] Distance
double Amount5 = 45; // [-180,180] Angle
bool Amount6 = false; // [0,1] Retain Color
bool Amount7 = false; // [0,1] Invert
byte Amount8 = 0; // [1] Pastel Action|None|Invert|Rail
#endregion

private UnaryPixelOps.Invert invertOp = new UnaryPixelOps.Invert();

//private BinaryPixelOp multiplyOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Multiply); //for PDN 4
private UserBlendOp multiplyOp = new UserBlendOps.MultiplyBlendOp(); // Multiply for CodeLab 1.8 and Paint.NET 3.5x

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CP;
    Color rgb;
    double k;
    double l;
    float offX = (float)(Amount4 * Math.Cos(Amount5 * Math.PI / 180));
    float offY = (float)(Amount4 * Math.Sin(Amount5 * Math.PI / 180));
    
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CP = src.GetBilinearSampleWrapped((float)x + offX,(float)y + offY);

            rgb = CP.ToColor();
            l = rgb.GetBrightness();

            CP = src[x,y];
            rgb = CP.ToColor();
            k = rgb.GetBrightness();
            k = (k==0)? 0: l/k;
            k *=k;
            k *=255;
            k = (k>255)?255:k;
            double inverse = 255 - Amount1;
            k -= Amount1;
            k = (k<0) ? 0:k;
            k= k * 255 / inverse;
            k =(k < Amount2) ? 0: (k > Amount3) ? 255:k;

            dst[x,y] = ColorBgra.FromBgra((byte)k , (byte)k ,(byte)k, CP.A);
            
            if (Amount7)
            {
                dst[x,y] = invertOp.Apply(dst[x,y]);
            }
            
            if (Amount6)
            {
                dst[x,y] = multiplyOp.Apply(dst[x,y],src[x,y]);
            }
            
            if (Amount8!=0)
            {
                ColorBgra CurrentPixel = dst[x,y];

                PaintDotNet.HsvColor hsv = PaintDotNet.HsvColor.FromColor(CurrentPixel.ToColor());
                int H = hsv.Hue;
                int S = hsv.Saturation;
                int V = hsv.Value;
                byte A = CurrentPixel.A;

                switch (Amount8)
                {
                    case 1: V = 100-V;
                        break;
                    case 2: V = 100;
                        break;
                }

                CurrentPixel = ColorBgra.FromColor(new PaintDotNet.HsvColor(H,S,V).ToColor());
                CurrentPixel.A = A;

                dst[x,y] = CurrentPixel;
            }
        }
    }
}

TRsCroquis.zip

  • Upvote 8

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

Hello TR and thank you.

 

I just tried the filter and somehow I can not get my charcoal to draw like yours. My sketch is very pixelated even when I use the same setting of your video. I guess I need to sharpen the tip of my pencil. :)

croquis-4b80680.png

Link to comment
Share on other sites

I just did it but it did not change much.

- - - - - - - - - - - - -- 

EDIT: I adjusted the levels (more black and white) of the picture before applying the filter and this is what I obtained:croquis01-4b80893.png

Edited by Eli
  • Upvote 1
Link to comment
Share on other sites

lfmdh6l7.png  Techno Robbo! Very nice plugin. Thank you for your effort. 

I have 2 version, with or without color. I hope have done right.   xblf4ioa.gif

 

8hwpwpgs.png

Edited by Seerose
  • Upvote 2

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

So go to one of BoltBaits Post and give him a +1

 

Haha! Thanks!

Here's something to try:

After running the plugin with both check boxes checked, you should get something that looks like colored chalk on an old blackboard. Then run this CodeLab script:

 

// Name: HSV Invert
// Submenu: Color
// Author: BoltBait
// URL: http://www.BoltBait.com
// Keywords: hsv|invert|color
// Title: BoltBait's HSV Quick Invert - v1.0
// Desc: Quickly invert H, S, or V in the HSV color space.
#region UICode
byte Amount1 = 0; // HSV Editing|Invert V|Invert S|Invert H|Maximize S|Maximize V
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra CurrentPixel = src[x,y];

            HsvColor hsv = HsvColor.FromColor(CurrentPixel.ToColor());
            int H = hsv.Hue;
            int S = hsv.Saturation;
            int V = hsv.Value;
            byte A = CurrentPixel.A;

            switch (Amount1)
            {
                case 0: V = 100-V;
                    break;
                case 1: S = 100-S;
                    break;
                case 2: H += 180;
                    if (H>360) H -= 360;
                    break;
                case 3: S = 100;
                    break;
                case 4: V = 100;
                    break;
            }

            CurrentPixel = ColorBgra.FromColor(new HsvColor(H,S,V).ToColor());
            CurrentPixel.A = A;

            dst[x,y] = CurrentPixel;
        }
    }
}
  • Upvote 2
Link to comment
Share on other sites

...Will there be a dll for the script? (I do not understand code)   :roll: . 

 

Today is not 1'st April, but still fun good.gif.

 

...So go to one of BoltBaits Post and give him a +1

Link to comment
Share on other sites

Thanks BoltBait,

 

It really made me sweat the idea of using CodeLAb but I was so curious about the outcome of the script that I decided to try it . So this is the outcome :

croquis-color-chalk1-4b84bd3.png

I added a little gray on another layer.

 

Postedit:

 

I am sorry TR, I just realized that charcoal is... BLACK. 

Edited by Eli
  • Upvote 3
Link to comment
Share on other sites

 

 

I am sorry TR, I just realized that charcoal is... BLACK

At it's base this plugin has a charcoal sketch like result. But that was the outcome not the intent. I changed the description since it's obviously a tool like any other with no real rules on how you eventually use it.

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

Neon-sign-animated.gif

 

I've found it to be quite convenient for producing line art of basic 3D models, like below http://smiles.kolobok.us/standart/derisive.gif

 

reaper_base_and_line_art_side_to_side.jp

 

http://smiles.kolobok.us/artists/just_cuz/JC_you_rock.gifhttp://smiles.kolobok.us/artists/just_cuz/JC_ThankYou.gif

Edited by Maximilian
  • Upvote 4
Link to comment
Share on other sites

 

 

lbqml3v5.png Maximilian! Very pretty presentation. mqlcrqcf.png

  • Upvote 1

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