ID: 10436
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: PDF related
Operating System: Linux x86
PHP Version: 4.0 Latest CVS (15/04/2001)
New Comment:

This is fixed in CVS. Try the latest snapshot: http://snaps.php.net/


Previous Comments:
------------------------------------------------------------------------

[2001-04-21 22:30:38] [EMAIL PROTECTED]

In pdf_setcolor() which is part of pdflib-4.0 and in the CVS of PHP, pdf_setcolor() 
can take a number of paramters depending on the type of color space you choose.
This can be either rgb, gray, pattern, spotcolor or cmyk.

Depending on what colorspace you choose, the paramters c1, c2, c3 and c4 are either 
optional or compulsory. For example, if you choose a colorspace of 'rgb' then you only 
need to specify c1, c2 and c3. A colorspace of 'cmyk' requires all four and a 
colorspace of 'gray', 'spotcolor' or 'pattern' merely requires one.

Currently though, you must specify all 4 values with the non-used ones being ignored. 
If you do not specify the ignored paramters then the function terminates the script 
with an error.

For example
pdf_setcolor($pdf, "stroke", "rgb", 0.5, 0.5, 0.5);
should be correct because you only need to specify the reg, green and blue components. 
In reality the function must be used as
pdf_setcolor($pdf, "stroke", "rgb", 0.5, 0.5, 0.5, 0.0);
with the fourth paramter being ignored.

The problem is more pronounced when you specify a pattern or gray color
pdf_setcolor($pdf, "fill", "pattern", $pattern);
is what it would logically be, but the function requires
pdf_setcolor($pdf, "fill", "pattern", $pattern, 0.0, 0.0, 0.0);

which IMHO is just confusing and makes the function harder to understand in the long 
run.
Can the function be changed to make the optional paramters truly optional? A simple 
switch/case statement in the function for the colorspace should suffice.



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=10436&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to