Paint.NET

Welcome to the Paint.NET forum!
It is currently Sun Nov 22, 2009 10:51 am

All times are UTC


Forum rules


Questions or problems with plugin installation? Click here.



Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Border / Stroke Effect Updated 5/21/2007
PostPosted: Fri May 18, 2007 3:16 pm 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
This "effect" will draw a border around image or selection with your primary color. This is like the feature in photoshop were you can "stroke" a selection. It had option to stroke outside, middle or inside. This does inside only. Perhaps I can make changes to give those options. Other enhancement would be so it can work with circular and lasso selections, not sure how I can do that yet.

Simple process, has a size from 1-25 and an option to make it dashed.

After border is created, distort and blur effects can be used to make it look much more interesting, that is were you get creative.

DLL is here - Effect is under Render -> Border.

Here are some screenshots with descriptions of what I remembered being applied:

Normal
Image
Dashed
Image
Dashed border, Clouds on selection, Waves, Dents
Image
Dashed border, Clouds on selection, Dents, Curves
Image
Waves
Image
Radial Blur
Image

Edit: Update 5/21/2007
**********************************
Added 2 new modes, since the dashed wasn't really dashed.
- There is now line, broken (old dashed), dotted and dashed.
Increased width option from 0-25 to 0-200.

*new screenshot added below
**********************************
Image

Edit. source code, codelab. Updated source added.
Code:
int Amount1=5; //[1,200]Thickness
int Amount2=0; //[0,3]Line      Broken      Dotted      Dashed

void Render(Surface dst, Surface src, Rectangle rect)
{
    // User Interface elements
    int GridSize = Amount1;
   bool line = (Amount2 == 0);
    bool broken = (Amount2 == 1);
   bool dotted = (Amount2 == 2);
   bool dashed = (Amount2 == 3);
    // Other variables
    PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    ColorBgra CurrentPixel;
    ColorBgra PrimaryColor;
    ColorBgra SecondaryColor;

    // Get the current brush width
   bool fill = false;
   
    // Grab the primary and secondary colors (swapping if specified in the UI)
    PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
    SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;


   if ( ( dotted ) || ( dashed ) || ( broken ) )
   {
      if ( GridSize == 1 )
      {
         GridSize = 2;
      }
   }
   
   int fillwidth = GridSize/2;
   if ( ( broken ) || ( line ) )
   {
      fillwidth = GridSize;
   }
   // Loop through all the pixels
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
      for (int x = rect.Left; x < rect.Right; x++)
      {
         // Only work with a pixel if it is selected
         // (this handles convex & concave selections)
         if (selectionRegion.IsVisible(x, y))
         {
            // Get the source pixel
            CurrentPixel = src[x,y];
            fill = false;
            if ( ( x < selection.Left + fillwidth ) || ( x >= selection.Right - fillwidth ) )
            {
               if ( dashed )
               {
                  fill = true;
                  int div = rect.Top / GridSize;
                  bool even = false;
                  if ( div % 2 == 0 )
                  {
                        even = true;
                     }
                  
                  if ( !even )
                  {
                        fill = false;
                  }
                                 
               }
               else if ( ( broken ) || ( dotted ) )
               {
                  fill = false;
                  int pos = ( selection.Bottom - ( selection.Bottom - y )  ) % (GridSize-1);
                  if ( ( pos == 0 ) || ( pos < GridSize/2 ) )
                  {
                     fill = true;
                  }
               }
               else
               {
                  fill = true;
               }
            }
            else if ( (  y <= selection.Top + fillwidth ) || ( y >= selection.Bottom - fillwidth ) )
            {
               if ( dashed )
               {
                  fill = true;

                  int div = (x - fillwidth) / GridSize;
                  bool even = false;
                  if ( div % 2 == 0 )
                  {
                        even = true;
                     }

                  if ( !even )
                  {
                        fill = false;
                  }
               }
               else if ( ( broken ) || ( dotted ) )
               {
                  fill = false;
                  int pos = ( selection.Right - ( selection.Right - x )  ) % (GridSize-1);
                  if ( ( pos == 0 ) || ( pos < GridSize/2 ) )
                  {
                     fill = true;
                  }
               }
               else
               {
                  fill = true;
               }
            }

            if ( fill )
            {
               CurrentPixel.R = (byte)PrimaryColor.R;
               CurrentPixel.G = (byte)PrimaryColor.G;
               CurrentPixel.B = (byte)PrimaryColor.B;
               CurrentPixel.A = (byte)PrimaryColor.A;
            }
            // Save the (modified?) pixel
            dst[x,y] = CurrentPixel;
         }
      }
   }

}


Last edited by moc426 on Fri May 25, 2007 5:06 am, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 3:34 pm 
Offline
User avatar

Joined: Fri Dec 08, 2006 8:56 pm
Posts: 5489
Location: 32829 Orlando, FL
This will come to good use. Nice for simple image editing.

So can I use it for the Plugin Pack I'm working on (supposing I was to finish it)?

_________________
"The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Jimi Hendrix
Image
twitter | dA | blog


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 6:11 pm 
Offline
User avatar

Joined: Fri May 11, 2007 3:20 pm
Posts: 51
Location: Limerick City, Ireland
good plugin

_________________
Image
I'm not a fan-boy, i have ALL 3 of the consoles.........PS,PS2 and PS3


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 6:14 pm 
Offline
User avatar

Joined: Tue Jul 25, 2006 10:12 pm
Posts: 3118
Location: Rochester, NY
Akkarins_Spirit, Nice use of the "wet floor" plugin on your sig!

_________________
Image
Take responsibility for your own intelligence. ;) -Rick Brewster


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 6:14 pm 
Offline
Forum Moderator and 2008 "Radiance Award" Winner
User avatar

Joined: Sat Mar 03, 2007 7:17 pm
Posts: 3943
Location: Sheffield, England.
Neat, as uH said this will indeed come in handy. Well done.

May I ask, what's your screen resolution?

_________________


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 7:39 pm 
Offline
User avatar

Joined: Fri Dec 08, 2006 8:56 pm
Posts: 5489
Location: 32829 Orlando, FL
Myrddin wrote:
Neat, as uH said this will indeed come in handy. Well done.

May I ask, what's your screen resolution?

It looks like the same as mine-- 1280x1024 (I can tell by looking at the resolution of his picture).

@Akkarins_Spirit: Your sig is way to high.

_________________
"The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Jimi Hendrix
Image
twitter | dA | blog


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 7:54 pm 
Offline
User avatar

Joined: Fri May 11, 2007 3:20 pm
Posts: 51
Location: Limerick City, Ireland
ok hope its ok now, thanks barkbark

_________________
Image
I'm not a fan-boy, i have ALL 3 of the consoles.........PS,PS2 and PS3


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 9:12 pm 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
Correct 1280x1024, I want a wide screen monitor!

usedHONDA wrote:
Myrddin wrote:
Neat, as uH said this will indeed come in handy. Well done.

May I ask, what's your screen resolution?

It looks like the same as mine-- 1280x1024 (I can tell by looking at the resolution of his picture).

@Akkarins_Spirit: Your sig is way to high.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 10:53 pm 
Offline
User avatar

Joined: Tue Apr 10, 2007 3:40 am
Posts: 3090
Location: Ohio
New pluggiinnn must have... :twisted:

_________________
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former"
Image
[ dA Paint.NET Chat :: Yata on dA ]


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 19, 2007 5:32 am 
Offline

Joined: Sun Apr 23, 2006 3:35 am
Posts: 24
Location: California
That's nice :3


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 19, 2007 1:17 pm 
Offline
User avatar

Joined: Mon May 14, 2007 6:40 pm
Posts: 2403
Location: India! (Where your job got outsourced to ;)!
Nice! My work:
Image

I used orange border+dents+transparent gradient. I call it "forest fire!"

_________________
+_+_+_+_+_+_+_+_+_+_+_+ I am a disco dancer. +_+_+_+_+_+_+_+_+_+_+_+


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 3:13 am 
Offline
User avatar

Joined: Sat Feb 03, 2007 4:01 pm
Posts: 63
Location: Where do I live? Help me I'm LOST!
Finally! A border plug-in. Thanks so much Madjik! I've been waiting a long time for one of these. I did find a bug: If you try to add a border to a circle, it turns out as a square with the corners cut off.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 3:48 am 
Offline
Site Admin and 2008 "Homer Simpson Award for Humor" Winner
User avatar

Joined: Tue Aug 02, 2005 10:27 pm
Posts: 6662
Location: California, USA Weather: Sunny
dragonpyro wrote:
I did find a bug: If you try to add a border to a circle, it turns out as a square with the corners cut off.


Thus, his original post:

moc426 wrote:
...Other enhancement would be so it can work with circular and lasso selections, not sure how I can do that yet...


:D

_________________
Warning: The above post contains sarcasm. Use as directed.
Image
BoltBait's Plugin Pack | CodeLab | More... and a Dominoes Computer Game


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 4:06 am 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
As boltbait said, btw I am not Madjik.

dragonpyro wrote:
Finally! A border plug-in. Thanks so much Madjik! I've been waiting a long time for one of these. I did find a bug: If you try to add a border to a circle, it turns out as a square with the corners cut off.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 4:07 am 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
Sorry didn't see your question. Sure you can use it.

usedHONDA wrote:
This will come to good use. Nice for simple image editing.

So can I use it for the Plugin Pack I'm working on (supposing I was to finish it)?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosted by Forumer & phpBB

Get your Forumer™ today!

Adding a forum to your website is a great way to get return visitors.

» Get your own Free Forum!

Terms of Use

Privacy Policy

Report Abuse

Copyright © 2003-2009 Forumer. All Rights Reserved. | Copyright © paint.NET