1 /* Lepton EDA library
2  * Copyright (C) 1998-2010 Ales Hvezda
3  * Copyright (C) 1998-2016 gEDA Contributors
4  * Copyright (C) 2017-2021 Lepton EDA Contributors
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 /*! \file picture_object.h
21  *
22  *  \brief Functions operating on picture drawing objects
23  */
24 
25 G_BEGIN_DECLS
26 
27 #define PICTURE_UPPER_LEFT  0
28 #define PICTURE_LOWER_RIGHT 1
29 #define PICTURE_UPPER_RIGHT 2
30 #define PICTURE_LOWER_LEFT  3
31 
32 LeptonObject*
33 lepton_picture_object_new (const gchar *file_content,
34                            gsize file_length,
35                            const gchar *filename,
36                            int x1,
37                            int y1,
38                            int x2,
39                            int y2,
40                            int angle,
41                            int mirrored,
42                            int embedded) G_GNUC_WARN_UNUSED_RESULT;
43 void
44 lepton_picture_object_calculate_bounds (const LeptonObject *object,
45                                         LeptonBounds *bounds);
46 double
47 lepton_picture_object_get_real_ratio (LeptonObject *object);
48 
49 double
50 lepton_picture_object_get_ratio (const LeptonObject *object);
51 
52 void
53 lepton_picture_object_set_ratio (LeptonObject *object,
54                                  double ratio);
55 void
56 lepton_picture_object_modify (LeptonObject *object,
57                               int x,
58                               int y,
59                               int whichone);
60 void
61 lepton_picture_object_rotate (int world_centerx,
62                               int world_centery,
63                               int angle,
64                               LeptonObject *object);
65 void
66 lepton_picture_object_mirror (int world_centerx,
67                               int world_centery,
68                               LeptonObject *object);
69 void
70 lepton_picture_object_translate (LeptonObject *object,
71                                  int dx,
72                                  int dy);
73 LeptonObject*
74 lepton_picture_object_copy (LeptonObject *o_current) G_GNUC_WARN_UNUSED_RESULT;
75 
76 gboolean
77 lepton_picture_object_get_embedded (const LeptonObject *object);
78 
79 void
80 lepton_picture_object_set_embedded (LeptonObject *object,
81                                     gboolean embedded);
82 GdkPixbuf*
83 lepton_picture_object_get_pixbuf (LeptonObject *object) G_GNUC_WARN_UNUSED_RESULT;
84 
85 gboolean
86 lepton_picture_object_set_from_buffer (LeptonObject *object,
87                                        const gchar *filename,
88                                        const gchar *data,
89                                        size_t len,
90                                        GError **error);
91 gboolean
92 lepton_picture_object_set_from_file (LeptonObject *object,
93                                      const gchar *filename,
94                                      GError **error);
95 const gchar*
96 lepton_picture_object_get_filename (const LeptonObject *object);
97 
98 LeptonObject*
99 lepton_picture_object_read (const char *first_line,
100                             TextBuffer *tb,
101                             unsigned int release_ver,
102                             unsigned int fileformat_ver,
103                             GError **err);
104 gchar*
105 lepton_picture_object_to_buffer (const LeptonObject *object);
106 
107 double
108 lepton_picture_object_shortest_distance (LeptonObject *object,
109                                          int x,
110                                          int y,
111                                          int force_soild,
112                                          gboolean include_hidden);
113 gboolean
114 lepton_picture_object_get_position (const LeptonObject *object,
115                                     gint *x,
116                                     gint *y);
117 void
118 lepton_picture_object_embed (LeptonObject *object);
119 
120 void
121 lepton_picture_object_unembed (LeptonObject *object);
122 
123 int
124 lepton_picture_object_get_upper_x (const LeptonObject *object);
125 
126 void
127 lepton_picture_object_set_upper_x (LeptonObject *object,
128                                    int x);
129 int
130 lepton_picture_object_get_lower_x (const LeptonObject *object);
131 
132 void
133 lepton_picture_object_set_lower_x (LeptonObject *object,
134                                    int x);
135 int
136 lepton_picture_object_get_upper_y (const LeptonObject *object);
137 
138 void
139 lepton_picture_object_set_upper_y (LeptonObject *object,
140                                    int y);
141 int
142 lepton_picture_object_get_lower_y (const LeptonObject *object);
143 
144 void
145 lepton_picture_object_set_lower_y (LeptonObject *object,
146                                    int y);
147 int
148 lepton_picture_object_get_angle (const LeptonObject *object);
149 
150 void
151 lepton_picture_object_set_angle (LeptonObject *object,
152                                  int angle);
153 gboolean
154 lepton_picture_object_get_mirrored (const LeptonObject *object);
155 
156 void
157 lepton_picture_object_set_mirrored (LeptonObject *object,
158                                     gboolean mirrored);
159 
160 G_END_DECLS
161