Hello community! Hi R0J0hound! Remember a while back when you were adding a tiff generator system to your plugin? So I didn't stop there. I added several actions, conditions and expressions to the plugin. I used the base of your plugin to no longer create a canvas plugin.
Link do new plugin in my github: github.com/MarceloGh05t/canvas-plugin-construct2
Examples capx link: github.com/MarceloGh05t/canvas-plugin-construct2/tree/main/exemplos
Actions added to the plugin:
- Request TIFF Data URL (RequestTIFFDataURL):
What it does: it will request the entire drawing created on the canvas in dataUrl format and transform it into tiff format (allowing to save the canvas content in Tiff), as it is an asynchronous request, I used a trigger to validate through "true" when the tiff are ready. The CanvasToTIFF api was used. You need to use the OnAnyTIFFComplete condition.
- Draw SVG path (drawSVGpath):
What it does: Draws on canvas using path SVG (graphics). Example: "M150 50 L75 200 L225 200 Z"
- Fill path image (fillPattern):
What it does: Fills the path(ctx) created on the canvas with an image. The image will be pulled by the name of the file included in the construct project. The image will be printed inside the created path, without resizing the image, that is, if it is bigger, it will fill with the x and y position of the path in relation to the image.
- Fill path image with effect (fillPatternEffect):
What it does: It fills the path(ctx) created on the canvas with an image with the effect, which must be typed with the factor. Example of factor-to-type effects: contrast(1.4) sepia(1). The image will be pulled by the name of the file included in the construct project. The image will be printed inside the created path, without resizing the image, that is, if it is bigger, it will fill with the x and y position of the path in relation to the image.
- Move Path With Translate (MovePathWithTranslate):
What it does: Moves the path (path) to apply the design to the canvas, changing the x and y zero values of the canvas identification matrix, making the moved point as if it were the zero point of the path. You need to use the other action to reset the matrix (Reset Identity Matrix), I will describe it below.
- Reset Identity Matrix (ResetIdentityMatrix):
What it does: resets the canvas matrix when it is changed by translate (to move a path) or any other change in it, like rotating the path through changes in the canvas matrix. This action returns to the initial values of the canvas matrix.
- Draw Image Natural Size (DrawImageNaturalSize):
What it does: Draws an image from an external file on the canvas, but at the original image size. The image may be cropped if applied after the path created before drawing the image.
- Draw Image Scale Size (DrawImageScaleSize):
What it does: Draws an image from an external file on the canvas, but allows changing (decreasing or increasing) the original size of the image. The image may be cropped if applied after the path created before drawing the image.
- ClipPath (ClipPath):
What it does: Cuts the drawing on the canvas, using another path created to cut over the drawing.
- Request Canvas To SVG Data (RequestCanvasToSVGData):
What it does: transforms the canvas content or image into a string in svg file format, which can be saved or even downloaded as the string content and mine type (application/svg+xml), through the browser plugin with the action Invoke download of string or using another plugin that saves the content to file. As it is an asynchronous function, I created the comparison when the string is ready (OnCanvasToSvgDataComplete), but I will talk about them later.
- Set Origin Point Path (SetOriginPointPath):
What it does: Defines an origin point (x and y) to be used in the current path, this way you can use it in the position of the path or even using MovePathWithTranslate through the matrix using this point. * I intend to create an instance system for the paths.
- Set Origin Point Path Only X (SetOriginPointPathOnlyX):
What it does: Changes only the x of the created origin point to be used in the current path, this way you can use it in the position of the path or even using MovePathWithTranslate through the matrix using this point. * I intend to create an instance system for the paths.
- Set Origin Point Path Only Y (SetOriginPointPathOnlyY):
What it does: It only changes the y of the created origin point to be used in the current path, this way you can use it in the position of the path or even using MovePathWithTranslate through the matrix using this point. * I intend to create an instance system for the paths.
Condition included in the plugin:
- OnAnyTIFFComplete:
What it does: Returns true when the transformation of the canvas content into a tiff is ready to save the file as a tiff.
- On Canvas To Svg Data Complete (OnCanvasToSvgDataComplete):
What it does: Returns true when the transformation of the canvas content into an SVG string (in xml format) is done, which can be saved or even downloaded as the string content and the mine type (application/svg+xml), via from the browser plugin with the Invoke download of string action or using another plugin that saves the content in a file.
- Is Point In Stroke Last Path (isPointInStrokeLastPath):
What it does: Checks if the point x and y are colliding on the last path line.
Expression included in the Plugin:
- Last TIFF Data URL (LastTIFFDataURL):
What it does: Returns the url of the screen that has been transformed into a tiff file to be downloaded.
- Canvas Svg String (CanvasSvgString):
What it does: Returns the svg string in xml format, which can be saved or even downloaded as the string content and mine type (application/svg+xml), through the browser plugin with the action Invoke download of string or using another plugin that saves content to file.
- Origin Point Path X (OriginPointPathX):
What it does: Returns the x-position value of the origin point created for the last path.
- Origin Point Path Y (OriginPointPathY):
What it does: Returns the y-position value of the origin point created for the last path.