Jump to content
How to Install Plugins ×

TR's Quick Outliner (Aug 21, 2015)


TechnoRobbo

Recommended Posts

TechnoRobbo's Quick Outliner

Like the Doctor said "Don't Blink"

 

version 1.5 adjusts for very small selections (thanks to Midora)

version 1.4 fixes a typo

Version 1.3 Soft Edge*, Color Wheels and Fill

suggestions by Eli

*(Increasing the Softness will slow down render)

 

Menu: Effects - Selection

 

 

New features

 

Source Code

Hidden Content:
// Submenu: Selection
// Name: TR's QuickOutLiner 
// Title: TR's QuickOutLiner - V 1.5
// Author: TechnoRobbo
// URL: http://www.technorobbo.com
#region UICode
ColorBgra Amount1 = ColorBgra.FromBgr(0,0,0); // Line Color
ColorBgra Amount2 = ColorBgra.FromBgr(0,0,0); // Fill Color
double Amount3 = 2; // [1,50] Line Thickness
int Amount4 = 1; // [1,50] Softness(Can Slow Render)
bool Amount5 = false; // [0,1] Fill Shape
string Amount6 = ""; // [0,255] 
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{
   
    if (!Amount6.Equals(String.Empty))return;
    Amount6="Onepass";
    
    dst.CopySurface(src);
    if (IsCancelRequested) return;
    PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); 
    RectangleF sel = EnvironmentParameters.GetSelection(src.Bounds).GetBounds();
    ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
    ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor; 
    RectangleF[] baseBlocks =selectionRegion.GetRegionScans();
    using (System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath())
    {
        path.AddRectangles(baseBlocks);
        path.Widen(new Pen(Color.Black,2));
        using (Region r = new Region(path))
        {
            using ( Region r2 = new Region(selectionRegion.GetRegionData()))
            {
                r.Exclude(r2);
            }
            baseBlocks = r.GetRegionScans(new System.Drawing.Drawing2D.Matrix());
        }
        
    }
    if (IsCancelRequested) return;
    using (Graphics g =new RenderArgs(dst).Graphics)
    {
        g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
        using (System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath())
        {
           
            path.AddRectangles(baseBlocks);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;      
            g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
         
            g.Clip =new Region( selectionRegion.GetRegionData());
            if (Amount5) g.FillRegion(new SolidBrush(Amount2.ToColor()),g.Clip);
            if (IsCancelRequested) return;
            using (Pen p = new Pen(Amount1.ToColor()))
            {   
                if (Amount4 > 1)
                {
                    int alpha = (int)(255f / (float)Amount4); 
                    for (int blur = 0 ;blur < Amount4; blur++)
                    {
                        if (IsCancelRequested) return;
                        using (Pen p2 = new Pen(Color.FromArgb(alpha, Amount1.ToColor())))
                        {
                            p2.Width = (float)Amount3 + (Amount4 - blur);
                            g.DrawPath(p2,path);               
                        }
                    }
                }
                
                p.Width = (float)Amount3;
                g.DrawPath(p,path);
            }
         }
    }
}
 

TRsQuickOutline.zip

  • Upvote 5

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

I like it!

 

Excuse my ignorance, but what's point of the text box? Have a return in the code if there's something typed in it....why? I think I'm missing something.

 

Thanks for posting the source. I learned something about rending a Graphics object to the destination surface. This will help me on a effect I've been wanting to make. :D

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

I may be alone in this opinion, but I think it would be better to have the Softness default set to 1.

 

Typo on the string for Line Color

ColorBgra Amount1 = ColorBgra.FromBgr(0,0,0); // Line Thickness

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

TechnoRobbo! Thank you for the plugin and for your effort.  psdi5ur6.gif

 

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

  • 1 month later...
  • 2 weeks later...

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