00001
00002
00003 #ifndef _CLUTTERMM_TEXTURE_H
00004 #define _CLUTTERMM_TEXTURE_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <cluttermm/actor.h>
00027 #include <cluttermm/types.h>
00028 #include <clutter/clutter-texture.h>
00029
00030
00031 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00032 typedef struct _ClutterTexture ClutterTexture;
00033 typedef struct _ClutterTextureClass ClutterTextureClass;
00034 #endif
00035
00036
00037 namespace Clutter
00038 { class Texture_Class; }
00039 namespace Clutter
00040 {
00041
00055 enum TextureFlags
00056 {
00057 TEXTURE_RGB_FLAG_BGR = 1 << 1,
00058 TEXTURE_RGB_FLAG_PREMULT = 1 << 2,
00059 TEXTURE_YUV_FLAG_YUV2 = 1 << 3
00060 };
00061
00063 inline TextureFlags operator|(TextureFlags lhs, TextureFlags rhs)
00064 { return static_cast<TextureFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00065
00067 inline TextureFlags operator&(TextureFlags lhs, TextureFlags rhs)
00068 { return static_cast<TextureFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00069
00071 inline TextureFlags operator^(TextureFlags lhs, TextureFlags rhs)
00072 { return static_cast<TextureFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00073
00075 inline TextureFlags operator~(TextureFlags flags)
00076 { return static_cast<TextureFlags>(~static_cast<unsigned>(flags)); }
00077
00079 inline TextureFlags& operator|=(TextureFlags& lhs, TextureFlags rhs)
00080 { return (lhs = static_cast<TextureFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00081
00083 inline TextureFlags& operator&=(TextureFlags& lhs, TextureFlags rhs)
00084 { return (lhs = static_cast<TextureFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00085
00087 inline TextureFlags& operator^=(TextureFlags& lhs, TextureFlags rhs)
00088 { return (lhs = static_cast<TextureFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00089
00090
00094 enum TextureQuality
00095 {
00096 TEXTURE_QUALITY_LOW,
00097 TEXTURE_QUALITY_MEDIUM,
00098 TEXTURE_QUALITY_HIGH
00099 };
00100
00101
00104 class TextureError : public Glib::Error
00105 {
00106 public:
00107 enum Code
00108 {
00109 OUT_OF_MEMORY,
00110 NO_YUV,
00111 BAD_FORMAT
00112 };
00113
00114 TextureError(Code error_code, const Glib::ustring& error_message);
00115 explicit TextureError(GError* gobject);
00116 Code code() const;
00117
00118 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00119 private:
00120
00121 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00122 static void throw_func(GError* gobject);
00123 #else
00124
00125 static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
00126 #endif //GLIBMM_EXCEPTIONS_ENABLED
00127
00128 friend void wrap_init();
00129 #endif
00130 };
00131
00132 }
00133
00134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00135 namespace Glib
00136 {
00137
00138 template <>
00139 class Value<Clutter::TextureError::Code> : public Glib::Value_Enum<Clutter::TextureError::Code>
00140 {
00141 public:
00142 static GType value_type() G_GNUC_CONST;
00143 };
00144
00145 }
00146 #endif
00147
00148
00149 namespace Clutter
00150 {
00151
00152
00153 class Texture :
00154 public Actor
00155 {
00156
00157 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00158
00159 public:
00160 typedef Texture CppObjectType;
00161 typedef Texture_Class CppClassType;
00162 typedef ClutterTexture BaseObjectType;
00163 typedef ClutterTextureClass BaseClassType;
00164
00165 private: friend class Texture_Class;
00166 static CppClassType texture_class_;
00167
00168 private:
00169
00170 Texture(const Texture&);
00171 Texture& operator=(const Texture&);
00172
00173 protected:
00174 explicit Texture(const Glib::ConstructParams& construct_params);
00175 explicit Texture(ClutterTexture* castitem);
00176
00177 #endif
00178
00179 public:
00180 virtual ~Texture();
00181
00182 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00183 static GType get_type() G_GNUC_CONST;
00184 static GType get_base_type() G_GNUC_CONST;
00185 #endif
00186
00188 ClutterTexture* gobj() { return reinterpret_cast<ClutterTexture*>(gobject_); }
00189
00191 const ClutterTexture* gobj() const { return reinterpret_cast<ClutterTexture*>(gobject_); }
00192
00194 ClutterTexture* gobj_copy();
00195
00196 private:
00197
00198
00199 protected:
00200 Texture();
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 public:
00212
00213
00214 static Glib::RefPtr<Texture> create();
00215
00216
00217
00218
00219
00227 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00228 bool set_from_file(const Glib::ustring& filename);
00229 #else
00230 bool set_from_file(const Glib::ustring& filename, std::auto_ptr<Glib::Error>& error);
00231 #endif //GLIBMM_EXCEPTIONS_ENABLED
00232
00233
00248 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00249 bool set_from_rgb_data(const guchar* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags);
00250 #else
00251 bool set_from_rgb_data(const guchar* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags, std::auto_ptr<Glib::Error>& error);
00252 #endif //GLIBMM_EXCEPTIONS_ENABLED
00253
00254
00267 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00268 bool set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags);
00269 #else
00270 bool set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags, std::auto_ptr<Glib::Error>& error);
00271 #endif //GLIBMM_EXCEPTIONS_ENABLED
00272
00273
00288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00289 bool set_area_from_rgb_data(const guchar* data, bool has_alpha, int x, int y, int width, int height, int rowstride, int bpp, TextureFlags flags);
00290 #else
00291 bool set_area_from_rgb_data(const guchar* data, bool has_alpha, int x, int y, int width, int height, int rowstride, int bpp, TextureFlags flags, std::auto_ptr<Glib::Error>& error);
00292 #endif //GLIBMM_EXCEPTIONS_ENABLED
00293
00294
00299 void get_base_size(gint& width, gint& height) const;
00300
00301
00307 TextureQuality get_filter_quality() const;
00308
00321 void set_filter_quality(TextureQuality filter_quality);
00322
00330 int get_amx_tile_waste() const;
00331
00343 void set_max_tile_waste(int max_tile_waste);
00344
00345
00346
00350 CoglHandle get_cogl_texture() const;
00351
00359 void set_cogl_texture(CoglHandle handle);
00360
00361
00367 Glib::SignalProxy2< void,gint,gint > signal_size_change();
00368
00369
00375 Glib::SignalProxy0< void > signal_pixbuf_change();
00376
00377
00378 #ifdef GLIBMM_PROPERTIES_ENABLED
00379
00385 Glib::PropertyProxy<CoglHandle> property_cogl_texture() ;
00386 #endif //#GLIBMM_PROPERTIES_ENABLED
00387
00388 #ifdef GLIBMM_PROPERTIES_ENABLED
00389
00395 Glib::PropertyProxy_ReadOnly<CoglHandle> property_cogl_texture() const;
00396 #endif //#GLIBMM_PROPERTIES_ENABLED
00397
00398 #ifdef GLIBMM_PROPERTIES_ENABLED
00399
00405 Glib::PropertyProxy_ReadOnly<bool> property_disable_slicing() const;
00406 #endif //#GLIBMM_PROPERTIES_ENABLED
00407
00408
00409 #ifdef GLIBMM_PROPERTIES_ENABLED
00410
00416 Glib::PropertyProxy_WriteOnly<Glib::ustring> property_filename() ;
00417 #endif //#GLIBMM_PROPERTIES_ENABLED
00418
00419
00420 #ifdef GLIBMM_PROPERTIES_ENABLED
00421
00427 Glib::PropertyProxy<TextureQuality> property_filter_quality() ;
00428 #endif //#GLIBMM_PROPERTIES_ENABLED
00429
00430 #ifdef GLIBMM_PROPERTIES_ENABLED
00431
00437 Glib::PropertyProxy_ReadOnly<TextureQuality> property_filter_quality() const;
00438 #endif //#GLIBMM_PROPERTIES_ENABLED
00439
00440 #ifdef GLIBMM_PROPERTIES_ENABLED
00441
00447 Glib::PropertyProxy_ReadOnly<int> property_pixel_format() const;
00448 #endif //#GLIBMM_PROPERTIES_ENABLED
00449
00450
00451 #ifdef GLIBMM_PROPERTIES_ENABLED
00452
00458 Glib::PropertyProxy<bool> property_repeat_x() ;
00459 #endif //#GLIBMM_PROPERTIES_ENABLED
00460
00461 #ifdef GLIBMM_PROPERTIES_ENABLED
00462
00468 Glib::PropertyProxy_ReadOnly<bool> property_repeat_x() const;
00469 #endif //#GLIBMM_PROPERTIES_ENABLED
00470
00471 #ifdef GLIBMM_PROPERTIES_ENABLED
00472
00478 Glib::PropertyProxy<bool> property_repeat_y() ;
00479 #endif //#GLIBMM_PROPERTIES_ENABLED
00480
00481 #ifdef GLIBMM_PROPERTIES_ENABLED
00482
00488 Glib::PropertyProxy_ReadOnly<bool> property_repeat_y() const;
00489 #endif //#GLIBMM_PROPERTIES_ENABLED
00490
00491 #ifdef GLIBMM_PROPERTIES_ENABLED
00492
00498 Glib::PropertyProxy<bool> property_sync_size() ;
00499 #endif //#GLIBMM_PROPERTIES_ENABLED
00500
00501 #ifdef GLIBMM_PROPERTIES_ENABLED
00502
00508 Glib::PropertyProxy_ReadOnly<bool> property_sync_size() const;
00509 #endif //#GLIBMM_PROPERTIES_ENABLED
00510
00511 #ifdef GLIBMM_PROPERTIES_ENABLED
00512
00518 Glib::PropertyProxy_ReadOnly<int> property_tile_waste() const;
00519 #endif //#GLIBMM_PROPERTIES_ENABLED
00520
00521
00522 public:
00523
00524 public:
00525
00526 #ifdef GLIBMM_VFUNCS_ENABLED
00527 #endif //GLIBMM_VFUNCS_ENABLED
00528
00529 protected:
00530
00531 #ifdef GLIBMM_VFUNCS_ENABLED
00532 #endif //GLIBMM_VFUNCS_ENABLED
00533
00534
00535 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00536 virtual void on_size_change(gint width, gint height);
00537 virtual void on_pixbuf_change();
00538 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00539
00540
00541 };
00542
00543 }
00544
00545
00546
00547
00548 namespace Glib
00549 {
00558 Glib::RefPtr<Clutter::Texture> wrap(ClutterTexture* object, bool take_copy = false);
00559 }
00560
00561
00562 #endif
00563