texture.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _CLUTTERMM_TEXTURE_H
00004 #define _CLUTTERMM_TEXTURE_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /* Copyright (C) 2007 The cluttermm Development Team
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free
00023  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 #include <cluttermm/actor.h>
00027 #include <cluttermm/types.h>
00028 #include <clutter/clutter.h> // For CoglHandle
00029  
00030 
00031 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00032 typedef struct _ClutterTexture ClutterTexture;
00033 typedef struct _ClutterTextureClass ClutterTextureClass;
00034 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00035 
00036 
00037 namespace Clutter
00038 { class Texture_Class; } // namespace Clutter
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 } // namespace Clutter
00091 
00092 
00093 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00094 namespace Glib
00095 {
00096 
00097 template <>
00098 class Value<Clutter::TextureFlags> : public Glib::Value_Flags<Clutter::TextureFlags>
00099 {
00100 public:
00101   static GType value_type() G_GNUC_CONST;
00102 };
00103 
00104 } // namespace Glib
00105 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00106 
00107 
00108 namespace Clutter
00109 {
00110 
00114 enum TextureQuality
00115 {
00116   TEXTURE_QUALITY_LOW,
00117   TEXTURE_QUALITY_MEDIUM,
00118   TEXTURE_QUALITY_HIGH
00119 };
00120 
00121 } // namespace Clutter
00122 
00123 
00124 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00125 namespace Glib
00126 {
00127 
00128 template <>
00129 class Value<Clutter::TextureQuality> : public Glib::Value_Enum<Clutter::TextureQuality>
00130 {
00131 public:
00132   static GType value_type() G_GNUC_CONST;
00133 };
00134 
00135 } // namespace Glib
00136 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00137 
00138 
00139 namespace Clutter
00140 {
00141 
00142 
00145 class TextureError : public Glib::Error
00146 {
00147 public:
00148   enum Code
00149   {
00150     OUT_OF_MEMORY,
00151     NO_YUV,
00152     BAD_FORMAT
00153   };
00154 
00155   TextureError(Code error_code, const Glib::ustring& error_message);
00156   explicit TextureError(GError* gobject);
00157   Code code() const;
00158 
00159 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00160 private:
00161 
00162 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00163   static void throw_func(GError* gobject);
00164 #else
00165   //When not using exceptions, we just pass the Exception object around without throwing it:
00166   static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
00167 #endif //GLIBMM_EXCEPTIONS_ENABLED
00168 
00169   friend void wrap_init(); // uses throw_func()
00170 #endif
00171 };
00172 
00173 } // namespace Clutter
00174 
00175 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00176 namespace Glib
00177 {
00178 
00179 template <>
00180 class Value<Clutter::TextureError::Code> : public Glib::Value_Enum<Clutter::TextureError::Code>
00181 {
00182 public:
00183   static GType value_type() G_GNUC_CONST;
00184 };
00185 
00186 } // namespace Glib
00187 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00188 
00189 
00190 namespace Clutter
00191 {
00192 
00193 
00194 class Texture : public Actor
00195 {
00196   
00197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00198 
00199 public:
00200   typedef Texture CppObjectType;
00201   typedef Texture_Class CppClassType;
00202   typedef ClutterTexture BaseObjectType;
00203   typedef ClutterTextureClass BaseClassType;
00204 
00205 private:  friend class Texture_Class;
00206   static CppClassType texture_class_;
00207 
00208 private:
00209   // noncopyable
00210   Texture(const Texture&);
00211   Texture& operator=(const Texture&);
00212 
00213 protected:
00214   explicit Texture(const Glib::ConstructParams& construct_params);
00215   explicit Texture(ClutterTexture* castitem);
00216 
00217 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00218 
00219 public:
00220   virtual ~Texture();
00221 
00222 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00223   static GType get_type()      G_GNUC_CONST;
00224   static GType get_base_type() G_GNUC_CONST;
00225 #endif
00226 
00228   ClutterTexture*       gobj()       { return reinterpret_cast<ClutterTexture*>(gobject_); }
00229 
00231   const ClutterTexture* gobj() const { return reinterpret_cast<ClutterTexture*>(gobject_); }
00232 
00234   ClutterTexture* gobj_copy();
00235 
00236 private:
00237 
00238 
00239 protected:
00240   Texture();
00241   // We do not wrap this constructor because it might throw an error. This
00242   // gets difficult to get right especially for disabled exceptions in glibmm,
00243   // and it is easy enough to create a texture and call set_from_file() on
00244   // it manually.  But we do wrap the create method at least. --danielk
00245   
00246 
00247   // TODO: Wrap clutter_texture_new_from_actor. This needs changes in clutter
00248   // since the _new function does a lot more than calling g_object_new().
00249   //_WRAP_CTOR(Texture(const Glib::RefPtr<Actor>& actor), clutter_texture_new_from_actor)
00250 
00251 public:
00252  
00253 
00254   static Glib::RefPtr<Texture> create();
00255 
00256   static Glib::RefPtr<Texture> create_from_file(const std::string& filename);
00257   //_WRAP_CREATE(const Glib::RefPtr<Actor>& actor);
00258 
00259   
00267 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00268   bool set_from_file(const std::string& filename);
00269 #else
00270   bool set_from_file(const std::string& filename, std::auto_ptr<Glib::Error>& error);
00271 #endif //GLIBMM_EXCEPTIONS_ENABLED
00272 
00273   
00288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00289   bool set_from_rgb_data(const guchar* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags);
00290 #else
00291   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);
00292 #endif //GLIBMM_EXCEPTIONS_ENABLED
00293 
00294   
00307 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00308   bool set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags);
00309 #else
00310   bool set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags, std::auto_ptr<Glib::Error>& error);
00311 #endif //GLIBMM_EXCEPTIONS_ENABLED
00312 
00313   
00328 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00329   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);
00330 #else
00331   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);
00332 #endif //GLIBMM_EXCEPTIONS_ENABLED
00333 
00334   
00339   void get_base_size(int& width, int& height) const;
00340 
00341   
00347   TextureQuality get_filter_quality() const;
00348   
00361   void set_filter_quality(TextureQuality filter_quality);
00362   
00370   int get_amx_tile_waste() const;
00371   
00383   void set_max_tile_waste(int max_tile_waste);
00384 
00385   // TODO: Is there a coglmm we could depend on for this?
00386   
00390   CoglHandle get_cogl_texture() const;
00391   
00399   void set_cogl_texture(CoglHandle handle);
00400 
00401   
00407   Glib::SignalProxy2< void,int,int > signal_size_change();
00408 
00409   
00415   Glib::SignalProxy0< void > signal_pixbuf_change();
00416 
00417 
00418  // TODO: What's with the C type?
00419   #ifdef GLIBMM_PROPERTIES_ENABLED
00420 
00426   Glib::PropertyProxy<CoglHandle> property_cogl_texture() ;
00427 #endif //#GLIBMM_PROPERTIES_ENABLED
00428 
00429 #ifdef GLIBMM_PROPERTIES_ENABLED
00430 
00436   Glib::PropertyProxy_ReadOnly<CoglHandle> property_cogl_texture() const;
00437 #endif //#GLIBMM_PROPERTIES_ENABLED
00438 
00439   #ifdef GLIBMM_PROPERTIES_ENABLED
00440 
00446   Glib::PropertyProxy_ReadOnly<bool> property_disable_slicing() const;
00447 #endif //#GLIBMM_PROPERTIES_ENABLED
00448 
00449 
00450   #ifdef GLIBMM_PROPERTIES_ENABLED
00451 
00457   Glib::PropertyProxy_WriteOnly<std::string> property_filename() ;
00458 #endif //#GLIBMM_PROPERTIES_ENABLED
00459 
00460 
00461   #ifdef GLIBMM_PROPERTIES_ENABLED
00462 
00468   Glib::PropertyProxy<TextureQuality> property_filter_quality() ;
00469 #endif //#GLIBMM_PROPERTIES_ENABLED
00470 
00471 #ifdef GLIBMM_PROPERTIES_ENABLED
00472 
00478   Glib::PropertyProxy_ReadOnly<TextureQuality> property_filter_quality() const;
00479 #endif //#GLIBMM_PROPERTIES_ENABLED
00480 
00481   #ifdef GLIBMM_PROPERTIES_ENABLED
00482 
00488   Glib::PropertyProxy_ReadOnly<int> property_pixel_format() const;
00489 #endif //#GLIBMM_PROPERTIES_ENABLED
00490 
00491 
00492   #ifdef GLIBMM_PROPERTIES_ENABLED
00493 
00499   Glib::PropertyProxy<bool> property_repeat_x() ;
00500 #endif //#GLIBMM_PROPERTIES_ENABLED
00501 
00502 #ifdef GLIBMM_PROPERTIES_ENABLED
00503 
00509   Glib::PropertyProxy_ReadOnly<bool> property_repeat_x() const;
00510 #endif //#GLIBMM_PROPERTIES_ENABLED
00511 
00512   #ifdef GLIBMM_PROPERTIES_ENABLED
00513 
00519   Glib::PropertyProxy<bool> property_repeat_y() ;
00520 #endif //#GLIBMM_PROPERTIES_ENABLED
00521 
00522 #ifdef GLIBMM_PROPERTIES_ENABLED
00523 
00529   Glib::PropertyProxy_ReadOnly<bool> property_repeat_y() const;
00530 #endif //#GLIBMM_PROPERTIES_ENABLED
00531 
00532   #ifdef GLIBMM_PROPERTIES_ENABLED
00533 
00539   Glib::PropertyProxy<bool> property_sync_size() ;
00540 #endif //#GLIBMM_PROPERTIES_ENABLED
00541 
00542 #ifdef GLIBMM_PROPERTIES_ENABLED
00543 
00549   Glib::PropertyProxy_ReadOnly<bool> property_sync_size() const;
00550 #endif //#GLIBMM_PROPERTIES_ENABLED
00551 
00552   #ifdef GLIBMM_PROPERTIES_ENABLED
00553 
00559   Glib::PropertyProxy_ReadOnly<int> property_tile_waste() const;
00560 #endif //#GLIBMM_PROPERTIES_ENABLED
00561 
00562 
00563 public:
00564 
00565 public:
00566   //C++ methods used to invoke GTK+ virtual functions:
00567 #ifdef GLIBMM_VFUNCS_ENABLED
00568 #endif //GLIBMM_VFUNCS_ENABLED
00569 
00570 protected:
00571   //GTK+ Virtual Functions (override these to change behaviour):
00572 #ifdef GLIBMM_VFUNCS_ENABLED
00573 #endif //GLIBMM_VFUNCS_ENABLED
00574 
00575   //Default Signal Handlers::
00576 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00577   virtual void on_size_change(int width, int height);
00578   virtual void on_pixbuf_change();
00579 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00580 
00581 
00582 };
00583 
00584 } // namespace Clutter
00585 
00586 
00587 namespace Glib
00588 {
00597   Glib::RefPtr<Clutter::Texture> wrap(ClutterTexture* object, bool take_copy = false);
00598 }
00599 
00600 
00601 #endif /* _CLUTTERMM_TEXTURE_H */
00602 

Generated on Tue Feb 24 03:45:09 2009 for cluttermm by  doxygen 1.5.8