Recommended Posts

Thank you xod,

 

This is a cool clock maker.

xod-clock-515fe68.png

May I suggest an option for different colors for the hour and minute handles.

Share this post


Link to post
Share on other sites

Thanks Eli.
I think the GUI is already quite high.
Adding two color wheels would make GUI more bigger.

Share this post


Link to post
Share on other sites

I asked that because when the handles overlap it is hard to read the hour. Perhaps an outline?

 

EDIT: One more thing : Increase the font size.  If I use it on a very large canvas, the font size 40 is not large enough.

Edited by Eli

Share this post


Link to post
Share on other sites

The 'Century Gothic' font is provided by MS Office. People who don't have Office installed will not be able to use this plugin.

Spoiler

C:\Program Files\paint.net\Effects\Clock.dll, version 1.0.6223.26977

Name: Clock
Type: ClockEffect.ClockEffectPlugin
Version: 1.0.6223.26977
Author: Copyright © xod
Copyright: Render the clock.
Website: http://www.getpaint.net/redirect/plugins.html
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Font 'Century Gothic' cannot be found.
   at System.Drawing.FontFamily.CreateFontFamily(String name, FontCollection fontCollection)
   at ClockEffect.ClockEffectPlugin..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at PaintDotNet.Menus.EffectMenuBase.AddEffectsToMenu() in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 602

 

 

You'll want to use an alternative default font, or have a fallback font for when 'Century Gothic' fails.

  • Upvote 1

Share this post


Link to post
Share on other sites

@Eli:

Font size increased to 100. Download the new version.

 

@toe_head:

For me, on Win10,  when the plugin starts, it automatically chooses the first font in the list of installed fonts -  one that starts with the letter A (Arial in most cases).

Edited by xod

Share this post


Link to post
Share on other sites

@xod, The Font size is good now. I do not know if possible but an option to render longer handles that cover or touch the numbers

Spoiler

xod-clock-longer-handles-01-51604c5.png

 

Edited by Eli

Share this post


Link to post
Share on other sites

Doesn't work for me.

 

Spoiler

C:\Program Files\Paint.NET4\Effects\Clock.dll, Version 1.0.6223.29215

Name: Clock
Typ: ClockEffect.ClockEffectPlugin
Version: 1.0.6223.29215
Autor: Copyright © xod
Copyright: Render the clock.
Webseite: http://www.getpaint.net/redirect/plugins.html
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.ArgumentException: Die Schriftart Century Gothic kann nicht gefunden werden.
   bei System.Drawing.FontFamily.CreateFontFamily(String name, FontCollection fontCollection)
   bei ClockEffect.ClockEffectPlugin..ctor()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   bei System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei PaintDotNet.Menus.EffectMenuBase.AddEffectsToMenu() in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:Zeile 602.
 


I don't have that font. A standard like Arial would be better.

Edited by IRON67

Share this post


Link to post
Share on other sites
2 hours ago, xod said:

... when the plugin starts, it automatically chooses the first font in the list of installed fonts -  one that starts with the letter A (Arial in most cases).

Yes, but you have the FontFamily value initialized as 'Century Gothic', so that is what's used in the Render until the UI loads (the time span here is just a few milliseconds).

Once the UI has loaded, the EffectToken updates (which includes the new value for the FontFamily... usually 'Arial'), and the Render is restarted.

 

Share this post


Link to post
Share on other sites

I made the changes specified by Eli and toe_head2001.

See first post.

Share this post


Link to post
Share on other sites

The updated version still doesn't work for me. Maybe force Arial instead?

 

LOiQzUp.png

Share this post


Link to post
Share on other sites

Thanks Again Xod,

 

I enhanced the results with some shadows and bevels. I also changed the colors of the handles by selecting each one separately and using color adjustments. :) 

xod-clock-longer-handles-02-5160a78.png

Spoiler

I like the longer handles but some people may prefer short ones as the ones on your first post. Maybe you can add a "shorter indicators" option to keep them. As you see, having different colors for the handles is also very nice and more readable. Maybe using a GUI with tabs could make it possible ( It is easy to say for me but I know that it could mean a great effort)

xod-clock-longer-handles-03-5160ae7.png

 

  • Upvote 5

Share this post


Link to post
Share on other sites
1 hour ago, dipstick said:

The updated version still doesn't work for me.

That's a different issue from before. @xod, to fix this one properly, you'd have to migrate from CodeLab to Visual Studio.

 

 

Currently, all installed fonts on the system are being made available to the plugin UI.  The code looks like this:

FontFamily[] Amount4FontFamilies = new InstalledFontCollection().Families;
props.Add(new StaticListChoiceProperty(PropertyNames.Amount4, Amount4FontFamilies, 0, false));

You need to filter out the incompatible fonts. Something like this:

FontFamily[] intstalledFontFamilies = new InstalledFontCollection().Families;
List<FontFamily> usableFonts = new List<FontFamily>();
foreach (FontFamily font in intstalledFontFamilies)
{
    if (font.IsStyleAvailable(FontStyle.Regular))
        usableFonts.Add(font);
}
FontFamily[] Amount4FontFamilies = usableFonts.ToArray();
props.Add(new StaticListChoiceProperty(PropertyNames.Amount4, Amount4FontFamilies, 0, false));

 

  • Upvote 2

Share this post


Link to post
Share on other sites

Dear Xod!  <3

 

:trophy:   Thank you so much for the plugin and for your effort.  :cake:  :coffee:

 

15_01_2017.png

  • Upvote 4

Share this post


Link to post
Share on other sites

Bravo @XOD - what a wonderful Plugin you have created.  Many thanks :D.

 

vS6pQiB.png

 

 

  • Upvote 4

Share this post


Link to post
Share on other sites

Thanks to all who have appreciated my work.
I am convinced that someone else could do the work much better because I'm just a beginner in C #.
If someone wants to make another plugin is my guest and I will remove my plugin.
I do not know how to port the code to Visual Studio.
I have not found any detailed explanation about this except one of EER from VS2010.
I think it would be useful to make a post for explaining in detail with screenshots for those who don't know english very well.

  • Upvote 1

Share this post


Link to post
Share on other sites
14 minutes ago, xod said:

Thanks to all who have appreciated my work.
I am convinced that someone else could do the work much better because I'm just a beginner in C #.
If someone wants to make another plugin is my guest and I will remove my plugin.
I do not know how to port the code to Visual Studio.
I have not found any detailed explanation about this except one of EER from VS2010.
I think it would be useful to make a post for explaining in detail with screenshots for those who don't know english very well.

 

Don't worry about it. If I wanted to make a clock, I would likely make it by hand manually anyway. Most people would probably be able to use your plugin the way it is anyway.....

Share this post


Link to post
Share on other sites

@BoltBait, I have some question:
Because it's a Class Library file and not an exe file the code can not be run in VS. Correct?

But if I make the GUI and the code in VS how to transform the exe file to dll file that can be run in paint.net?
What should I do besides adding references to PDN and transform Windows Form App to Class Library?

 

@sashwilko

Change the Font color (white) to another one.

 

I added an option for digital clock. You must install the font found in the zip archive.

Spoiler

vUzpJxE.png

 

 

 

 

Edited by xod
  • Upvote 1

Share this post


Link to post
Share on other sites
11 minutes ago, xod said:

Because it's a Class Library file and not an exe file the code can not be run in VS. Correct?

 

That's right.  You'll need to compile, then copy the dll file into the proper paint.net directory in order to test.

 

11 minutes ago, xod said:

But if I make the GUI and the code in VS how to transform the exe file to dll file that can be run in paint.net?

 

Just follow the instructions in the tutorial I posted above and the output of VS will be DLL and not EXE.

 

11 minutes ago, xod said:

What should I do besides adding references to PDN and transform Windows Form App to Class Library?

 

All the instructions are given in the tutorial for moving a CodeLab script to a VS project.

 

Those instructions will NOT change your project into something that can use a custom UI--it will still be using IndirectUI.

  • Upvote 1

Share this post


Link to post
Share on other sites

@xod Sounds like you're moving to a WinForms UI. If you want I can send you a link to my updated user guide for the VS template. That should help you get started.

 

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