digitalmars.D - using cairo with gtkd
- llee (10/10) Jan 22 2008 A number of functions in Cairo return objects with the following naming ...
- llee (2/20) Jan 22 2008 never mind, I solved it.
- llee (2/22) Jan 22 2008 I imported gtkc.cairoLibtypes. This stoped the compiler from saying that...
- John Reimer (23/47) Jan 22 2008 GtkD uses gtk+ (and related bindings like cairo) that are not full
- Frank Benoit (4/4) Jan 22 2008 the dwt-linux project contains also the cairo bindings.
- John Reimer (5/10) Jan 23 2008 Ah, right. This would be the best solution for correct bindings. They
A number of functions in Cairo return objects with the following naming conventions, according to the documention on: http://devel.akbkhome.com/gtkd_docs/src/cairoLib: cairo_<object name>_t When I try to create instances of these objects, I get an error. For example, when I try to instantiate the following: cairo_text_extents_t* textExtents The compiler says that cairo_text_extents_t is undefined. I tried importing the following modules: cairoLib.Cairo, and cairoLib.Types. Neither of these resolved the problem. If anyone can tell me how I can use the following functions I'd appreciate it. void textExtents (char[] utf8, cairo_text_extents_t * extents); void selectFontFace (char[] family, cairo_font_slant_t slant, cairo_font_weight_t weight); Thanks in advance.
Jan 22 2008
llee Wrote:A number of functions in Cairo return objects with the following naming conventions, according to the documention on: http://devel.akbkhome.com/gtkd_docs/src/cairoLib: cairo_<object name>_t When I try to create instances of these objects, I get an error. For example, when I try to instantiate the following: cairo_text_extents_t* textExtents The compiler says that cairo_text_extents_t is undefined. I tried importing the following modules: cairoLib.Cairo, and cairoLib.Types. Neither of these resolved the problem. If anyone can tell me how I can use the following functions I'd appreciate it. void textExtents (char[] utf8, cairo_text_extents_t * extents); void selectFontFace (char[] family, cairo_font_slant_t slant, cairo_font_weight_t weight); Thanks in advance.never mind, I solved it.
Jan 22 2008
llee Wrote:llee Wrote:I imported gtkc.cairoLibtypes. This stoped the compiler from saying that cairo_text_extents_t is undefined, but the structure is missing data members. When I tried to dereference cairo_text_extents_t.width the compiler says that width is not a recognized data member. I get the same error when I try to dereference Xadvance. I'm really running out of ideas here. Any help would be appreciated.A number of functions in Cairo return objects with the following naming conventions, according to the documention on: http://devel.akbkhome.com/gtkd_docs/src/cairoLib: cairo_<object name>_t When I try to create instances of these objects, I get an error. For example, when I try to instantiate the following: cairo_text_extents_t* textExtents The compiler says that cairo_text_extents_t is undefined. I tried importing the following modules: cairoLib.Cairo, and cairoLib.Types. Neither of these resolved the problem. If anyone can tell me how I can use the following functions I'd appreciate it. void textExtents (char[] utf8, cairo_text_extents_t * extents); void selectFontFace (char[] family, cairo_font_slant_t slant, cairo_font_weight_t weight); Thanks in advance.
Jan 22 2008
llee wrote:llee Wrote:GtkD uses gtk+ (and related bindings like cairo) that are not full definitions of the C counterparts. This means many of the gtkc structs (including cairoLib) are declared as opaque types. That is, the struct members are not defined. The assumption is that these data members are not going to be accessed by the D programmer. This is sufficient for implementing GtkD itself but may not be sufficient for those that want to direct access to the complete C header definitions of the struct types. You could do a couple of things. (1) You could look in the C Cairo headers and find the complete definition of the struct and add the D equivalent to the gtkc/cairoLibtypes.d module yourself. This probably would be a fairly simple fix. or... (2) You could get the complete gtk+ (including cairo) from the bcd generated bindings (www.dsource.org/projects/bcd). These bindings include the full struct definitions for all types. But, if you need to use GtkD, these are not set up to work correctly along side it. In summary, the GtkD gtk+ bindings are not complete and are insufficient if you want to use them to work with pure gtk+ (this you can do, but there is limited support)... they are mostly available to accomodate GtkD wrapping and therefore provide the functionality that GtkD needs. -JJRllee Wrote:I imported gtkc.cairoLibtypes. This stoped the compiler from saying that cairo_text_extents_t is undefined, but the structure is missing data members. When I tried to dereference cairo_text_extents_t.width the compiler says that width is not a recognized data member. I get the same error when I try to dereference Xadvance. I'm really running out of ideas here. Any help would be appreciated.A number of functions in Cairo return objects with the following naming conventions, according to the documention on: http://devel.akbkhome.com/gtkd_docs/src/cairoLib: cairo_<object name>_t When I try to create instances of these objects, I get an error. For example, when I try to instantiate the following: cairo_text_extents_t* textExtents The compiler says that cairo_text_extents_t is undefined. I tried importing the following modules: cairoLib.Cairo, and cairoLib.Types. Neither of these resolved the problem. If anyone can tell me how I can use the following functions I'd appreciate it. void textExtents (char[] utf8, cairo_text_extents_t * extents); void selectFontFace (char[] family, cairo_font_slant_t slant, cairo_font_weight_t weight); Thanks in advance.
Jan 22 2008
the dwt-linux project contains also the cairo bindings. What is special about them is, that all struct sizes are verified too match them in C. See dwt/internal/c
Jan 22 2008
Frank Benoit wrote:the dwt-linux project contains also the cairo bindings. What is special about them is, that all struct sizes are verified too match them in C. See dwt/internal/cAh, right. This would be the best solution for correct bindings. They also have correct conversions for many of the struct bitfields in gtk+. Thanks, Frank. -JJR
Jan 23 2008