Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-star.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_SP_STAR_H
3#define SEEN_SP_STAR_H
4
5/*
6 * <sodipodi:star> implementation
7 *
8 * Authors:
9 * Mitsuru Oka <oka326@parkcity.ne.jp>
10 * Lauris Kaplinski <lauris@kaplinski.com>
11 *
12 * Copyright (C) 1999-2002 Lauris Kaplinski
13 * Copyright (C) 2000-2001 Ximian, Inc.
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17
18#include "sp-polygon.h"
19
24
25class SPStar final : public SPShape {
26public:
27 SPStar();
28 ~SPStar() override;
29 int tag() const override { return tag_of<decltype(*this)>; }
30
31 int sides;
32
34 double r[2];
35 double arg[2];
37
38 double rounded;
39 double randomized;
40
42 Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override;
43 void set(SPAttr key, char const* value) override;
44 void update(SPCtx* ctx, unsigned int flags) override;
45
46 const char* typeName() const override;
47 const char* displayName() const override;
48 char* description() const override;
49 void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const override;
50 void update_patheffect(bool write) override;
51 void set_shape() override;
52 Geom::Affine set_transform(Geom::Affine const& xform) override;
53 double getSideLength() const;
54 void setSideLength(double length);
55};
56
57void sp_star_position_set (SPStar *star, int sides, Geom::Point center, double r1, double r2, double arg1, double arg2, bool isflat, double rounded, double randomized);
58
59Geom::Point sp_star_get_xy (SPStar const *star, SPStarPoint point, int index, bool randomized = false);
60
61#endif
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
3x3 matrix representing an affine transformation.
Definition affine.h:70
Two-dimensional point that doubles as a vector.
Definition point.h:66
Storing of snapping preferences.
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:101
Inkscape::XML::Node * repr
Definition sp-object.h:193
SPDocument * document
Definition sp-object.h:188
Base class for shapes, including <path> element.
Definition sp-shape.h:38
void update(SPCtx *ctx, unsigned int flags) override
Definition sp-star.cpp:216
int tag() const override
Definition sp-star.h:29
Geom::Point center
Definition sp-star.h:33
double rounded
Definition sp-star.h:38
char * description() const override
Definition sp-star.cpp:240
const char * typeName() const override
The item's type name, not node tag name.
Definition sp-star.cpp:228
void set_shape() override
Definition sp-star.cpp:357
void snappoints(std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs) const override
Definition sp-star.cpp:455
const char * displayName() const override
The item's type name as a translated human string.
Definition sp-star.cpp:234
void update_patheffect(bool write) override
Definition sp-star.cpp:521
double r[2]
Definition sp-star.h:34
bool flatsided
Definition sp-star.h:36
~SPStar() override
Geom::Affine set_transform(Geom::Affine const &xform) override
Definition sp-star.cpp:470
double arg[2]
Definition sp-star.h:35
void build(SPDocument *document, Inkscape::XML::Node *repr) override
Definition sp-star.cpp:50
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
Definition sp-star.cpp:66
double randomized
Definition sp-star.h:39
int sides
Definition sp-star.h:31
double getSideLength() const
Calculate the average side length of the polygon.
Definition sp-star.cpp:533
void setSideLength(double length)
Set the average side length of the polygon.
Definition sp-star.cpp:571
SPStar()
Definition sp-star.cpp:36
static cairo_user_data_key_t key
void sp_star_position_set(SPStar *star, int sides, Geom::Point center, double r1, double r2, double arg1, double arg2, bool isflat, double rounded, double randomized)
Geom::Point sp_star_get_xy(SPStar const *star, SPStarPoint point, int index, bool randomized=false)
SPStarPoint
Definition sp-star.h:20
@ SP_STAR_POINT_KNOT2
Definition sp-star.h:22
@ SP_STAR_POINT_KNOT1
Definition sp-star.h:21
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94
int index