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
Dashed
Dashed border, Clouds on selection, Waves, Dents
Dashed border, Clouds on selection, Dents, Curves
Waves
Radial Blur
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
**********************************
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;
}
}
}
}