//
//
//
//
//
//
Name: GuideLines
Author: xod
Submenu: Render
URL:
Title: GuideLines
CodeLab 2.12
#region UICode
ListBoxControl Amount1 = 0; // Line Style and Color|Solid|Dash|Dash-Dot|Dash-Dot-Dot|Dot
ColorWheelControl Amount2 = [Link](0,0,0); //
IntSliderControl Amount3 = 1; // [1,1000] Line Width
ListBoxControl Amount4 = 0; // Axes|None
|Vertical|Horizontal|Both
ListBoxControl Amount5 = 0; // Diagonals|None
|First|Second|Both
ListBoxControl Amount6 = 0; // Half to corners|None
|Horiz Left|Horiz
Right|Horiz Both|Vert Up|Vert Down|Vert Both|H and V Both
ListBoxControl Amount7 = 0; // Half to half|None
|Horiz Left|Horiz
Right|Both|Vert Up|Vert Down
ListBoxControl Amount8 = 0; // Options|None|Move X, Y|Axes Offset = X|Borders Offset =
Y|Both Offsets X, Y|VLineSpace = X|HLineSpace = Y|Grid X, Y
IntSliderControl Amount9 = 20; // [0,11811] X
IntSliderControl Amount10 = 20; // [0,11811] Y
#endregion
void Render(Surface dst, Surface src, Rectangle rect)
{
Rectangle selection = [Link]([Link]).GetBoundsInt();
[Link](src,[Link],rect); // copy surface quicker than looping through
byte penstyle = (byte)(Amount1);
ColorBgra pencol = Amount2;
float penW = Amount3;
float sTop = [Link];
float sBot = [Link];
float sLeft = [Link];
float sRite = [Link];
float H = [Link];
float midH = (H/2) - 0.5f;
float W = [Link];
float midW = (W/2) - 0.5f;
byte TypeAxe = (byte)(Amount4);
byte TypeDiag = (byte)(Amount5);
byte TyHaCo = (byte)(Amount6);
byte TyHaHa = (byte)(Amount7);
byte Options = (byte)(Amount8);
using (RenderArgs ra = new RenderArgs(dst))
{
Graphics graf = [Link];
[Link] = new Region(rect);
[Link] = [Link];
using(Pen colpen = new Pen(pencol))
{
[Link] = penW;
switch(penstyle)
{
case 0:[Link] = [Link]; break;
case 1:[Link] = [Link]; break;
case 2:[Link] = [Link]; break;
case 3:[Link] = [Link]; break;
case 4:[Link] = [Link]; break;
}
//*************************************************************************
switch(TypeAxe) // Draw Axes
{
case 0: //none
break;
case 1: //vertical
PointF topmid = new PointF(sLeft + midW, sTop - 1f);
PointF botmid = new PointF(sLeft + midW, sBot);
[Link](colpen, topmid, botmid);
break;
case 2: //horizontal
PointF leftmid = new PointF(sLeft - 1f, sTop + midH);
PointF ritemid = new PointF(sRite, sTop + midH);
[Link](colpen, leftmid, ritemid);
break;
case 3: //vertical & horizontal
PointF topmid1 = new PointF(sLeft + midW, sTop - 1f); //vertical & horizontal
PointF botmid1 = new PointF(sLeft + midW, sBot);
[Link](colpen, topmid1, botmid1);
PointF leftmid1 = new PointF(sLeft - 1f, sTop + midH);
PointF ritemid1 = new PointF(sRite, sTop + midH);
[Link](colpen, leftmid1, ritemid1);
break;
}
//*************************************************************************
switch(TypeDiag) // Draw Diagonals
{
case 0: //none
break;
case 1: //1st diag.
PointF topleft = new PointF(sLeft, sTop);
PointF botrite = new PointF(sRite, sBot - 0.5f);
[Link](colpen, topleft, botrite);
break;
case 2: //2nd diag.
PointF toprite = new PointF(sRite, sTop - 1f);
PointF botleft = new PointF(sLeft, sBot - 1f);
[Link](colpen, botleft, toprite);
break;
case 3: //first & second
PointF topleft1 = new PointF(sLeft, sTop);
PointF botrite1 = new PointF(sRite, sBot - 0.5f);
PointF toprite1 = new PointF(sRite, sTop - 1f);
PointF botleft1 = new PointF(sLeft, sBot - 1f);
[Link](colpen, topleft1, botrite1);
[Link](colpen, botleft1, toprite1);
break;
}
//**********************************************************************
switch(TyHaCo) // Draw Half to corners
{
case 0: //none
break;
case 1: //Horiz Left
PointF leftmid = new PointF(sLeft - 1f, sTop + midH);
PointF toprite = new PointF(sRite, sTop - 1f);
PointF botrite = new PointF(sRite, sBot - 0.5f);
[Link](colpen, leftmid, toprite );
[Link](colpen, leftmid, botrite);
break;
case 2: //Horiz Right
PointF ritemid = new PointF(sRite, sTop + midH);
PointF topleft = new PointF(sLeft, sTop);
PointF botleft = new PointF(sLeft, sBot - 1f);
[Link](colpen, ritemid, topleft );
[Link](colpen, ritemid, botleft);
break;
case 3: //Horiz Both
PointF leftmid1 = new
PointF toprite1 = new
PointF botrite1 = new
[Link](colpen,
[Link](colpen,
PointF ritemid1 = new
PointF topleft1 = new
PointF botleft1 = new
[Link](colpen,
[Link](colpen,
break;
PointF(sLeft - 1f, sTop + midH);
PointF(sRite, sTop - 1f);
PointF(sRite, sBot - 0.5f);
leftmid1, toprite1 );
leftmid1, botrite1);
PointF(sRite, sTop + midH);
PointF(sLeft, sTop);
PointF(sLeft, sBot - 1f);
ritemid1, topleft1 );
ritemid1, botleft1);
case 4: //Vert Up
PointF topmid = new PointF(sLeft + midW, sTop - 1f);
PointF botleft2 = new PointF(sLeft, sBot - 1f);
PointF botrite2 = new PointF(sRite, sBot - 0.5f);
[Link](colpen, topmid, botleft2);
[Link](colpen, topmid, botrite2);
break;
case 5: //Vert Down
PointF botmid = new PointF(sLeft + midW, sBot);
PointF toprite2 = new PointF(sRite, sTop - 1f);
PointF topleft2 = new PointF(sLeft, sTop);
[Link](colpen, botmid, toprite2);
[Link](colpen, botmid, topleft2);
break;
case 6: //Vert. Both
PointF topmid1 = new PointF(sLeft + midW, sTop - 1f);
PointF botleft3 = new PointF(sLeft, sBot - 1f);
PointF botrite3 = new PointF(sRite, sBot - 0.5f);
[Link](colpen, topmid1, botleft3);
[Link](colpen, topmid1, botrite3);
PointF botmid1 = new PointF(sLeft + midW, sBot);
PointF toprite3 = new PointF(sRite, sTop - 1f);
PointF topleft3 = new PointF(sLeft, sTop);
[Link](colpen, botmid1, toprite3);
[Link](colpen, botmid1, topleft3);
break;
case 7: //Horiz. & Vert. Both
PointF leftmid2 = new PointF(sLeft - 1f, sTop + midH);
PointF toprite4 = new PointF(sRite, sTop - 1f);
PointF botrite4 = new PointF(sRite, sBot - 0.5f);
[Link](colpen, leftmid2, toprite4);
[Link](colpen, leftmid2, botrite4);
PointF ritemid2 = new
PointF topleft4 = new
PointF botleft4 = new
[Link](colpen,
[Link](colpen,
PointF(sRite, sTop + midH);
PointF(sLeft, sTop);
PointF(sLeft, sBot - 1f);
ritemid2, topleft4);
ritemid2, botleft4);
PointF topmid2 = new PointF(sLeft + midW, sTop - 1f);
PointF botleft5 = new PointF(sLeft, sBot - 1f);
PointF botrite5 = new PointF(sRite, sBot - 0.5f);
[Link](colpen, topmid2, botleft5);
[Link](colpen, topmid2, botrite5);
PointF botmid2 = new PointF(sLeft + midW, sBot);
PointF toprite5 = new PointF(sRite, sTop - 1f);
PointF topleft5 = new PointF(sLeft, sTop);
[Link](colpen, botmid2, toprite5);
[Link](colpen, botmid2, topleft5);
break;
}
//************************************************************************
switch(TyHaHa) // Draw Half to Half
{
case 0: //none
break;
case 1: // [Link]
PointF leftmid = new PointF(sLeft - 1f, sTop + midH);
PointF topmid = new PointF(sLeft + midW, sTop - 1f);
PointF botmid = new PointF(sLeft + midW, sBot);
[Link](colpen, leftmid, topmid);
[Link](colpen, leftmid, botmid);
break;
case 2: // [Link]
PointF ritemid = new PointF(sRite, sTop + midH);
PointF topmid1 = new PointF(sLeft + midW, sTop - 1f);
PointF botmid1 = new PointF(sLeft + midW, sBot);
[Link](colpen, ritemid, topmid1);
[Link](colpen, ritemid, botmid1);
break;
case 3: // [Link]
PointF leftmid1 = new PointF(sLeft - 1f, sTop + midH);
PointF topmid2 = new PointF(sLeft + midW, sTop - 1f);
PointF botmid2 = new PointF(sLeft + midW, sBot);
[Link](colpen, leftmid1, topmid2);
[Link](colpen, leftmid1, botmid2);
PointF ritemid1 = new PointF(sRite, sTop + midH);
PointF topmid3 = new PointF(sLeft + midW, sTop - 1f);
PointF botmid3 = new PointF(sLeft + midW, sBot);
[Link](colpen, ritemid1, topmid3);
[Link](colpen, ritemid1, botmid3);
break;
case 4: // [Link]
PointF topmid4 = new PointF(sLeft + midW, sTop - 1f);
PointF leftmid2 = new PointF(sLeft - 1f, sTop + midH);
PointF ritemid2 = new PointF(sRite, sTop + midH);
[Link](colpen, topmid4, leftmid2);
[Link](colpen, topmid4, ritemid2);
break;
case 5: // [Link]
PointF botmid4 = new PointF(sLeft + midW, sBot);
PointF leftmid3 = new PointF(sLeft - 1f, sTop + midH);
PointF ritemid3 = new PointF(sRite, sTop + midH);
[Link](colpen, botmid4, leftmid3);
[Link](colpen, botmid4, ritemid3);
break;
}
//***************************************************************
switch(Options)
{
case 0: //none
break;
case 1: // Move Lines
PointF left = new PointF(sLeft - 1f, sTop + Amount9);
PointF rite = new PointF(sRite, sTop + Amount9);
PointF top = new PointF(Amount10 + sLeft, sTop - 1f);
PointF bot = new PointF(Amount10 + sLeft, sBot);
[Link](colpen,top,bot);
[Link](colpen,left,rite);
break;
case 2: // Axes Offsets
PointF topmid = new PointF(Amount9 + sLeft + midW, sTop - 1f);
PointF botmid = new PointF(Amount9 + sLeft + midW, sBot);
PointF leftmid = new PointF(sLeft - 1f, sTop + midH + Amount9);
PointF ritemid = new PointF(sRite, sTop + midH + Amount9);
[Link](colpen,topmid,botmid);
[Link](colpen,leftmid,ritemid);
PointF topmid1 = new PointF(sLeft + midW
PointF botmid1 = new PointF(sLeft + midW
PointF leftmid1 = new PointF(sLeft - 1f,
PointF ritemid1 = new PointF(sRite, sTop
[Link](colpen,topmid1,botmid1);
[Link](colpen,leftmid1,ritemid1);
break;
- Amount9, sTop - 1f);
- Amount9, sBot);
sTop + midH - Amount9);
+ midH - Amount9);
case 3: // Borders Offsets
PointF top1 = new PointF(Amount10 + sLeft, sTop - 1f);
PointF bot1 = new PointF(Amount10 + sLeft, sBot);
PointF left1 = new PointF(sLeft - 1f, sTop + Amount10);
PointF rite1 = new PointF(sRite, sTop + Amount10);
[Link](colpen,top1,bot1);
[Link](colpen,left1,rite1);
PointF top2 = new PointF(sRite - Amount10, sTop - 1f);
PointF bot2 = new PointF(sRite - Amount10, sBot);
PointF left2 = new PointF(sLeft - 1f, sBot - Amount10);
PointF rite2 = new PointF(sRite, sBot - Amount10);
[Link](colpen,top2,bot2);
[Link](colpen,left2,rite2);
break;
case 4: // Axes + Borders Offsets
PointF topmid2 = new PointF(Amount9 + sLeft + midW, sTop - 1f);
PointF botmid2 = new PointF(Amount9 + sLeft + midW, sBot);
PointF leftmid2 = new PointF(sLeft - 1f, sTop + midH + Amount9);
PointF ritemid2 = new PointF(sRite, sTop + midH + Amount9);
[Link](colpen,topmid2,botmid2);
[Link](colpen,leftmid2,ritemid2);
PointF topmid3 = new PointF(sLeft + midW
PointF botmid3 = new PointF(sLeft + midW
PointF leftmid3 = new PointF(sLeft - 1f,
PointF ritemid3 = new PointF(sRite, sTop
[Link](colpen,topmid3,botmid3);
[Link](colpen,leftmid3,ritemid3);
- Amount9, sTop - 1f);
- Amount9, sBot);
sTop + midH - Amount9);
+ midH - Amount9);
PointF top3 = new PointF(Amount10 + sLeft, sTop - 1f);
PointF bot3 = new PointF(Amount10 + sLeft, sBot);
PointF left3 = new PointF(sLeft - 1f, sTop + Amount10);
PointF rite3 = new PointF(sRite, sTop + Amount10);
[Link](colpen,top3,bot3);
[Link](colpen,left3,rite3);
PointF top4 = new PointF(sRite - Amount10, sTop - 1f);
PointF bot4 = new PointF(sRite - Amount10, sBot);
PointF left4 = new PointF(sLeft - 1f, sBot - Amount10);
PointF rite4 = new PointF(sRite, sBot - Amount10);
[Link](colpen,top4,bot4);
[Link](colpen,left4,rite4);
break;
case 5: //Vertical lines: X = identation
for ( int x = 0; x < sRite; x++)
{
int step = x * Amount9;
[Link](colpen, step, sTop, step, sBot);
}
break;
case 6: //Horizontal lines: Y = identation
for (int y = 0; y < sBot; y++)
{
int step = y * Amount10;
[Link](colpen, sLeft, step, sRite, step);
}
break;
case 7: //GridLines: X, Y = identation
for (int x = 0; x < sRite; x++)
{
int step = x * Amount9;
[Link](colpen, step, sTop, step, sBot);
}
for (int y = 0; y < sBot; y++)
{
int step = y * Amount10;
[Link](colpen, sLeft, step, sRite, step);
}
break;
}
}
}
}