midora Posted March 15, 2021 Share Posted March 15, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted March 16, 2021 Share Posted March 16, 2021 That should be pretty easy to add, I'll look into it for 4.2.16 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted March 16, 2021 Author Share Posted March 16, 2021 Great, I would first use it in the 'Word Search' Maker plugin 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted March 26, 2021 Share Posted March 26, 2021 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. 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted March 26, 2021 Author Share Posted March 26, 2021 I hope we will never see rectangular pixels 😉 Thanks Rick. Just one question, where will this property be located? Quote Link to comment Share on other sites More sharing options...
null54 Posted March 26, 2021 Share Posted March 26, 2021 53 minutes ago, midora said: Just one question, where will this property be located? In the EffectEnvironmentParameters class. 1 Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint 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 More sharing options...
midora Posted March 26, 2021 Author Share Posted March 26, 2021 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. Quote Link to comment Share on other sites More sharing options...
midora Posted March 26, 2021 Author Share Posted March 26, 2021 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.