|
libgeda
|
functions for the picture object More...
#include <config.h>#include <stdio.h>#include <math.h>#include <gdk-pixbuf/gdk-pixbuf.h>#include <gio/gio.h>#include "libgeda_priv.h"
Go to the source code of this file.
Functions | |
| OBJECT * | o_picture_read (TOPLEVEL *toplevel, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver, GError **err) |
| Create picture OBJECT from character string. | |
| char * | o_picture_save (TOPLEVEL *toplevel, OBJECT *object) |
| Create a character string representation of a picture OBJECT. | |
| OBJECT * | o_picture_new (TOPLEVEL *toplevel, const gchar *file_content, gsize file_length, const gchar *filename, char type, int x1, int y1, int x2, int y2, int angle, int mirrored, int embedded) |
| Create a picture object. | |
| void | o_picture_recalc (TOPLEVEL *toplevel, OBJECT *o_current) |
| Recalculate picture bounding box. | |
| void | world_get_picture_bounds (TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom) |
| Get picture bounding rectangle in WORLD coordinates. | |
| gboolean | o_picture_get_position (TOPLEVEL *toplevel, gint *x, gint *y, OBJECT *object) |
| get the position of the left bottom point | |
| double | o_picture_get_ratio (TOPLEVEL *toplevel, OBJECT *object) |
| Get the width/height ratio of an image. | |
| void | o_picture_modify (TOPLEVEL *toplevel, OBJECT *object, int x, int y, int whichone) |
| Modify the description of a picture OBJECT. | |
| void | o_picture_modify_all (TOPLEVEL *toplevel, OBJECT *object, int x1, int y1, int x2, int y2) |
| Modify a picture object's coordinates. | |
| void | o_picture_rotate_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object) |
| Rotate picture OBJECT using WORLD coordinates. | |
| void | o_picture_mirror_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object) |
| Mirror a picture using WORLD coordinates. | |
| void | o_picture_translate_world (TOPLEVEL *toplevel, int dx, int dy, OBJECT *object) |
| Translate a picture position in WORLD coordinates by a delta. | |
| OBJECT * | o_picture_copy (TOPLEVEL *toplevel, OBJECT *object) |
| Create a copy of a picture. | |
| static guint8 * | o_picture_rgb_data (GdkPixbuf *image) |
| Get RGB data from image. | |
| static guint8 * | o_picture_mask_data (GdkPixbuf *image) |
| Get mask data from image. | |
| void | o_picture_print (TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y) |
| Print picture to Postscript document. | |
| void | o_picture_embed (TOPLEVEL *toplevel, OBJECT *object) |
| Embed the image file associated with a picture. | |
| void | o_picture_unembed (TOPLEVEL *toplevel, OBJECT *object) |
| Unembed a picture, reloading the image from disk. | |
| double | o_picture_shortest_distance (OBJECT *object, int x, int y, int force_solid) |
| Calculates the distance between the given point and the closest point in the picture. | |
| gboolean | o_picture_is_embedded (TOPLEVEL *toplevel, OBJECT *object) |
| Test whether a picture object is embedded. | |
| GdkPixbuf * | o_picture_get_pixbuf (TOPLEVEL *toplevel, OBJECT *object) |
| Get a pixel buffer for a picture object. | |
| const char * | o_picture_get_data (TOPLEVEL *toplevel, OBJECT *object, size_t *len) |
| Get the raw image data from a picture object. | |
| gboolean | o_picture_set_from_buffer (TOPLEVEL *toplevel, OBJECT *object, const gchar *filename, const gchar *data, size_t len, GError **error) |
| Set a picture object's contents from a buffer. | |
| gboolean | o_picture_set_from_file (TOPLEVEL *toplevel, OBJECT *object, const gchar *filename, GError **error) |
| Set a picture object's contents from a file. | |
| const gchar * | o_picture_get_filename (TOPLEVEL *toplevel, OBJECT *object) |
| Get a picture's corresponding filename. | |
| GdkPixbuf * | o_picture_get_fallback_pixbuf (TOPLEVEL *toplevel) |
| Get fallback pixbuf for displaying pictures. | |
Definition in file o_picture.c.
| OBJECT* o_picture_read | ( | TOPLEVEL * | toplevel, |
| const char * | first_line, | ||
| TextBuffer * | tb, | ||
| unsigned int | release_ver, | ||
| unsigned int | fileformat_ver, | ||
| GError ** | err | ||
| ) |
| [in] | toplevel | The TOPLEVEL object. |
| [in] | first_line | Character string with picture description. |
| [in] | tb | Text buffer to load embedded data from. |
| [in] | release_ver | libgeda release version number. |
| [in] | fileformat_ver | libgeda file format version number. |
Definition at line 50 of file o_picture.c.

| [in] | toplevel | a TOPLEVEL structure |
| [in] | object | Picture OBJECT to create string from. |
Definition at line 180 of file o_picture.c.

| OBJECT* o_picture_new | ( | TOPLEVEL * | toplevel, |
| const gchar * | file_content, | ||
| gsize | file_length, | ||
| const gchar * | filename, | ||
| char | type, | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| int | angle, | ||
| int | mirrored, | ||
| int | embedded | ||
| ) |
The picture is described by its upper left corner (x1, y1) and its lower right corner (x2, ). The type parameter must be equal to OBJ_PICTURE.
If file_content is non-NULL, it must be a pointer to a buffer containing raw image data. If loading data from file_content is unsuccessful, and filename is non-NULL, an image will attempt to be loaded from filename. Otherwise, the picture object will be initially empty.
| [in] | toplevel | The TOPLEVEL object. |
| [in] | file_content | Raw data of the image file, or NULL. |
| [in] | file_length | Length of raw data buffer |
| [in] | filename | File name backing this picture, or NULL. |
| [in] | type | Must be OBJ_PICTURE. |
| [in] | x1 | Upper x coordinate. |
| [in] | y1 | Upper y coordinate. |
| [in] | x2 | Lower x coordinate. |
| [in] | y2 | Lower y coordinate. |
| [in] | angle | Picture rotation angle. |
| [in] | mirrored | Whether the image should be mirrored or not. |
| [in] | embedded | Whether the embedded flag should be set or not. |
Definition at line 273 of file o_picture.c.

| [in] | toplevel | The TOPLEVEL object. |
| [in,out] | o_current | Picture OBJECT to be recalculated. |
Definition at line 341 of file o_picture.c.

| void world_get_picture_bounds | ( | TOPLEVEL * | toplevel, |
| OBJECT * | object, | ||
| int * | left, | ||
| int * | top, | ||
| int * | right, | ||
| int * | bottom | ||
| ) |
| [in] | toplevel | The TOPLEVEL object. |
| [in] | object | Picture OBJECT to read coordinates from. |
| [out] | left | Left picture coordinate in WORLD units. |
| [out] | top | Top picture coordinate in WORLD units. |
| [out] | right | Right picture coordinate in WORLD units. |
| [out] | bottom | Bottom picture coordinate in WORLD units. |
Definition at line 372 of file o_picture.c.
| [in] | toplevel | The toplevel environment. |
| [out] | x | pointer to the x-position |
| [out] | y | pointer to the y-position |
| [in] | object | The object to get the position. |
Definition at line 392 of file o_picture.c.
Returns the width/height ratio of picture object, taking the image rotation into account.
Definition at line 412 of file o_picture.c.
The coordinates of the corner is modified in the world coordinate system. Screen coordinates and boundings are then updated.
| [in] | toplevel | The TOPLEVEL object. |
| [in,out] | object | Picture OBJECT to modify. |
| [in] | x | New x coordinate. |
| [in] | y | New y coordinate. |
| [in] | whichone | Which picture parameter to modify. |
whichone can have the following values:
Definition at line 456 of file o_picture.c.

| [in] | toplevel | current TOPLEVEL. |
| [in,out] | object | picture OBJECT to be modified. |
| [in] | x1 | x coordinate of first corner of box. |
| [in] | y1 | y coordinate of first corner of box. |
| [in] | x2 | x coordinate of second corner of box. |
| [in] | y2 | y coordinate of second corner of box. |
Definition at line 539 of file o_picture.c.

| void o_picture_rotate_world | ( | TOPLEVEL * | toplevel, |
| int | world_centerx, | ||
| int | world_centery, | ||
| int | angle, | ||
| OBJECT * | object | ||
| ) |
| [in] | toplevel | The TOPLEVEL object. |
| [in] | world_centerx | Rotation center x coordinate in WORLD units. |
| [in] | world_centery | Rotation center y coordinate in WORLD units. |
| [in] | angle | Rotation angle in degrees (See note below). |
| [in,out] | object | Picture OBJECT to rotate. |
Definition at line 570 of file o_picture.c.

| void o_picture_mirror_world | ( | TOPLEVEL * | toplevel, |
| int | world_centerx, | ||
| int | world_centery, | ||
| OBJECT * | object | ||
| ) |
The picture is first translated to the origin, then mirrored and finally translated back at its previous position.
| [in] | toplevel | The TOPLEVEL object. |
| [in] | world_centerx | Origin x coordinate in WORLD units. |
| [in] | world_centery | Origin y coordinate in WORLD units. |
| [in,out] | object | Picture OBJECT to mirror. |
Definition at line 634 of file o_picture.c.

| [in] | toplevel | The TOPLEVEL object. |
| [in] | dx | x distance to move. |
| [in] | dy | y distance to move. |
| [in,out] | object | Picture OBJECT to translate. |
Definition at line 692 of file o_picture.c.

| [in] | toplevel | The TOPLEVEL object. |
| [in] | object | Picture OBJECT to copy. |
Definition at line 714 of file o_picture.c.

| static guint8* o_picture_rgb_data | ( | GdkPixbuf * | image | ) | [static] |
| [in] | image | GdkPixbuf image to read RGB data from. |
Definition at line 771 of file o_picture.c.
| static guint8* o_picture_mask_data | ( | GdkPixbuf * | image | ) | [static] |
| [in] | image | GdkPixbuf image to get mask data from. |
Definition at line 811 of file o_picture.c.
| void o_picture_print | ( | TOPLEVEL * | toplevel, |
| FILE * | fp, | ||
| OBJECT * | o_current, | ||
| int | origin_x, | ||
| int | origin_y | ||
| ) |
If the picture object was unable to be loaded, prints a crossed box of the same dimensions.
The Postscript document is defined by the file pointer fp. Function based on the DIA source code (http://www.gnome.org/projects/dia) and licensed under the GNU GPL version 2.
All dimensions are in mils.
| [in] | toplevel | The TOPLEVEL object. |
| [in] | fp | FILE pointer to Postscript document. |
| [in] | o_current | Picture OBJECT to write to document. |
| [in] | origin_x | Page x coordinate to place picture OBJECT. |
| [in] | origin_y | Page y coordinate to place picture OBJECT. |
Definition at line 856 of file o_picture.c.

| [in] | toplevel | The TOPLEVEL object. |
| [in] | object | The picture OBJECT to embed |
Definition at line 949 of file o_picture.c.

| [in] | toplevel | The TOPLEVEL object. |
| [in] | object | The picture OBJECT to unembed |
Definition at line 979 of file o_picture.c.

| double o_picture_shortest_distance | ( | OBJECT * | object, |
| int | x, | ||
| int | y, | ||
| int | force_solid | ||
| ) |
Interrior points within the picture return a distance of zero.
| [in] | object | The picture OBJECT. |
| [in] | x | The x coordinate of the given point. |
| [in] | y | The y coordinate of the given point. |
| [in] | force_solid | If true, force treating the object as solid. |
Definition at line 1016 of file o_picture.c.
Definition at line 1049 of file o_picture.c.
The returned value should have its reference count decremented with g_object_unref() when no longer needed.
Definition at line 1070 of file o_picture.c.
| toplevel | The current TOPLEVEL. |
| object | The picture OBJECT to inspect. |
| len | Location to store buffer length. |
Definition at line 1093 of file o_picture.c.
| gboolean o_picture_set_from_buffer | ( | TOPLEVEL * | toplevel, |
| OBJECT * | object, | ||
| const gchar * | filename, | ||
| const gchar * | data, | ||
| size_t | len, | ||
| GError ** | error | ||
| ) |
| toplevel | The current TOPLEVEL. |
| object | The picture OBJECT to modify. |
| filename | The new filename for the picture. |
| data | The new image data buffer. |
| len | The size of the data buffer. |
| error | Location to return error information. |
Definition at line 1117 of file o_picture.c.

| gboolean o_picture_set_from_file | ( | TOPLEVEL * | toplevel, |
| OBJECT * | object, | ||
| const gchar * | filename, | ||
| GError ** | error | ||
| ) |
| toplevel | The current TOPLEVEL. |
| object | The picture OBJECT to modify. |
| filename | The filename to load image data from. |
| error | Location to return error information. |
Definition at line 1176 of file o_picture.c.

Definition at line 1205 of file o_picture.c.
| GdkPixbuf* o_picture_get_fallback_pixbuf | ( | TOPLEVEL * | toplevel | ) |
Definition at line 1222 of file o_picture.c.