Forum Topic: Help with code

(83 views • 5 replies)

New Topic Post Reply

This topic is 1 page long.

<< < > >>
Muted

HighWayStar365

Reply to Post Reply & Quote

Posted at: 10/4/09 04:28 PM

HighWayStar365 NEUTRAL LEVEL 13

Sign-Up: 08/23/08

Posts: 2,539

I've been needing help with this code I found to get scanlines for Paint.net.

I'm trying to make the scanlines be diagonal, along with horizontal and vertical. Does anyone have an idea how to do this?

FULL CODE:

int Amount1=5; //[2,25]Scanline Width
int Amount2=1; //[1,5]Brush Width
int Amount3=0; //[0,1]Horizontal Vertical

void Render(Surface dst, Surface src, Rectangle rect)
{
// User Interface elements
int GridSize = Amount1;
bool SwapColors = (Amount2 == 1);

// Other variables
PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.B ounds);
ColorBgra CurrentPixel;
bool Odd = false;

// Get the current brush width for grids
int w = Amount2;

bool Orientation = (Amount3 == 0);

ColorBgra PrimaryColor;
PrimaryColor.A = 255;
PrimaryColor.R = 0;
PrimaryColor.G = 0;
PrimaryColor.B = 0;

// 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];
Odd = false;
for (int t=0; t<w; t++)
{
if (Orientation)
{
if (((y-t) % GridSize) == 0)
Odd = true;
}
else
{
if (((x-t) % GridSize) == 0)
Odd = true;
}
}
if ( Odd )
{
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;
}
}
}
}


Happy

Hoeloe

Reply to Post Reply & Quote

Posted at: 10/4/09 04:29 PM

Hoeloe LIGHT LEVEL 29

Sign-Up: 04/29/04

Posts: 5,038

How about trying the Flash Forum?

Sex!
------------------------------
Super Nuke Bros. Melee, the web's no. 1 awaited Super Smash Tribute Game!

BBS Signature

None

InnerChild548

Reply to Post Reply & Quote

Posted at: 10/4/09 04:30 PM

InnerChild548 FAB LEVEL 24

Sign-Up: 08/10/07

Posts: 2,572

Usually when people put AS in the wrong forum, it's the programming forum. You can even mess up right.

Flash Forum please and thank you.

THIS IS THE ORIGINAL SIG. FUCK YOU.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

BBS Signature

Shouting

InnerChild548

Reply to Post Reply & Quote

Posted at: 10/4/09 04:31 PM

InnerChild548 FAB LEVEL 24

Sign-Up: 08/10/07

Posts: 2,572

At 10/4/09 04:30 PM, InnerChild548 wrote: Usually when people put AS in the wrong forum, it's the programming forum. You can even mess up right.

Flash Forum please and thank you.

Wait, this looks like... C++?

THIS IS THE ORIGINAL SIG. FUCK YOU.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

BBS Signature

Expressionless

Xinimater

Reply to Post Reply & Quote

Posted at: 10/4/09 04:32 PM

Xinimater DARK LEVEL 06

Sign-Up: 07/02/09

Posts: 153

While C++ is my best language, I never wrote a game using that code. So I have no fucking idea.


None

Rucklo

Reply to Post Reply & Quote

Posted at: 10/4/09 04:33 PM

Rucklo NEUTRAL LEVEL 30

Sign-Up: 10/11/04

Posts: 15,870

if the above code is AS, post in the flash forum
if the above code is some other language, post in the programming forum

Rucklo - Irrelevant WIP A Drum n Bass tune in progress. Check out what it's like this far! :)


All times are Eastern Standard Time (GMT -5) | Current Time: 01:49 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!