File: cmpack_image_data.h

package info (click to toggle)
c-munipack 2.1.39-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,888 kB
  • sloc: ansic: 200,762; cpp: 106,129; lex: 9,035; yacc: 4,916; sh: 4,074; fortran: 2,613; xml: 2,105; python: 1,182; makefile: 546; perl: 104
file content (79 lines) | stat: -rw-r--r-- 2,938 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**************************************************************

cmpack_graph_view.h (C-Munipack project)
Widget which can draw a XY graph (derived from GtkWidget)
Copyright (C) 2011 David Motl, dmotl@volny.cz

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

$Id: cmpack_image_data.h,v 1.2 2016/04/24 12:24:07 dmotl Exp $

**************************************************************/

#ifndef CMPACK_IMAGE_DATA_H
#define CMPACK_IMAGE_DATA_H

#include <gtk/gtk.h>

#include "cmpack_widgdefs.h"

G_BEGIN_DECLS

typedef struct {
	GObject			parent;

	/* Private data */ 
	cairo_surface_t	*data;
} CmpackImageData;

typedef struct {
	GObjectClass parent_class;

	/* Signals */
	void (*data_changed)(CmpackImageData *model);
	void (*size_changed)(CmpackImageData *model);
} CmpackImageDataClass;

#define CMPACK_TYPE_IMAGE_DATA            (cmpack_image_data_get_type ())
#define CMPACK_IMAGE_DATA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CMPACK_TYPE_IMAGE_DATA, CmpackImageData))
#define CMPACK_IMAGE_DATA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CMPACK_TYPE_IMAGE_DATA, CmpackImageDataClass))
#define CMPACK_IS_IMAGE_DATA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CMPACK_TYPE_IMAGE_DATA))
#define CMPACK_IS_IMAGE_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CMPACK_TYPE_IMAGE_DATA))
#define CMPACK_IMAGE_DATA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CMPACK_TYPE_IMAGE_DATA, CmpackImageDataClass)) 

GType cmpack_image_data_get_type(void) G_GNUC_CONST;

/* Create new empty image data */
CmpackImageData *cmpack_image_data_new(cairo_format_t format, gint width, gint height);

/* Call this function when you have finished updating the data*/
void cmpack_image_data_changed(CmpackImageData *data);

/* Get image width in pixels */
gint cmpack_image_data_width(CmpackImageData *data);

/* Get image height in pixels */
gint cmpack_image_data_height(CmpackImageData *data);

/* Get pointer to cairo surface */
cairo_surface_t *cmpack_image_data_get_surface(CmpackImageData *data);

/* Export image into a file */
gboolean cmpack_image_data_write_to_file(CmpackImageData *data,
	const gchar *filepath, const gchar *format, gint width, gint height, gint jpeg_quality);

G_END_DECLS

#endif