Jump to content

[Suggestion] Provide the DPI value in EnvironmentParameters or SourceSurface


midora

Recommended Posts

Some of my plugins need the DPI value to function correctly. I.e. if your are are drawing  text in a specific pt size or you like to enter a value in cm or inch.I always have to add a control where the user can enter the dpi value (just now for the 'Word Search' Maker plugin).

 

It would make usage of the plugins easier for the user to avoid this special setting.

 

If DPI value is already available just provide the information how I can get it.

  • Like 1

midoras signature.gif

Link to comment
Share on other sites

  • 2 weeks later...

This will now be available in 4.2.16 via the DocumentResolution property, which returns a value of type Resolution

 

Resolution has X, Y, and Unit properties. There are some static helper methods on Document if you need to convert or normalize to inches. The units may be Inches, Centimeters, and technically could even be Pixels in which case you should just default to 96 DPI (you can use Document.DefaultResolution to help). I don't think there's any user-facing way to set the units to pixels, but apparently it's possible -- probably via bad EXIF metadata.

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

53 minutes ago, midora said:

Just one question, where will this property be located?

 

In the EffectEnvironmentParameters class.

  • 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

2 hours ago, null54 said:

In the EffectEnvironmentParameters class.

 

OK, thanks. Let's see how it will integrate.

 

BTW: I guess I need more time to optimize 'Word search' Maker. To create the grid I implemented a backtracking algorithm which needs some time and resources if the number of words is large compared to the number of grid cells. No idea for a better algorithm in the moment.

 

 

 

midoras signature.gif

Link to comment
Share on other sites

I tried to figure out what the German phrase "Gibt man jemanden den kleiner Finger, dann nimmt er die ganze Hand" means and came up with

"Give them an inch & they'll take a mile" or "Teach a man to fish and he'll expect you to buy the beer". So be prepared 😉

 

I like to propose a related suggestion not for developers but for users:

 

The status line shows the unit, a percentage and a button to switch to 100%.

Percentage and button are pixel related. What about to relate them to the unit?

This would mean that if you are selecting cm or in and a percentage of 100% then the image dimensions on screen should be exactly like on a printout.

Unit px should keep the old behavior.

 

I wouldn't have asked this some years ago but in the meantime windows is fit enough to provide the correct information.

 

 

 

 

midoras signature.gif

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...