aboutsummaryrefslogtreecommitdiff
path: root/pix_preview/pix_preview.h
blob: 0124bf4e953d255d289b821a6deb4bbba8724928 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*-----------------------------------------------------------------
LOG
GEM - Graphics Environment for Multimedia

Get pixel information
	
Copyright (c) 1997-1998 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
Copyright (c) 2002 James Tittle & Chris Clepper
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
	 
-----------------------------------------------------------------*/

/*-----------------------------------------------------------------
pix_preview

  0409:forum::für::umläute:2000
  IOhannes m zmoelnig
  mailto:zmoelnig@iem.kug.ac.at
-----------------------------------------------------------------*/

#ifndef INCLUDE_PIX_DUMP_H_
#define INCLUDE_PIX_DUMP_H_

#include "Base/GemPixObj.h"

/*needed for base64 conversion*/
#include <string>

std::string base64_encode(unsigned char const* , unsigned int len);






/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS

 pix_preview
 
  Get pixel information
  
   KEYWORDS
   pix
   
	DESCRIPTION
	
	 dumps the pix-data as a float-package
	 
-----------------------------------------------------------------*/
class GEM_EXTERN pix_preview : public GemPixObj
{
	CPPEXTERN_HEADER(pix_preview, GemPixObj)
		
public:
	
	//////////
	// Constructor
	pix_preview(t_floatarg fx, t_floatarg fy);
	int x_width, x_height;
	
protected:
	
	//////////
	// Destructor
	virtual ~pix_preview();
	
	//////////
	// All we want is the pixel information, so this is a complete override.
	virtual void 	processImage(imageStruct &image);
	
	//////////
	virtual void 	processYUVImage(imageStruct &image);
	
	//////////
	void			trigger();

	//////////
	// The color outlet
	t_outlet    	*m_dataOut;
	
	//////////
	// the buffer
	int           xsize, ysize;      // proposed x/y-sizes
	int           m_xsize,  m_ysize;
	int           m_csize;
	t_atom       *m_buffer;
	int           m_bufsize;
	
	int           oldimagex;
	int           oldimagey;
	
	//////////
	// navigation
	float         m_xstep;
	float         m_ystep;
	
	/////////
	// pointer to the image data
	unsigned char *m_data;
	
	/////////
	// LLUO :: widget tk list pointer
    	t_glist *m_glist;
	
	t_widgetbehavior   image_widgetbehavior;

	static void image_drawme(pix_preview *x, t_glist *glist, int firsttime);

	static void image_erase(pix_preview* x,t_glist* glist);
	

/* ------------------------ image widgetbehaviour----------------------------- */


	static void image_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2);

	static void image_displace(t_gobj *z, t_glist *glist, int dx, int dy);

	static void image_select(t_gobj *z, t_glist *glist, int state);

	static void image_activate(t_gobj *z, t_glist *glist, int state);

	static void image_delete(t_gobj *z, t_glist *glist);
       
	static void image_vis(t_gobj *z, t_glist *glist, int vis);


private:
	
	//////////
	// Static member callbacks
	static void		triggerMessCallback(void *dump);
	static void		GREYMessCallback(void *dump);
	static void		RGBAMessCallback(void *dump);
	static void		RGBMessCallback(void *dump);

};

#endif	// for header file