Probably best to see the screenshot below!
With a range of line and background colours, including transparent, it should be useful for frames, buttons and vignettes.
Now in the updated Red ochre plugin pack
I have changed the default shape setting to circle, because I found it more convenient!
(the .dll is only available in the pack now, the updated version now has the same name as the original version. The first version has the word 'middle' spelled as 'midddle', other than that, they are the same.)
Here is the code lab code too.
Hidden Content:
/* =================================================== */
/* */
/* squirkle */
/* © 2011 Red Ochre */
/* */
/* Description: produces square/circle shapes */
/* */
/* ========================================== ======== */
// Name: squirkle
// Author: Red ochre (John Robbins)
// Submenu: Render
// URL: http://www.getpaint.net/redirect/plugins.html
// Title: Squirkle Feb 2012 Red Ochre
#region UICode
Pair<double, double> Amount1 = Pair.Create( 0.0 , 0.0 ); // middle
double Amount2 = 0; // [-90,90] angle (degrees)
double Amount3 = 0; // [-1,1] wide ... ...tall
double Amount4 = 2.5; // [0.5,20] exponent
double Amount5 = 2; // [0,10] size
byte Amount6 = 0; // line properties|primary color|secondary color|transparent|source image|inverted source|blue|cyan|green|yellow|red|magenta
byte Amount7 = 0; // background properties|secondary color|primary color|transparent|source image
int Amount8 = 10; // [0,200] line width
bool Amount9 = false; // [0,1] solid middle
bool Amount10 = true; // [0,1] smoothing
#endregion
void Render(Surface dst, Surface src, Rectangle rect)
{ ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
ColorBgra cp; // current pixel
Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
double X,Y;
int H = selection.Bottom - selection.Top;
int W = selection.Right - selection.Left;
int small = H;if(H < W){small = W;}//smallest side
double deg90 = Math.PI /2;
double angle = (Amount2 * deg90/ 90);
double sina = Math.Sin(angle);
double sinb = Math.Sin(deg90 - angle);
double cosa = Math.Cos(angle);
double cosb = Math.Cos(deg90 - angle);
double dx = (W / 2) * (1 + Amount1.First);
double dy = (H / 2) * (1 + Amount1.Second);
int Ox = (int)(selection.Left + dx );// horizontal position (moveable)
int Oy = (int)(selection.Top + dy );// vertical position (moveable)
double xrat = 1 + Amount3;
double yrat = 1 - Amount3;// length and height multipliers
double exp = Amount4;//exponent (power)
int rf = (int)(Amount5 * small/10);// radius factor
int lw = Amount8 ;// line width
if(lw >= rf){lw = rf;}// to stop negative radius
int B,G,R,A;
int lb = PrimaryColor.B, lg = PrimaryColor.G,lr = PrimaryColor.R,la = PrimaryColor.A; // otherwise says values not assigned?
int bb = SecondaryColor.B, bg = SecondaryColor.G, br = SecondaryColor.R, ba = SecondaryColor.A;
for (int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
// assign line and background colours
cp = src[x,y];
B = (int)cp.B;G = (int)cp.G;R = (int)cp.R;A = (int)cp.A;
switch (Amount6)// line properties
{case 0: lb = PrimaryColor.B; lg = PrimaryColor.G; lr = PrimaryColor.R; la = PrimaryColor.A;break; //line colour = primary colour default black
case 1: lb = SecondaryColor.B; lg = SecondaryColor.G; lr = SecondaryColor.R;la = SecondaryColor.A;break; //secondary colour
case 2: lb = 0; lg = 0; lr = 0; la = 0;break; // transparent
case 3: lb = B; lg = G; lr = R; la = A;break; // as original source
case 4: lb = 255 - B; lg = 255 - G; lr = 255 - R; la = 255 ;break; // inverted source
case 5: lb = 255;lg = 0;lr = 0; la = 255;break;// blue
case 6: lb = 255;lg = 255;lr = 0;la = 255;break;//cyan
case 7: lb = 0;lg = 255; lr = 0; la = 255;break;//green
case 8: lb = 0;lg = 255;lr = 255;la = 255;break;//yellow
case 9: lb = 0;lg = 0;lr = 255;la = 255;break;//red
case 10: lb = 255;lg = 0;lr = 255; la = 255;break;//magenta
}
switch (Amount7)//background properties
{case 0: bb = SecondaryColor.B; bg = SecondaryColor.G; br = SecondaryColor.R; ba = SecondaryColor.A;break; //background colour = secondary colour default white
case 1: bb = PrimaryColor.B; bg = PrimaryColor.G; br = PrimaryColor.R; ba = PrimaryColor.A;break; // primary
case 2: bb = B; bg = G; br = R; ba = 0;break; //transparent
case 3: bb = B; bg = G; br = R; ba = A;break; // as original source
}
// set BGRA values to background values
B = bb;G = bg;R = br;A = ba;
// work out X & Y co-ordinates with rotation
int cX = + x - Ox;
int cY = - (y - Oy) ; //moving but not rotating
X = ((cX * cosa) + (-cY * cosb)) * xrat;// moving and rotating
Y = ((cX * sina) + (cY * sinb)) * yrat;// now X and Y are doubles and wide tall included
// SQUIRKLE
double xP = Math.Pow(Math.Abs(X),exp);
double yP = Math.Pow(Math.Abs(Y),exp);
int ro = rf + lw;
int ri = rf - lw;
int ro1 = rf + lw + 1;
int ri1 = (rf - lw) - 1;
double squirk = Math.Pow(xP + yP,1/exp);
if(!Amount9 && squirk >= ri && squirk <= ro){B = lb;G = lg;R = lr;A = la;}//ring line
if((Amount9)&&(squirk <= ro)){B = lb;G = lg;R = lr;A = la;}//solid
// smoothing
if(Amount10)
{
double rat = squirk - (int)(squirk);
double irat = 1 - rat;
// outer
if(squirk <= ro1 && squirk > ro)
{
B = (int)((irat * lb) + (rat * bb));
G = (int)((irat * lg) + (rat * bg));
R = (int)((irat * lr) + (rat * br));
A = (int)((irat * la) + (rat * ba));
}
// inner
if(!Amount9 && squirk < ri && squirk >= ri1)
{
B = (int)((rat * lb) + (irat * bb));
G = (int)((rat * lg) + (irat * bg));
R = (int)((rat * lr) + (irat * br));
A = (int)((rat * la) + (irat * ba));
}
}
// re assemble
cp = ColorBgra.FromBgra( Int32Util.ClampToByte(<img src='http://forums.getpaint.net/public/style_emoticons/<#EMO_DIR#>/boltbait.cool.png' class='bbc_emoticon' alt='B)' />, Int32Util.ClampToByte(G), Int32Util.ClampToByte®, Int32Util.ClampToByte(A));
dst[x,y] = cp;
}
}
}
Enjoy
All feedback appreciated (well hopefully !)
Edited by Red ochre, 24 October 2012 - 08:53 PM.



















