Re: GdkPixbuf example

From: Date: Wed, 05 Dec 2001 07:30:06 +0000
Subject: Re: GdkPixbuf example
References: 1 2 3  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-228@lists.php.net to get a copy of this message
me just copy code :) -= this is new from data = should they be int's as well....??? override gdk_pixbuf_new_from_data PHP_FUNCTION(gdk_pixbuf_new_from_data) {
         long bits_per_sample, width, height, rowstride;
       if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "VVbiiii", &data, &php_colorspace, &has_alpha, &bits_per_sample, &width, &height, &rowstride))
               return;
       PHP_GTK_SEPARATE_RETURN(return_value, php_gdk_pixbuf_new(gdk_pixbuf_new_from_data(Z_STRVAL_P(data), colorspace, (gboolean)has_alpha, (int)bits_per_sample, (int)width, (int)height, (int)rowstride, (GdkPixbufDestroyNotify)php_gtk_destroy_notify, data)));
} Markus Fischer wrote:
On Wed, Dec 05, 2001 at 03:02:28PM +0800, Alan Knowles wrote :
+        zval *pixbuf, *pixmap_return, *mask_return;
+        long alpha_threshold;
          ^^^^
+        GdkPixmap *pixmap = NULL;
+        GdkBitmap *mask;
+
+        NOT_STATIC_METHOD();
+
+        if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &alpha_threshold))
+                return;
+
+        gdk_pixbuf_render_pixmap_and_mask(PHP_GDK_PIXBUF_GET(this_ptr),
+                                          &pixmap, &mask, (int)alpha_threshold);
                                                            ^^^^^
           parse_args already casts to 'int', you don't need
           long anywhere.
           - Markus


« previous php.gtk.dev (#228) next »