* atk-bridge/bridge.c:
[platform/core/uifw/at-spi2-atk.git] / util / mag_image.h
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001 Sun Microsystems Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __MAGNIFIER_SPI_IMAGE_H__
24 #define __MAGNIFIER_SPI_IMAGE_H__
25 #include <stdio.h>
26 #include <unistd.h>
27 #include <sys/types.h>
28 #include <sys/socket.h>
29 #include <sys/un.h>
30 #include <errno.h>
31 #include <unistd.h>
32 #include <gtk/gtk.h>
33 #include <glib.h>
34 #include <stdlib.h>
35 #include <X11/Xlib.h>
36 #include <gdk-pixbuf/gdk-pixbuf.h>
37 #include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
38 #include <gdk/gdkx.h>
39
40 typedef struct _point {
41   int x;
42   int y;
43 } point;
44
45 typedef struct xlib_colormap_struct xlib_colormap;
46
47 struct xlib_colormap_struct {
48         int size;
49         XColor *colors;
50         Visual *visual;
51         Colormap colormap;
52 };
53
54 typedef struct {
55         GdkRectangle extents;
56         GdkRectangle roi;
57         float zoom_x;
58         float zoom_y;
59         int contrast;
60         gboolean is_managed;
61         gboolean is_dirty;
62 } ZoomRegionData;
63
64 point       center_position;
65 point       curpos; /* Position of the magnified cursor */
66 GdkPixbuf*  image;
67 GdkPixbuf*  scaled_image;
68 Window      spi_image_root_window;
69 int         screen_num;
70 int         old_factor_x;
71 int         old_factor_y;
72 xlib_colormap * x_cmap;
73
74 typedef struct _MagnifierData {
75         int mag_width;
76         int mag_height;
77         int mag_x;
78         int mag_y;
79         int factor_x;
80         int factor_y;
81         point center;
82         int follow_mouse;
83         int color_inverted;
84         int fast_rgb_convert;
85         int contrast;
86         GtkWidget *output_window;
87         void *source_display;
88         void *target_display;
89         GList *zoom_regions;
90 } MagnifierData;
91
92 #define FACTOR          1
93 #define CONTRAST        2
94 #define FOLLOW_MOUSE    3
95 #define COLOR_INVERTED  4
96 #define GOTO            5
97 #define STOP            6
98 #define SET_ROI         7
99 #define SET_EXTENTS     8
100
101 struct sockaddr_un mag_server;
102 struct sockaddr_un client_sockaddr;
103 int size_client;
104 int desc;
105 GtkWidget *drawing_area;
106
107 void parse_message(char *msg, MagnifierData *data);
108 void update_image(MagnifierData *data);
109 void expose_event(GtkWidget * w, GdkEventExpose *event, gpointer data);
110 void get_root_image(Window src,GdkPixbuf *dest,int src_x, int src_y, MagnifierData *data);
111 int display_image(gpointer data);
112
113 #endif
114