cvs: php4 /ext/printer php_printer.h printer.c

From: Date: Fri, 27 Oct 2000 20:28:01 +0000
Subject: cvs: php4 /ext/printer php_printer.h printer.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2316@lists.php.net to get a copy of this message
fmk Fri Oct 27 13:28:01 2000 EDT Modified files: /php4/ext/printer php_printer.h printer.c Log: Adding cvs ID's and ading code in hex_to_rgb() Index: php4/ext/printer/php_printer.h diff -u php4/ext/printer/php_printer.h:1.1 php4/ext/printer/php_printer.h:1.2 --- php4/ext/printer/php_printer.h:1.1 Fri Oct 27 12:27:20 2000 +++ php4/ext/printer/php_printer.h Fri Oct 27 13:28:00 2000 @@ -17,6 +17,8 @@ +----------------------------------------------------------------------+ */ +/* $Id: php_printer.h,v 1.2 2000/10/27 20:28:00 fmk Exp $ */ + #ifndef PHP_PRINTER_H #define PHP_PRINTER_H Index: php4/ext/printer/printer.c diff -u php4/ext/printer/printer.c:1.3 php4/ext/printer/printer.c:1.4 --- php4/ext/printer/printer.c:1.3 Fri Oct 27 13:17:45 2000 +++ php4/ext/printer/printer.c Fri Oct 27 13:28:00 2000 @@ -17,11 +17,14 @@ +----------------------------------------------------------------------+ */ +/* $Id: printer.c,v 1.4 2000/10/27 20:28:00 fmk Exp $ */ + #include "php.h" #include "php_ini.h" #include "ext/standard/php_string.h" #include "ext/standard/info.h" #include "ext/standard/php_math.h" +#include <math.h> #include "php_printer.h" @@ -105,7 +108,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Printer Support" , "enabled"); php_info_print_table_row(2, "Default printing device", get_default_printer()); - php_info_print_table_row(2, "RCS Version" , "$Id: printer.c,v 1.3 2000/10/27 20:17:45 dbeu Exp $"); + php_info_print_table_row(2, "RCS Version" , "$Id: printer.c,v 1.4 2000/10/27 20:28:00 fmk Exp $"); php_info_print_table_end(); } @@ -973,11 +976,25 @@ return printer->pPrinterName; } - /* convert a hexadecimal number to the rgb colorref */ COLORREF hex_to_rgb(char* hex) { - int r = 0,g = 0,b = 0; + int r = 0,g = 0,b = 0, len; + char tmp[3]; + + len = strlen(hex); + if (len >= 2) { + strncpy(tmp, hex, 2); + r = _php_math_basetolong(tmp, 16); + } + if (len >= 4) { + strncpy(tmp, hex+2, 2); + g = _php_math_basetolong(tmp, 16); + } + if (len == 6) { + strncpy(tmp, hex+4, 2); + b = _php_math_basetolong(tmp, 16); + } return RGB(r,g,b); }

« previous php.cvs (#2316) next »