Jump to content

MathLaTex plugin


Recommended Posts

Alrighty!

 

RE: https://forums.getpaint.net/topic/116364-math-support-latex/

 

Here's the second draft: <removed>

 

 

Installation:

 

  1. Unzip the file
  2. Copy both DLL files to....
  • Classic: your \Effects\ folder.
  • Store:  /My Documents/ paint.net App Files/Effects/

       3. Restart paint.net

       4. find the plugin in Effects > Text Formations

 

Math-La-Tex-UI.png

 

Notes:

  1. I tried and failed to bundle the two DLL's into one
  2. Renders in Black - not the Primary color.
  3. Remainder of the layer will be made transparent

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

1) Needs some Dark Theme lovin'  https://forums.getpaint.net/topic/112962-guide-dark-theme-support-for-custom-effectconfigdialog/

2) The 'X' needs to capitalized. LaTeX

3) You're still generating the image in the UI class. It's usually better to do that kind of thing in OnSetRenderInfo()

 

  • Like 1
  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Thanks for the pointers toe_head2001. I'll give it some more lovin' :mrgreen:

Link to comment
Share on other sites

On 5/10/2020 at 9:38 PM, Ego Eram Reputo said:

I tried and failed to bundle the two DLL's into one

 

I ran into this when building my GmicSharpPdn example plugin.

I ended up using the ILMerge.Fody NuGet package with a customized included files filter, see the Build notes section of the gmic-sharp-pdn-example Readme for details.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Thanks Null54. I'll try that.

 

I should have been more verbose when I mentioned that issue. I did manage to get the DLLs combined, unfortunately the plugin did not run in that state. The error was along the lines of "your plugin can't find WpfMath.dll or one of its components".

Link to comment
Share on other sites

  • 2 weeks later...

I haven't succeeded in bundling the DLLs. I'm inclinded think the WpfMath.dll may not be playing nicely with ILMerge.

 

On 5/11/2020 at 6:18 PM, toe_head2001 said:

1) Needs some Dark Theme lovin' 

 

Oh yeah....

 

Dark-UI-image.png

 

On 5/11/2020 at 6:18 PM, toe_head2001 said:

2) The 'X' needs to capitalized. LaTeX

 

Check.

 

On 5/11/2020 at 6:18 PM, toe_head2001 said:

3) You're still generating the image in the UI class. It's usually better to do that kind of thing in OnSetRenderInfo()

 

Sorted.

 

 

Here's the third draft <removed>

 

Installation:

 

  1. Unzip the file
  2. Copy both DLL files to....
  • Classic: your \Effects\ folder.
  • Store:  /My Documents/ paint.net App Files/Effects/

       3. Restart paint.net

       4. find the plugin in Effects > Text Formations

 

Link to comment
Share on other sites

1 hour ago, Ego Eram Reputo said:

I'm inclinded think the WpfMath.dll may not be playing nicely with ILMerge.

 

After looking at the ILMerge manual, my guess is that WpfMath uses embedded resources that it fails to find after merging.

You will probably just have to distribute the two DLL files.

  • Upvote 1

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Looks pretty good now, but I have a few suggestions:

- Set the maximum height of the dialog to a much lower value.

- The plugin output should either: make the entire canvas transparent, or the equation should be blended onto the source Surface.

- For the "More plugins" link, you should use the IShellService.LaunchUrl() method since it does error/exception handling for you.  And don't forget the 's' in https://

Services.GetService<IShellService>().LaunchUrl(null, "https://www.getpaint.net/redirect/plugins.html");

- Don't forget to set the Cancel property in CancelEventArgs:

private void MathLaTexConfigDialog_HelpButtonClicked(object sender, CancelEventArgs e)
{
    e.Cancel = true;
    MessageBox.Show("Bla Bla Bla");
}

- Each time you set a new value for your Bitmap, be sure to dispose the old value. Garbage Collection in .NET is pretty good these days, but exercising "best practices" is still better.

myBitmap?.Dispose();
myBitmap = new Bitamp(newValue)

 

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Actually, for the HelpButton, you should just use the override, instead of assigning a method to the event.

 

protected override void OnHelpButtonClicked(CancelEventArgs e)
{
    e.Cancel = true;
    base.OnHelpButtonClicked(e);

    Services.GetService<IShellService>().LaunchUrl(null, "https://www.getpaint.net/redirect/plugins.html");
}

 

And do the same for any other Events on the Form.

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

On 5/24/2020 at 9:15 PM, toe_head2001 said:

- Set the maximum height of the dialog to a much lower value.

 

Done. I'll fix the height.

 

On 5/24/2020 at 9:15 PM, toe_head2001 said:

- The plugin output should either: make the entire canvas transparent, or the equation should be blended onto the source Surface.

 

I've gone with clearing the canvas.

 

On 5/24/2020 at 9:15 PM, toe_head2001 said:

- For the "More plugins" link, you should use the IShellService.LaunchUrl() method

 

Changed.

 

On 5/24/2020 at 9:15 PM, toe_head2001 said:

- Don't forget to set the Cancel property in CancelEventArgs:

 

Added.

 

On 5/24/2020 at 9:15 PM, toe_head2001 said:

Each time you set a new value for your Bitmap, be sure to dispose the old value.

 

Quite right. Added.

 

On 5/24/2020 at 9:40 PM, toe_head2001 said:

Actually, for the HelpButton, you should just use the override, instead of assigning a method to the event.

 

That's neat. Changed.

 

On 5/25/2020 at 4:56 AM, NSD said:

You should also fix the issue with scaling size.

 

I'm working through the HiDPI issues (there are a few....)

Link to comment
Share on other sites

  • 4 weeks later...

Alrighty. This build should have fixed the high DPI issues and I've added some theme-love to make the error messages more readable too.

 

I tested it at 100%, 125%, 150% & 175% font size. If anyone wants to go higher - please let me know if it continues to scale well.

 

Download

 

 

Installation:

  1. Unzip the file
  2. Copy both DLL files to....
  • Classic: your \Effects\ folder.
  • Store:  /My Documents/ paint.net App Files/Effects/

       3. Restart paint.net

       4. find the plugin in Effects > Text Formations

 

 

 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...