#37636 [NEW]: GdkPixbuf::new_from_gd transfers red colors only
| From: | cweiske@php.net | Date: | Tue, 30 May 2006 04:33:27 +0000 |
| Subject: | #37636 [NEW]: GdkPixbuf::new_from_gd transfers red colors only | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2916@lists.php.net to get a copy of this message | ||
From: cweiske@php.net
Operating system: Linux
PHP version: 5.1.4
PHP Bug Type: PHP-GTK related
Bug description: GdkPixbuf::new_from_gd transfers red colors only
Description:
------------
GdkPixbuf::new_from_gd() seems to transfer the red parts of the picture to
the pixbuf. Even when there is a black line, it appears light grey on the
pixbuf.
Reproduce code:
---------------
<?php
//image_graph multiple plots usage example
error_reporting(E_ALL);
include 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 400));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(
Image_Graph::vertical(
Image_Graph::vertical(
$Title = Image_Graph::factory('title', array('Multiple Plots',
11)),
$SubTitle = Image_Graph::factory('title', array('This is a
demonstration of title alignment', 7)),
90
),
$Plotarea = Image_Graph::factory('plotarea'),
8
)
);
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
$SubTitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
$Grid =& $Plotarea->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y);
$Grid->setFillStyle(Image_Graph::factory('gradient',
array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'lightgrey')));
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Smoothed_Area',
Image_Graph::factory('random', array(10, 20, 100, true)));
$Plot->setFillColor('red@0.2');
$Plot =& $Plotarea->addNew('line', Image_Graph::factory('random',
array(10, 20, 100, true)));
$Plot->setLineColor('blue@0.2');
$CircleMarker =& Image_Graph::factory('Image_Graph_Marker_Circle');
$Plot->setMarker($CircleMarker);
$CircleMarker->setFillColor('white@0.4');
$Plot =& $Plotarea->addNew('bar', Image_Graph::factory('random',
array(10,
2, 40, true)));
$Plot->setFillColor('green@0.2');
$Marker =& Image_Graph::factory('Image_Graph_Marker_Value',
IMAGE_GRAPH_VALUE_Y);
$Plot->setMarker($Marker);
$Marker->setFillColor('white');
$Marker->setBorderColor('black');
$AxisY = $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->showArrow();
$Array = array(
"Jan-Feb\n2004",
"Mar-Apr\n2004",
"May-Jun\n2004",
"Jul-Aug\n2004",
"Sep-Oct\n2004",
"Nov-Dev\n2004",
"Jan-Feb\n2005",
"Mar-Apr\n2005",
"May-Jun\n2005",
"Jul-Aug\n2005"
);
$AxisX = $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisX->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Array',
array($Array)));
//that is a critical line. Setting the output to "none" is important
$Graph->done(array('output' => 'none'));
$canvas = $Graph->_getCanvas();
$gd = $canvas->_canvas;
$pixbuf = GdkPixbuf::new_from_gd($gd);
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->add(GtkImage::new_from_pixbuf($pixbuf));
$wnd->show_all();
Gtk::main();
?>
Expected result:
----------------
http://xml.cweiske.de/2006-05-30%20multiple_slots_original.png
Actual result:
--------------
http://xml.cweiske.de/2006-05-30%20multiple_slots_gtk.png
--
Edit bug report at http://bugs.php.net/?id=37636&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37636&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37636&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37636&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37636&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37636&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37636&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37636&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37636&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37636&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37636&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37636&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37636&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37636&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37636&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37636&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37636&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37636&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37636&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37636&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37636&r=mysqlcfg