Paint.NET

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

All times are UTC


Forum rules


Questions or problems with plugin installation? Click here.



Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Interlace plugin (updated 2007/04/17)
PostPosted: Tue Apr 10, 2007 9:32 pm 
Offline

Joined: Tue Mar 13, 2007 6:36 pm
Posts: 30
Location: Finland
I just created a interlace plugin, that adds horizontal/vertical stripes of configurable width and "color" (primary/secondary/transparent) to the image.

Get it here:
Plugin:
http://koti.mbnet.fi/tunedude/pdn/InterlacePlugin.zip
Sources:
http://koti.mbnet.fi/tunedude/pdn/InterlaceSources.zip

English, with swedish and finnish localization available.

Version history:
1.0.0.5:
- reordered ok/cancel buttons to be in line with the rest of the software


Last edited by tunedude on Tue Apr 17, 2007 4:31 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 9:42 pm 
Offline
User avatar

Joined: Tue Jul 25, 2006 10:12 pm
Posts: 3118
Location: Rochester, NY
Bug:*

When you zoom in on an image so that it is not all viewable on the screen and render your effect the area in view looks different than the area that was not viewable.

*maybe

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


Last edited by barkbark00 on Tue Apr 10, 2007 9:59 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Sources...
PostPosted: Tue Apr 10, 2007 9:46 pm 
Offline

Joined: Tue Mar 13, 2007 6:36 pm
Posts: 30
Location: Finland
BoltBait made me realize it's hard to get help without posting source so...

http://koti.mbnet.fi/tunedude/pdn/InterlaceSources.zip


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 9:48 pm 
Offline

Joined: Tue Mar 13, 2007 6:36 pm
Posts: 30
Location: Finland
barkbark00 wrote:
Bug:*

When you zoom in on an image so that it is not all viewable on the screen and render your effect the area in view looks different that the area that was not viewable.

*maybe


Hmm, I'm unable to reproduce that behavior if I understood you correctly


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 9:58 pm 
Offline
User avatar

Joined: Tue Jul 25, 2006 10:12 pm
Posts: 3118
Location: Rochester, NY
My PDN screen's resolution is 958x772 (I only know that cuz I took a screen shot).

I opened this image.

I zoomed in to 200%.

Then I ran the "interlace" effect.
Source: Primary
Stripe Width: 15

I get this.

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 10:02 pm 
Offline
User avatar

Joined: Wed Nov 30, 2005 11:40 pm
Posts: 1267
Location: Middle Tennessee
Sounds to me like his math isn't based on the proper rectangle values :/

_________________
Image
Kitteh all growed up :_(


Top
 Profile  
 
 Post subject: Re: Interlace plugin
PostPosted: Tue Apr 10, 2007 10:04 pm 
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
tunedude wrote:
I just created a interlace plugin, that adds stripes of configurable width and "color" (primary/secondary/transparent) to the image.


Why not just make a slight change to the Grid plugin that I already wrote?

Like this:

Code:
int Amount1=5; //[2,25]Scanline Width
int Amount2=0; //[0,1]Primary Color           Secondary Color
int Amount3=1; //[1,5]Brush Width

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.Bounds);
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    ColorBgra CurrentPixel;
    ColorBgra PrimaryColor;
    ColorBgra SecondaryColor;
    bool Odd = false;

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

    // Grab the primary and secondary colors (swapping if specified in the UI)
    if (SwapColors) {
        PrimaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
        SecondaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
    } else {
        PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
        SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
    }

    // 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 (((y-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;
            }
        }
    }
}

And, no preview issues. :D

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


Last edited by BoltBait on Tue Apr 10, 2007 10:41 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 10:10 pm 
Offline

Joined: Tue Mar 13, 2007 6:36 pm
Posts: 30
Location: Finland
barkbark00 wrote:
<snip reproduction>

I get this.


Yes, I see that, ouch!


Top
 Profile  
 
 Post subject: Re: Interlace plugin
PostPosted: Tue Apr 10, 2007 10:21 pm 
Offline

Joined: Tue Mar 13, 2007 6:36 pm
Posts: 30
Location: Finland
BoltBait wrote:
Why not just make a slight change to the Grid plugin that I already wrote?


Why spoil the fun?

Anyway, turns out I didn't realize you had to write every pixel in dstArgs even if it didn't change. Fixed version is online.


Top
 Profile  
 
 Post subject: Re: Interlace plugin
PostPosted: Wed Apr 11, 2007 3:09 am 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
Thanks, this is cool, someone help him fix the preview.

tunedude wrote:
I just created a interlace plugin, that adds stripes of configurable width and "color" (primary/secondary/transparent) to the image.

Get it here:
http://koti.mbnet.fi/tunedude/pdn/InterlacePlugin.zip

Currently only the binary available, eventually I will probably publish source and installer.

English, with swedish and finnish localization available.

Known issues:
- the live preview thing doesn't seem to work, suggestions how to fix welcome!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 3:12 am 
Offline
User avatar

Joined: Fri Dec 08, 2006 8:56 pm
Posts: 5489
Location: 32829 Orlando, FL
So... can I use this in the PDN Plugin Pack?

_________________
"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: Re: Interlace plugin
PostPosted: Wed Apr 11, 2007 4:16 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
moc426 wrote:
Thanks, this is cool, someone help him fix the preview.



I already did. The codelab script I posted above does not have any issues.

_________________
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: Wed Apr 11, 2007 4:32 am 
Offline
User avatar

Joined: Fri Dec 08, 2006 8:56 pm
Posts: 5489
Location: 32829 Orlando, FL
So is your version original enough to add to the PPP without tunedude's permission?

_________________
"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


Last edited by usedHONDA on Wed Apr 11, 2007 4:42 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 4:41 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
usedHONDA wrote:
So is your version origional enough to add to the PPP without tunedude's permission?

Yes.

But, if he wants to fix his instead, I'm fine with that.

_________________
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: Wed Apr 11, 2007 4:57 am 
Offline
User avatar

Joined: Fri Apr 06, 2007 10:22 pm
Posts: 346
Can you have an option to do this as vertical as well?

Actually BoltBait, I was able to use your code to do that myself, I am just having trouble adding the 4th slider, does code lab allow more than 3 sliders?

I removed the primary / secondary option since thats not really needed. Will have to try working with the source code for pdn instead of codelab.

offtopic, I can't save the dll from codelab unless I run pdn as administrator in vista, any other work around?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  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