How can I count and display the number of brush strokes in the current document? - adobe

I was looking for a way to be able to count and display the number of strokes made in the current document using the Photoshop brush tool.
I have very basic programming knowledge, but Photoshop scripting is confusing and there doesn't seems to be much in terms of learning material out there. Didn't get a clue out of the Photoshop scripting guide pdf.
I assume if you could query the starting event of the brush stroke tool and add it to an array, could then display current size of the array?

Related

What is the appropriate method of implementing a large pixel-editable drawing area in Qt

I am designing a paint application that allows you to create and edit very small sprites and tiles for an embedded application. Here it is in action. We're talking 8x8 pixel elements. This application allows you to edit single pixels at a time, and I'm currently in the process of modifying it to allow you to edit multiple sprites in a sheet at the same time in the editor, making the process of developing larger sprites that consist of multiple 8x8 sprites much easier.
In the exact same way the original NES operated, these sprites/tiles are limited to and defined by color palettes with a limit of 16 colors. Doing research, I found that QImages can have their mode set to be indexed and an indexed color table can be assigned to them, which is precisely what I need.
As it stands, it currently uses QGraphicsScene/View to display a QImage in indexed mode. However the problem is that as the editable area increases, i.e. the more 8x8 elements you want to have editable at a given time, it would seem that performance would tank commensurately since you have to convert the entire QImage to a QPixmap and update the object in the QGraphicsScene every time a pixel is changed.
One could break up the scene into individual 8x8 QImages and composite them to look like one unified image, however this seems more like a hack, and would definitely complicate the logic.
So, what is the proper approach to this problem?

Draw pixel by pixel on Custom Renderer (Xamarin.Forms)

I have a frame with some items inside. The corner is very useful, but is there a way to draw pixel by pixel, or shapes using Custom Renderers?
I'm trying to draw a message balloon.
The simplest option would be using SkiaSharp, which would allow you to have all your drawing code in your pcl/shared library.
Another option would be to create a custom view and write custom renderers for each platform, which add a native drawing canvas to your Forms view and do all the drawing procedures you need. It might be a bit faster than Skia in terms of performance, however the downside is that you have to write dedicated drawing code for each platform involved.
As of my personal experience, I'd suggest using Skia, especially if you intend to alter the drawings depending on data or user input.

Zooming a view in PyQt?

I have a simple to do tree application that displays a QTreeView inside of a QMainWindow. I want to give the user the ability to change the magnification level of the content (using a spinbox most likely), but without actually changing the underlying font size of the text.
Is there a way to do this without changing my whole app to a QGraphicsScene? The app is just showing a good-old fashioned tree with text, no graphics or anything fancy other than wanting to change the magnification of the view; hence, I am thinking that switching to a graphics scene would be overkill.
Or, am I wrong, and switching to a graphics scene is the only simple way to do it?
Note a trimmed down version of the app is at Code Review. It contains a SSCCE, but is a bit long to post here.
In a site discussing how to put widgets on a scene, trolltech wrote (emphasis added):
I myself and several other Trolls’ve spent some time researching this
topic [how to embed a widget in a QGraphicsScene]. It’s not trivial;
most solutions to embedding widgets into a scene end up with several
serious drawbacks. That’s also why Qt doesn’t have any off-the-shelf
solution to this.
Widgets cannot be scaled or rotated, but graphics items can.
This suggests I cannot perform, in a simple way, the operations I want to on my QWidget by itself. That is, perhaps I need to add it to a scene, which is what I was trying to avoid. If that is the answer, then I'll accept it and start a new question if I get stuck doing that.
Note I just found this question, which is pretty much a duplicate, and does not have an (accepted) answer.
Related content
http://www.qtcentre.org/threads/62745-Zoom-a-view
QTableView Zoom In/Out
Drawing widgets (such as buttons) over QGraphicsView
QGraphicsView Zooming in and out under mouse position using mouse wheel
https://forum.qt.io/topic/15308/qgraphicsview-zooming-with-qslider
https://wiki.qt.io/Smooth_Zoom_In_QGraphicsView
As suggested by the docs quoted from trolltech in the original question, there is no built-in method to zoom on a view.
If the goal is to avoid the use of QGraphicsViews, the simplest way to separate the size of the font on the screen, versus the size of the font saved or printed, is to basically have two fonts. One to be displayed on the screen you can call 'zoom', versus the other to be saved/printed and call that 'font size'.
I got this idea from qtcentre (in a post I added to the original post too):
http://www.qtcentre.org/threads/62745-Zoom-a-view

Nodal graph in Qt for Programmable Flow Charts

I was wondering if there was a nice way to allow users to create nodal graphs (with restrictions) as with LabView.
Something like this:
I have seen http://www.pyqtgraph.org/, which seems to have something similar, and I do intend to use PyQt as my base (though I do not mind linking in C++ code), but it doesn't quite have the look and feel I wanted.
Any pointers to the right direction would be great.
There is a Diagram Scene Example which uses the Graphics View framework to make flowchart diagrams. It is an application in which you can add flowchart shapes and text and connect the shapes by arrows. The shapes, arrows, and text can be given different colors, and it is possible to change the font, style, and underline of the text.
You can take a look at the code and see how to create custom graphics items and handle mouse events and movement of items. Then change the look and behavior as you like.
Check another diagram editor here.
[not enough reps. to comment]I too had a similar task to implement. For me it was a large and complex block diagram. It was really hard to implement using QGraphicsScene. I posted a question on SO and instantly gained enough downvotes. No one gave any useful hints. So I did the hardway. Created images of lines with transparent background and changed the style-sheet dynamically. I don't know weather this is the right way. It will be really helpful if someone gave insights on this.

How to add pop-out annotations in Graphviz?

I am a newbie learning to use graphviz.
Is it possible to generate interactive pop-out annotations when you move cursor around the graph? For example, hovering a node/edge will pop-out message box showing more information about it.
And if so, how?
Thank you so much for the help.
Depending on the output format, there are some possibilities:
You may create a png image and an image map and serve it as a html page. The world of html and javascript offers endless possibilities to make this interactive, use popout messages, etc.
If you prefer svg, some information is already included in the output as <title>, and again, if served within a browser, javascript may prove useful to enrich the output (not sure if it's possible to use existing svg with raphaeljs, but it sure shows nicely what's possible with svg + javascript).
You may simply have graphviz render the positions of all nodes and parse it's output to present it in your custom application

Resources