Sign in to follow this  
Followers 0
hollander

monochrome plugin

19 posts in this topic

I saw some requests for it on the forum, an I happenned make one already after experimenting a bit with codelab.

it has got 2 modes, one for black/white, and the other for color (= black/white/red/green/blue/cyan/magenta/yellow)

normaly if you use this effect on an photo, it will be dittered.

if you use it on a simple graphic (like an icon, or somthing made with ms paint.) it will not ditter.

(ditter slider should only be used on blurry photos)

http://rapidshare.com/files/49636134/monochrome.dll.html(updated link)

http://www.mediafire.com/?bwgljdxdm3r

example:

(images are resized to 800*600, my real screen resolution is 1280*800)

(black/white)

example1iw5.png

(color)

example2ur5.png

0

Share this post


Link to post
Share on other sites

It crashed! :!:

------------------------------------------------------------------------

This text file was created because Paint.NET crashed.

Please e-mail this file to paint.net@hotmail.com so we can diagnose and fix the problem.

Application version: Paint.NET v3.10 (Beta 2 Release build 3.10.2779.25584)

Time of crash: 17-08-2007 21:21:19

Application uptime: 00:01:14.7656250

OS Version: 5.1.2600.131072 Service Pack 2 Workstation x86

.NET Framework version: 2.0.50727.42 x86

Processor: 2x "Intel® Pentium® 4 CPU 3.00GHz" @ ~2991MHz (SSE, SSE2)

Physical memory: 510 MB

Tablet PC: no

Locale: pdnr.c: pt-PT, hklm: pt-PT, hkcu: n/a, cc: pt-PT, cuic: pt-PT

Exception details:

PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.DivideByZeroException: Attempted to divide by zero.

at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)

at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)

at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderImpl()

--- End of inner exception stack trace ---

at PaintDotNet.Effects.BackgroundEffectRenderer.Join()

at PaintDotNet.Effects.BackgroundEffectRenderer.Start()

at PaintDotNet.Menus.EffectMenuBase.EffectConfigTokenChangedHandler(Object sender, EventArgs e)

at PaintDotNet.Effects.EffectConfigDialog.OnEffectTokenChanged()

at PaintDotNet.Effects.TwoAmountsConfigDialogBase.amount1Slider_ValueChanged(Object sender, EventArgs e)

at System.Windows.Forms.TrackBar.OnValueChanged(EventArgs e)

at System.Windows.Forms.TrackBar.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

------------------------------------------------------------------------------

Can you share the algorithm of the plugin??

0

Share this post


Link to post
Share on other sites

Yes, rapidshare will delete your file after 90 days of not being downloaded, which, in the future, would be a very large annoyance.

http://www.mediafire.com is a good hosting side.

Also... zip the .dll. Some security software does not allow people to download .dlls.

Anyway, besides all that, thank you for writing this plugin!

0

Share this post


Link to post
Share on other sites

I can't download it. Can someone just send me the direct DLL?

0

Share this post


Link to post
Share on other sites

This text file was created because Paint.NET crashed.

Please e-mail this file to paint.net@hotmail.com so we can diagnose and fix the problem.

Application version: Paint.NET v3.10 (Beta 2 Release build 3.10.2779.25584)

Time of crash: 8/17/2007 10:28:06 PM

Application uptime: 00:00:33.8780000

OS Version: 6.0.6000.0 Workstation x86

.NET Framework version: 2.0.50727.1378 x86

Processor: 2x "Genuine Intel® CPU T2250 @ 1.73GHz" @ ~1729MHz (DEP, SSE, SSE2, SSE3)

Physical memory: 1013 MB

Tablet PC: no

Locale: pdnr.c: en-US, hklm: en-US, hkcu: n/a, cc: en-US, cuic: en-US

Exception details:

PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.DivideByZeroException: Attempted to divide by zero.

at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)

at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)

at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderImpl()

--- End of inner exception stack trace ---

at PaintDotNet.Effects.BackgroundEffectRenderer.Join()

at PaintDotNet.Effects.BackgroundEffectRenderer.Start()

at PaintDotNet.Menus.EffectMenuBase.EffectConfigTokenChangedHandler(Object sender, EventArgs e)

at PaintDotNet.Effects.EffectConfigDialog.OnEffectTokenChanged()

at PaintDotNet.Effects.ThreeAmountsConfigDialogBase.amount3Slider_ValueChanged(Object sender, EventArgs e)

at System.Windows.Forms.TrackBar.OnValueChanged(EventArgs e)

at System.Windows.Forms.TrackBar.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

------------------------------------------------------------------------------

0

Share this post


Link to post
Share on other sites

I used the plugin with several pics and it didn't crashed. I have PDN 3.08 (latest stable build).

In my opinion the effect is very nice and can produce some good results. Thanks and credits for this, hollander :D .

One thing for me to ask: Can it be moved to the submenu "Color"? That would make sense and it wouldn't take space directly in "effects", which is near to explode (and I don't use all of the plugins out there).

0

Share this post


Link to post
Share on other sites

it crashes when you turn the brightness too far down or the ditter too far up. as it says below, you are dividing by zero in some cases.

Exception details:

PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.DivideByZeroException: Attempted to divide by zero.

at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)

at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)

at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderImpl()

--- End of inner exception stack trace ---

at PaintDotNet.Effects.BackgroundEffectRenderer.Join()

at PaintDotNet.Effects.BackgroundEffectRenderer.Start()

at PaintDotNet.Menus.EffectMenuBase.EffectConfigTokenChangedHandler(Object sender, EventArgs e)

at PaintDotNet.Effects.EffectConfigDialog.OnEffectTokenChanged()

at PaintDotNet.Effects.TwoAmountsConfigDialogBase.amount2Slider_ValueChanged(Object sender, EventArgs e)

at System.Windows.Forms.TrackBar.OnValueChanged(EventArgs e)

at System.Windows.Forms.TrackBar.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

0

Share this post


Link to post
Share on other sites

Eek!

Awesome extension! I have some suggestions.

1. Use capitals

2. With the mode black white/color maybe do a check box labeled "Color?" and checking it would cause color.

Eek! It crashes when I use it :(

This text file was created because Paint.NET crashed.

Please e-mail this file to paint.net@hotmail.com so we can diagnose and fix the problem.

Application version: Paint.NET v3.10 (Beta 2 Release build 3.10.2779.25584)

Time of crash: 8/19/2007 4:08:37 PM

Application uptime: 00:00:49.4510000

OS Version: 6.0.6000.0 Workstation x86

.NET Framework version: 2.0.50727.312 x86

Processor: 2x "AMD Athlon 64 X2 Dual Core Processor 3800+" @ ~2003MHz (DEP, SSE, SSE2, SSE3)

Physical memory: 2045 MB

Tablet PC: no

Locale: pdnr.c: en-US, hklm: en-US, hkcu: en-US, cc: en-US, cuic: en-US

Exception details:

PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.DivideByZeroException: Attempted to divide by zero.

at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)

at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)

at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderImpl()

--- End of inner exception stack trace ---

at PaintDotNet.Effects.BackgroundEffectRenderer.Join()

at PaintDotNet.Effects.BackgroundEffectRenderer.Start()

at PaintDotNet.Menus.EffectMenuBase.EffectConfigTokenChangedHandler(Object sender, EventArgs e)

at PaintDotNet.Effects.EffectConfigDialog.OnEffectTokenChanged()

at PaintDotNet.Effects.TwoAmountsConfigDialogBase.amount2Slider_ValueChanged(Object sender, EventArgs e)

at System.Windows.Forms.TrackBar.OnValueChanged(EventArgs e)

at System.Windows.Forms.TrackBar.set_Value(Int32 value)

at PaintDotNet.Effects.TwoAmountsConfigDialogBase.amount2Reset_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

------------------------------------------------------------------------------

0

Share this post


Link to post
Share on other sites

4 crash logs on one page. I'd say you need to rethink something, hollander...

0

Share this post


Link to post
Share on other sites

I was unable to get it to crash, and the effect seems as if it could be quite useful (kind of like Threshold with configurable granularity).

I have one nagging complaint: Please change "ditter" to "dither." Dither is the proper term for the effect the slider provides.

Cheers!

0

Share this post


Link to post
Share on other sites
4 crash logs on one page. I'd say you need to rethink something, hollander...

Hollander, you should mind sharing the source. There are a lot of good programmers here, they will find the problem.

0

Share this post


Link to post
Share on other sites

I cant figure out what makes it crashes, the values m and m2 are always higher than 1

int Amount1=0;	//[0,1]mode: black/wite -- color
int Amount2=128;	//[0,255]brightness
int Amount3=0;	//[0,100]dither
int m;
float m2;
float m3;
int r;
int g;
int b;
int r2;
int g2;
int b2;
int mr=124;
int mg=872;
int mb=164;

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);

   // Delete any of these lines you don't need
   Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

   long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left);
   long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top);
   ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
   ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
   int BrushWidth = (int)EnvironmentParameters.BrushWidth;

   ColorBgra CurrentPixel;
       for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           if (selectionRegion.IsVisible(x, y))
           {
               CurrentPixel = src[x,y];
               ColorBgra CurrentPixel2 = src[x,y];
               r=mr;
               g=mg;
               b=mb;
               mr+=CurrentPixel2.R;
               mg+=CurrentPixel2.G;
               mb+=CurrentPixel2.B;
               CurrentPixel2.R=(byte)r;
               CurrentPixel2.G=(byte)g;
               CurrentPixel2.B=(byte)b;
               r=CurrentPixel2.R;
               g=CurrentPixel2.G;
               b=CurrentPixel2.B;
               r2=CurrentPixel.R;
               g2=CurrentPixel.G;
               b2=CurrentPixel.B;
               m=((r2*(100-Amount3)+(r*Amount3))/100);
               CurrentPixel.R=(byte)m;
               m=((g2*(100-Amount3)+(g*Amount3))/100);
               CurrentPixel.G=(byte)m;
               m=((b2*(100-Amount3)+(b*Amount3))/100);
               CurrentPixel.B=(byte)m;
               dst[x,y] = CurrentPixel;
               if (Amount1==0){
               m=(int)((CurrentPixel.R+CurrentPixel.G+CurrentPixel.B)/3);
               m+=Amount2;
               m+=1;
               m2=512/m;
               m3=m/m2;
               m=(int)(m/m2);
               if (m==m3){
               CurrentPixel.R=255;CurrentPixel.G=255;CurrentPixel.B=255;}else
                   {CurrentPixel.R=0;CurrentPixel.B=0;CurrentPixel.G=0;}}
               if (Amount1==1){
               m=(int)CurrentPixel.R;
               m+=Amount2;
                   m+=1;
               m2=512/m;
               m3=m/m2;
               m=(int)(m/m2);
               if (m==m3){
               CurrentPixel.R=255;}else
                   {CurrentPixel.R=0;}
                   m=(int)CurrentPixel.G;
               m+=Amount2;
                   m+=1;
               m2=512/m;
               m3=m/m2;
               m=(int)(m/m2);
               if (m==m3){
               CurrentPixel.G=255;}else
                   {CurrentPixel.G=0;}
                   m=(int)CurrentPixel.B;
               m+=Amount2;
                   m+=1;
               m2=512/m;
               m3=m/m2;
               m=(int)(m/m2);
               if (m==m3){
               CurrentPixel.B=255;}else
                   {CurrentPixel.B=0;}
               }
               dst[x,y] = CurrentPixel;
           }
       }
   }
}

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0