Working With Shapes and Polygons

From Scribus Documentation Project

Jump to: navigation, search

Screengrab of maximally enlarged shape – on the printed page these edges will be absolutely crisp, within the limits of the printer resolution.


Shapes and Polygons are two kinds of vector-drawn figures available in Scribus, and once created can be manipulated in identical ways. It's worth mentioning here that if you import vector drawings such as SVGs from other sources, you will be able to edit these within Scribus, but in many cases, making your vector drawings within Scribus will save time.

A major advantage of vector-based graphics, and something of great value in publishing, is that they can be magnified almost infinitely and still have sharp edges.

Contents

Creating a Shape

The default shape is a rectangle, initially seen in the icon. The icon actually has two parts, the main area to the left, and to the right an arrow indicates where to click for a drop-down menu for selecting your shape as seen in our graphic. Click your choice, and you should see that the toolbar icon shows your selected Shape, and it will be highlighted. As with other frames, click-drag to position and size your shape as desired. To make additional shapes of this same type, click the icon again, or choose Insert > Shape from the menu, or use the keyboard shortcut S.

Drop-down selector for Shapes

In contrast to text and image frames, the rectangle you see around your selected shape is a bounding box. A bounding box is a printing term, and is a rectangle which delineates the horizontal and vertical boundaries of your shape, plus all of its elements. As we get to editing, you will see how this can actually be larger than the shape itself. If you change the line properties, or the fill color, these will apply to the shape, not the rectangular bounding box. See Working With FramesENDNOTE for explanations of basic frame manipulation common to all frames.

Creating a Polygon

In mathematics, a polygon can be any closed shape made up of straight lines. In Scribus, polygons are regular polygons having 3 to 999 sides, even though a polygon with 999 sides will likely be hard to differentiate from a circle, even at high magnification.

Image:Polygondialog.png

Click on the toolbar icon, select Insert > Polygon or use keyboard shortcut P to get a default polygon. The default polygon has 4 sides (even though the icon shows a pentagon) until you change its properties in the drop down dialog, activated similarly to the dialog for phapes. Click the arrow, then Properties... to bring up the polygon properties dialog shown here.

Select the number of corners (or sides if you prefer to think of it that way), and as you will see your basic polygon will have equal length sides. Rotation of the figure (-180 to 180 degrees) is adjusted with the spinbox or the slider, with a visual preview as you adjust. In addition, by checking “Apply Factor” you can cause the sides to become folded inward (concave) or outward (convex) – again, the preview shows what you are doing. As the examples show, small percentage changes will make dramatic differences.

In contrast to the changing Shape icon, the Polygon icon always will show a pentagon.

Apply Factor: -50%, -25%, 0, 10%, 25% respectively (min -100%, max 100%)

Context Menu: Shapes

Context Menu: Shape

Here is the context menu introduced in Working With Frames, brought up by right-clicking inside a shape or polygon. As you see, we have fewer choices than with text or image frames.

  • Undo will undo the last operation on the frame. Operations which cannot be undone are deleting the frame or changing the gradient
  • Redo gives you an opportunity to revert an undo, in case you change your mind.
  • Attributes. A shape may have a number of attributes which can be used for various purposes.
  • Is Locked will lock the shape in all respects – its size, position, and other features.
  • Size is Locked locks only the size of the frame.
  • Send to Scrapbook will send a copy of this item to the Scrapbook.ENDNOTE
  • Send to Layer will only be present if you have more than one layer in your document, and allows you to move the item to a different layer – you are presented with a list of choices.
  • Level. Use this to move this item toward the surface (top) of the current layer or toward its bottom.
  • Convert to allows conversion to other frame types, but there are limitations, denoted by a choice being grayed out if not possible for the current frame. Conversion of a shape to a text or image frame allows for interesting effects. In contrast, conversion of image or text frames to a polygon will lose the display of the content, but if you then convert back to its former type, its content will be available again.
  • Cut, Copy, Delete are conceptually self-explanatory.
  • Properties simply shows/hides the Properties Palette.

Shapes and Polygons: Vector Drawing

Square edited to circle, Circle edited to square.


Like special vector drawing programs, Scribus has the ability to dramatically edit both shapes and polygons, but before we get to actual editing, let's talk about how a program uses information to draw these figures. For polygons, ie. closed figures made up of straight lines, all one needs to know are the points representing the corners and then draw straight lines from one to the next, such as the square on the right. These corners in vector drawing are called nodes

Square displaying Nodes as blue dots.


On the left, the blue dots represent these nodes, which we can then move independently to change the shape of our polygon. This is the most simple way of editing shapes beyond resizing or rotating as it has been described in Working With Frames.ENDNOTE

Circles and other curved shapes add the challenge of describing and controlling the curves of various parts of the shape, so we obviously need something more than just nodes.

Circle showing Nodes in blue, Control Points in Magenta. Red squares are related to the Bounding Box.

That something is called a control point in vector drawing. In the circle on the right we see our blue nodes as before, but also magenta-colored control points. Less obvious are the blue dotted lines connecting a control point to its node. Each node in a closed figure will have two control points, affecting the line or curve on opposite sides of the node. So in our circle, imagine these control points mathematically pulling out the portion of the curve which is attached to the next node. It is important to realize that the final curve represents the interaction of four pieces of information: the two nodes at the ends, and the control points of each node which control the curve. In addition, while it may appear that our square above only had nodes, the control points are indeed there, but superimposed on the nodes, thus exerting none of this mathematical pull and a straight line results from one node to the next.

Now that you know this, you can begin to understand how we might transform a figure with straight lines and sharp corners into one with no corners and rounded contours, and vice versa.

Properties: Shape > Edit Shape

When you click “Edit Shape” in the Shape tab or double-click on a Shape/Line, you bring up this dialog. As with most dialogs and buttons in Scribus, there are tooltips for the different functions. Let's start by working our way down this dialog – we'll talk about the basic editing of nodes and control points first.

In the first row:

  • Move Nodes – allows for click and drag to move a node.
  • Move Control Points – same for control points. If a control point coincides with a node, you cannot see it. Click and drag the node and you will pull out one control point. Click and drag again and you will pull out the other.
  • Add Nodes – click along the line of the shape to add more nodes.
  • Delete Nodes – since you cannot have control points without nodes, these will disappear too.

In the second row:

  • Move Control Points Independently – Applies only when the Move control points button is active. Each individual control ooint moves without affecting its partner.
  • Move Control Points Symmetrically – Applies only when the “Move Control Points” button is active. The two control points at a given node will align themselves in a straight line passing through the node and remain equidistant from it.
  • Reset Control Points – DOESN'T SEEM TO WORK
  • Reset this Control Point - the currently selected control point resets to coincide with its node.

Image:Editshapecoords.png

Here we see some spinboxes for precisely positioning the Nodes and Control Points.

If Absolute Coordinates is checked, the numbers apply to a reference to 0,0 for the Page, otherwise 0,0 is the left upper corner of the Bounding Box. If no Node or Control Point is selected these will be inactive (gray).

To the left we see an edited, distorted, and unhappy-looking circle. The set of control points in the upper right of the shape have been moved independently, and the upper left set moved symmetrically. As you can see, moving symmetrically easily allows for more smooth curves through the node, while independent positioning allows for a sharper transition at the node.

Also demonstrated here is the bounding box principle mentioned earlier, that the bounding box defines the space required by all of the shape's elements, including in this case the control points. This is important to know if you are considering “Text Flows Around Frame” using the bounding box as the delimiter, and also if there may be a problem in case your bounding box extends beyond the document's edge, even though the shape does not.

This is also a point at which it is worth mentioning that in many cases it will be wise to edit a copy of your shape. For example, if you used a complex sequence of changing various nodes and control points, you may find it impossible to retrace back to some former state, even using Undo in the main window. As you can see there is no Undo in the Edit Shape dialog.

Edit Shape Dialog - Part 2

Let's go back now to the next two rows of buttons in our “Edit Shape” dialog, starting with the 3rd row:

  • Opens a Polygon or Cuts a Bezier Curve
  • Close this Bezier Curve
  • Flip Horizontally - self-explanatory and will not be explained further
  • Flip Vertically - self-explanatory and will not be explained further

The first two are complementary, and unless you have an open curve, the “Close..”. button will be inactive. Here we see the results of opening this circle at the top node, shifting a node upward (there are now two where there was one), then finally closing the curve. As you can see, this makes creation of a discontinuous curve easy.

Image:Bezieropenclosed.png

In case you hadn't already anticipated, you can also use the “Close this Bezier Curve” button to turn a bezier curve into a closed figure.

Close this Bezier Curve to make a closed figure.

The 4th row are all skewing operations: Left, right, up, and down. The graphic more easily shows the results than one can verbally describe. As you can see, for horizontal skewing, the top of the figure goes left or right, for vertical skewing, the right side goes up or down, but the opposite sides go in the opposite directions. Each click of the button skews a small amount – these results represent about 15 clicks each, and each beginning with the right triangle shape at far left.

Skewing, L to R: None, Left, Right, Up, Down. Before, skewing, each semi-transparent triangle started out coinciding with the underlying dark triangle.

Edit Shape Dialog - Finale

“Edit Contour Line” (not shown here, but shown above) allows you to edit the contour line of a frame, which can be used as the delimiter for text flow around a frame. Once you activate this checkbox, the editing process is identical and uses the same process that is described in this chapter for editing shapes and polygons – the contour line becomes visible and shows nodes and interconnecting lines.

The top row of this section of “Edit Shape”, “Rotate the Path Counter-Clockwise” and “Rotate the Path Clockwise” perhaps only need mention that path refers to the entire vector graphic you are editing. The spinbox to the right can be set from 0 to 180 degrees (no decimals), and represents the number of degrees the path will be moved each time you click the button.

The next two rows allow for proportionally enlarging (left button each row), or shrinking (right button each row). Like the rotation buttons, the amount of change is an incremental value indicated by the spinbox, either in percentage or number of Page units - points in this screenshot. Percentages can be 0 to 100.

Be careful with changes in page units – the value in the spinbox can be quite large, and even negative numbers can be entered. Once again, Undo may or may not be your salvation.

Fill Rules

In the Shape tab of the Properties Palette you can choose between two so-called fill rules, even-odd and non zero. Fill rules are geometrical rules, which determine how a shape is filled. While in most cases the selected fill rule won't make any notable difference for a user, some shapes require a choice as to which rule will be applied. Below you see the “donut” shape from the shape selector. The left shape uses even-odd, whereas non zero is applied to the right one – as you can see, the central area in the left shape is transparent, not filled:

Combining Polygons & Splitting Polygons

If there is any feature of vector drawing manipulation in Scribus where the adage, “Make copies of your graphics to experiment with” applies, this is it. As we will see, results can be variable. It is also safe to say that Undo is unhelpful.

The basic idea of “Combine Polygons” (also applies to shapes, or mixtures of polygons and shapes), is to take some overlapping vector drawings on different levels, and combine them into a single vector drawing. In the process, the final drawing can only have a single fill color, and a single line color, and we see an interesting effect in the areas of overlap.

Let's start with an arbitrary series of a polygon and two shapes. As you can see, the hexagon is on the bottom, then the triangle, then the arrow on top.

The operation for combining Polygons is to:

  • Select all the polygons/shapes you wish to combine
  • Click Insert > Combine Polygons from the Menu

But we can select these polygons in two different ways:

  1. Click-drag completely around the figures with the mouse.
  2. Hold down Shift, then click frames sequentially.

Here is what we get with these two methods:

Method 1: Drawing a rubberband around with the mouse to select them all, then choosing Insert > Combine Polygons.

Method 1 - Combine
Method 1 - Combine

Original - Before Combining

Method 2: Shift-clicking in this order: triangle > hexagon > arrow, then Insert > Combine Polygons.

Method 2 - Combine
Method 2 - Combine

What happened here was that in the first instance, the fill and line Colors come from the bottommost frame – the hexagon, and in the second, from the first frame clicked – the triangle. Shift-click selecting will pick the first frame for the colors used in the combined polygon.

Here is what happens with each method when we use Item > Split Polygons after each selecting/combining method. These central white areas are transparent, and will show the background behind.

Method 1 - Split
Method 1 - Split
Method 2 - Split
Method 2 - Split

Method 1: Combine, then Split

Method 2: Combine, then Split

As far as Undo, you can reasonably expect that if you undo after combining polygons, you will split them up, but the colors will stay with the single choices from the combined figure. Clicking Undo, and especially multiple undos after splitting polygons results in changes that are strange and unpredictable, with polygons moving about the page and changing size.

Personal tools