Editable Image Region - Plugin Update - Messages
WroteFound it! Seems related to the exceptions
1. Add a region in the canvas;
2. add in the placeholder something like mat(identity(3),identity(3),identity(3),1,3);
3. change one of the RGB channels with a number (e.g. 1) -> mat(identity(3),1,identity(3),1,3);
4. double-click will launch the image viewer;
BTW, you should propagate the evaluation exceptions to the user, currently you can't notice when something fails in the evaluation...
Fixed
WroteFixed
Thank you Alex

I just noticed that the double-click issue happens even when you open an existing worksheet having the "auto calculation" feature disabled (until you launch a recalculation, then it works fine).
- Printable resolution of displayed PDF and SVG (and file types that depend on these) was increased to 300 DPI.
- Scaling down bug in print preview / print output of image region is fixed
- Re-sizing of the region is smoother and produces better quality graphics
- Few general improvements
On this note, do you guys know what is the easiest way to get current system DPI? Similar to below throws an error "'ImageEdit.ImageCanvas' does not contain a definition for 'CreateGraphics' and no extension method 'CreateGraphics' accepting a first argument of type 'ImageEdit.ImageCanvas' could be found"
http://stackoverflow.com/questions/5977445/how-to-get-windows-display-settings
WroteWroteFixed
Thank you Alex
I just noticed that the double-click issue happens even when you open an existing worksheet having the "auto calculation" feature disabled (until you launch a recalculation, then it works fine).
Davide, it seems that prior to evaluation I have only two choices - either to allow the double click or not. What would be a good reason for choosing "No" over "Yes" here?
WroteOn this note, do you guys know what is the easiest way to get current system DPI?
Andrey provided an useful:
GlobalParams.ScreenDpi
using (Graphics g = Graphics.FromImage(new Bitmap(1,1)))
{
float dpiX = g.DpiX;
float dpiY = g.DpiY;
}
WroteDavide, it seems that prior to evaluation I have only two choices - either to allow the double click or not. What would be a good reason for choosing "No" over "Yes" here?
I don't know; imho the best approach is to filter the click region, then you can choose what's the best for you as developer, the important thing for me is to not cause troubles when editing stuff in the placeholder.

if (!base.dblclick.Enabled)
{
Rectangle canvas = new Rectangle(new Point(1,1), this.canv.Size);
if (canvas.Contains(e.Location))
base.dblclick.Enabled = true;
}
- Double click has no effect in the placeholder portion of the region
- Latest library Svg.dll 2.2.0 included https://github.com/vvvv/SVG
- Rendering speed of complex SVG was significantly increased (x50) by applying this, potentially incorrect, fix https://github.com/vvvv/SVG/issues/208
- Ability to import ANY file type. The manual render of the file (png, pdf, svg or psd) will be sought for in either root folder of the .sm document or C:\Users\USERNAME\AppData\Roaming\SMath\extensions\plugins\63ddaef8-9a56-4ff6-938e-d590b638bf99\Temp. It is expected that the render will have same filename (different extension) as the file that opens on double click of the image region. Note that mentioned file name IS NOT THE SAME as the filename of the imported file.
see SS-2397
Alex, what is your username in the bug tracking system?
I propose to change the default path to the document directory or current directory if the doc is not yet saved.
EDIT: filed as SS-2399
details, screenshot, example files under SS-2400
WroteThere seems to be a problem in the SVG engine
see SS-2397
Alex, what is your username in the bug tracking system?
Martin, how an engine renders SVG is out of my control. I can check if problem persists with SVGSharp, but that engine has its own issues. If you know a particular revision of SVG or SVGSharp library that renders your file correctly let me know.
WroteIf I try to import a png-file, then the dialog opens with path C:\
I propose to change the default path to the document directory or current directory if the doc is not yet saved.
EDIT: filed as SS-2399
I will see what I can do
WroteThere are image display problems if the file name is given in the placeholder.
details, screenshot, example files under SS-2400
THis should be an easy fix
I hope to work on the plugin upcoming weekend.
Wrote
Martin, how an engine renders SVG is out of my control. I can check if problem persists with SVGSharp, but that engine has its own issues. If you know a particular revision of SVG or SVGSharp library that renders your file correctly let me know.
The image region as it was 2 years ago did render my files correctly. Actually, the files are generated by gnuplot, thus we could play around a bit with terminal settings. The Maxima Draw regions (Maxima plugin) also render svg images (they were developed based on the original image region). These DrawRegions are not very mature, therefore currently they are not a general option for plotting with Maxima.
Wrote
I hope to work on the plugin upcoming weekend.
Thanks a lot.
BTW, in my recent testing I experienced problems with simultaneous file access. Perhaps Maxima (Gnuplot) and the Image region try to lock the file.
For Maxima to display graphics, it is essential that images shown in the Image region can be updated dynamically without being locked by the Image region.
If things get too complex, possibly, an option could be to have a separate region for display of images and one for import/create/editable images.
WroteWrote
Martin, how an engine renders SVG is out of my control. I can check if problem persists with SVGSharp, but that engine has its own issues. If you know a particular revision of SVG or SVGSharp library that renders your file correctly let me know.
The image region as it was 2 years ago did render my files correctly. Actually, the files are generated by gnuplot, thus we could play around a bit with terminal settings. The Maxima Draw regions (Maxima plugin) also render svg images (they were developed based on the original image region). These DrawRegions are not very mature, therefore currently they are not a general option for plotting with Maxima.Wrote
I hope to work on the plugin upcoming weekend.
Thanks a lot.
BTW, in my recent testing I experienced problems with simultaneous file access. Perhaps Maxima (Gnuplot) and the Image region try to lock the file.
For Maxima to display graphics, it is essential that images shown in the Image region can be updated dynamically without being locked by the Image region.
If things get too complex, possibly, an option could be to have a separate region for display of images and one for import/create/editable images.
Martin, could you provide a clear example demonstrating the file access issue? It will simplify debugging.
Also what image file formats can MAXIMA output? True vector graphics in .NET is metafile (emf), which renders well in Smath, then there is pdf which also renders well. Both SVG renders I tried have their own quirks... I will test SVGSharp to see if I can get SVG resizing work correctly (I failed last time) and if it will work with DISLIN, another plugin which uses Image Region.
Thanks
Wrote
Martin, could you provide a clear example demonstrating the file access issue? It will simplify debugging.
Thanks
The behaviour, which the display of gnuplot-generated images (that is what Maxima produces) relies on is this:
- if a name in the placeholder of the image region is given, then the region tries to display that image.
- if the image does not exist, nothing is displayed.
- if the file appears in the file system, the image is displayed
- if the file changes, the display is updated
- existance and update checks are done upon re-calculation. Perhaps sort of delay for reading the file is required if the file is still written while the image region tries to access it.
Currently, whenever a file generation fails due to some error on Maxima side, then I get a dialog asking if the file should be generated. If I confirm, then a file is written but possibly not closed immediately, as the file manager complains about an invalid image file.
May that lead to a conflict, when some process tries to write the file?
An example, where a clearly existing png image is ignored by the Image region, is given in the attachment of http://smath.info/bts/Issues/IssueDetail.aspx?id=2400
Wrote
Martin, could you provide a clear example demonstrating the file access issue? It will simplify debugging.
Also what image file formats can MAXIMA output? True vector graphics in .NET is metafile (emf), which renders well in Smath, then there is pdf which also renders well. Both SVG renders I tried have their own quirks... I will test SVGSharp to see if I can get SVG resizing work correctly (I failed last time) and if it will work with DISLIN, another plugin which uses Image Region.
Thanks
Gnuplot can produce pdf images, however, I never tried that. Going for that option would require some rework of the Draw functions in the Maxima plugin, as currently, only svg (default) or png are supported. Easiest workaround would perhaps be the switch from svg to png as default image format.
The internal MaximaDrawregion uses these functions:
using SharpVectors.Dom.Svg;
using SharpVectors.Renderers.Forms;
using SharpVectors.Renderers.Gdi;
This seems to work for gnuplot generated images.
WroteThere are image display problems if the file name is given in the placeholder.
details, screenshot, example files under SS-2400
Martin, this was partially fixed (build 6103). Smath workbook attached in the bug report displays correctly. File access problem was fixed. Clone/copy was fixed. Proper rendering of SVG files produced by Maxima was not fixed since the only solution (roll back to a different render engine) will create a different set of rendering issues.
There you find some illustrations (too cumbersome to add here).
Essentially, the image region can overwrite image files unexpectedly.
How to reproduce the problem:
save the attached sm file and png image to any folder.
open the sm file
clone the image region using Ctrl-drag
replace the filename in the new region placeholder by the variable name Grau
recalculate
What happens:
- The original region turns grey and you find that the file "fhb_logo_neu.png" has been overwritten (is now grey instead of red)
- perhaps also SMath gets stuck. You can, however, save the file and re-open SMath.
I expect the display of files using image regions not to backfire to the image file under any circumstances. My guess on what might happen (without any real insight):
- any image region has an external file name attribute which is set if you write a file name to the placeholder
- The file name is only changed if a new file name is specified, but not if the file name is replaced by a variable (a random unique file name should be used in that case, if required at all)
- upon cloning the region, this file name is not changed
- if the contents of the image changes, then the external file is synchronized.
If these assumptions are correct, then the problem is the item in bold.
WroteI filed a bug report at http://smath.info/bts/Issues/IssueDetail.aspx?id=2432
There you find some illustrations (too cumbersome to add here).
Essentially, the image region can overwrite image files unexpectedly.
How to reproduce the problem:
save the attached sm file and png image to any folder.
open the sm file
clone the image region using Ctrl-drag
replace the filename in the new region placeholder by the variable name Grau
recalculate
What happens:
- The original region turns grey and you find that the file "fhb_logo_neu.png" has been overwritten (is now grey instead of red)
- perhaps also SMath gets stuck. You can, however, save the file and re-open SMath.
I expect the display of files using image regions not to backfire to the image file under any circumstances. My guess on what might happen (without any real insight):
- any image region has an external file name attribute which is set if you write a file name to the placeholder
- The file name is only changed if a new file name is specified, but not if the file name is replaced by a variable (a random unique file name should be used in that case, if required at all)
- upon cloning the region, this file name is not changed
- if the contents of the image changes, then the external file is synchronized.
If these assumptions are correct, then the problem is the item in bold.
I will take a look at this bug and WIN10 issues hopefully upcoming weekend.
Existing file modification is unacceptable; frankly off the top of my head I have no idead why would this happen.
Actually nevermind that, I think I know what is happening.
1. you specify an image path in a placeholder; the name of the image is saved
2. the image gets copied to the temporary folder to be saved saved within smath document
3. you "read" image into a single matrix variable
4. you substitute variable into image region placeholder; unless variable is in a format [ [R] [G] [B] ] it is interpreted as a grayscale png
5. This grayscale PNG is saved with the same filename as original image
There is more than one way to fix this. Let me know your preferred fix. Also out of curiosity what were you trying to achieve by this workflow?
It is the most convenient way to create new regions if you need them with similar settings, in the given case with similar size.
I think in the given case it would be sufficient to modify the internal file name (switch to a randomly generated one) as soon as the contents of the placeholder is changed.
Just to be safe, you also could open files specified in the placeholder read-only (in fact, I exptected this to be this way). I am not aware of an Image region feature where one would need to write to that file.
How about using the bug tracking system? We could exchange comments there without creating noise in the user forum... The editor for posts is much better there (you can copy images from the clipboard).
WroteIssues are are form's fonts changed, desktop background visible through the window and these. I'll see if I can help Alex, as pointed out the issues are related to windows 10 only.
Davide if you point out what portion of the plugin code is loaded before one inserts the region I could sift through it and see if there is anything related to DPI? I remember using DPI values in the code and I might have made a mistake and implemented something I did not intend.
Also this will happen when I get some time off work - I was working on weekend again
WroteCloning existing regions and subsequent modification is a typical element of my workflow for creating documents. Ctrl-drag isn't even half the interaction required compared to copy/paste even if you use keyboard shortcuts.
It is the most convenient way to create new regions if you need them with similar settings, in the given case with similar size.
I think in the given case it would be sufficient to modify the internal file name (switch to a randomly generated one) as soon as the contents of the placeholder is changed.
Just to be safe, you also could open files specified in the placeholder read-only (in fact, I exptected this to be this way). I am not aware of an Image region feature where one would need to write to that file.
How about using the bug tracking system? We could exchange comments there without creating noise in the user forum... The editor for posts is much better there (you can copy images from the clipboard).
This has been fixed.
I will need a hand with WIN10 and DPI issue because righgt now im poking in the dark
Image Region is ready for the future!
Thank you, Davide
WroteDavide has fixed the DPI related issue of Image Region on the WIN10 machines. I have tested it extensively over weekend and all seems to be in order.
Image Region is ready for the future!
Thank you, Davide
I have updated the portable distribution.
-
New Posts
-
No New Posts