MPI 4.3.2

Here's where to discuss using Stéphane Leys' very well done alternative runtime editor. If you're a control freak at runtime you have to check this out!

MPI 4.3.2

Postby S. Leys » Mon May 31, 2010 6:59 am

I have posted MPI 4.3.2.

There is a new module in this release, the Paint Pict module.
This module offers the traditional painting tools working on picturedata with 32 bits colors (i.e. millions of colors with alpha).

* What is done :
- The pencil
- The bucket
- The brushes, 6 brush shapes with 4 sizes each.
- The lines 
- Geometric tools : rectangle, circle, ellipsis, regular polygons from 3 to 8 sides
- The eraser

- Stipples : OpenGL's GL_POLYGON_STIPPLE is the equivalent of SC's patterns (fillpat) but the size of the pattern is 32*32.
Stipples may be used with brushes and geometric tools. 
The Paint Pict module includes a stipple editor allowing to modify existing stipples or creating new ones and saving them to a file.
Thanks to John for helping me filling some of the 127 stipples (stipple 1 is black and means no stipple). There are still some empty ones available for edition though. In the editor, the stipples may be moved by D&D (wait doubleclicktime before dragging). Pictures may also be dropped to the stipple slots (size 32*32 only). Since stipples are black and white masks, the result is better when using B&W pictures but there is a threshold slider to tell which pixels are imported (in percentage of the manhattan distance from black in the RGB space). If the threshold is 1, all pixels are black except pure white. If the threshold is 0, all pixels are white except pure black.

- Antialiasing : the lines and the geometric tools may be antialiased (the antialiasing of geometric tools with no frame and stipples would deserve to be improved)

- The rectangular selection tool. This tool allows selecting an area of the picture and moving it around or erasing it using the backspace or the suppr keys or copying or cutting it.

- Copy and paste. You can copy SC objects or export picturedata to clipboard and paste this into the picture. Any clipboard containing a picture may be pasted, even if copied from another application. The limitation is that the pasted picture must not be larger than the graphic where pasted. Copying the area selected with the selection tool will put picturedata into the clipboard which may then be used anywhere picturedata can be pasted (into the same picture or setting the picturedata of another graphic to clipboard  ...).

- Undo. It's a simple one level undo, it undoes the last action, undoing again redoes.

* Not done yet :
- The lasso
- The polygon tool
- The spray
- The text tool. In the meantime, it is possible to copy a text field (the field itself, selected with the pointer tool, not the text selected with the browse tool) and paste it into the picture. To have only the text, the showpen, showfill and showframe of the field must be false when copying.

* Using it is quite simple :
Open the module.
Drop a rectangle graphic from the tools module and resize it (keep it selected). Or select an existing graphic with the pointer tool (the graphic where you want to paint must be selected with the pointer or universal tool to enable the painting tools).
Select the tools in the palette and use them as usual.
You can start with a rectangle containing picturedata or not. If the graphic doesn't have picturedata, MPI will create it.

* Limitations :
The important thing to know is that this module is working on the picturedata, not on any transformation SC is doing to them to display them in graphics of various styles with various properties (inks, quad, filters ...).
The OGL context where painting is done is rectangular and its size is the imagerect.  
The consequence is that, to avoid conflicts and side effects, SC must be showing the raw picturedata, which is the case only when it is displayed in a rect graphic with its original size, no change in the pictureinfo, no filter and the ink set to srccopy.
Any change in these properties will disable the painting tools.
If you want to have other properties, you need to paint into a standard rect graphic first, then export its picturedata and set the picturedata of another graphic with the wished properties to the painted picturedata.
Or, if you changed some properties and want to paint again, you need to reset the properties (set the aspect to reset ...).
Thus, it's better to choose carefully the size of your graphic before starting to paint because resizing it won't allow painting any more. There is a workaround for changing the size though : select the picture (cmd-A for the whole picture), copy, create another larger graphic and paste.
Graphics whose picturedata have been set by the OGL module aren't available for painting either because, on any update, the OGL module would reset the gradient picture and thus destroy the painting.

A difference with SC's paint tools is that the cursor will show the current tool only when the mouse is in the selected graphic available for painting. And the marching ants are actually marching only if the mouse is in the window.

Another glitch is that SC is drawing the showpen inside the rect of the graphic, this is the best solution, IMHO, but the drawback is that the pen is hiding some editable pixels. MPI is aware of the showpen and clips the OpenGL context for display (the pixels below the pen remain editable though, even if not visible). This is a bit annoying when using cmd-A for selecting the whole picture, the marching ants are outside the clipped rectangle. So, when painting, it is better to set the showpen to false.

* Reminder : MPI leaves precedence to other projects for using keyboard shortcuts. So, MPI will handle cmd-C, cmd-V, cmd-A ... only if no menu is using them. If you want to use them when painting picturedata, you'll have to close the RTE or open it as a palette. If there is a menu with these shortcuts, you'll have to do this via the MPI menus.

* Gradients.
In the previous version, I had added an option for setting the same color for all vertices (useful for polygons with many points). Since any option key other than ctrl discards contextclick, I was using this key. The drawback is that the gradients tool required a 2 buttons mouse (anyway, selecting the saturation and the alpha in the color popup requires a wheel). I've removed this feature and the gradient tool may now be used with one button mice (limited to saturation and alpha =1).

* Warning :
- The installer doesn't delete old modules. However, some of them are not any more in the package and may not work or even cause problems. Use them at your own risk. The old picturedata module is obsolete, I had a freeze report with it, you should dump it.

User avatar
S. Leys
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: MPI 4.3.2

Postby johncollett » Tue Jun 01, 2010 2:39 pm

Thank you, Stéphane, for the gradient. JC
User avatar
Posts: 100
Joined: Sat Aug 02, 2008 2:53 pm

Re: MPI 4.3.2

Postby S. Leys » Tue Jun 01, 2010 11:37 pm

jcollett wrote:Thank you, Stéphane, for the gradient. JC

You're welcome.

User avatar
S. Leys
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Return to Using MPI

Who is online

Users browsing this forum: No registered users and 1 guest