note 64769 added to function.imagecolorat

From: Date: Thu, 20 Apr 2006 11:48:09 +0000
Subject: note 64769 added to function.imagecolorat
Groups: php.notes 
Request: Send a blank email to php-notes+get-108805@lists.php.net to get a copy of this message
If you look in the gd library for C in gd.h you have the following defined for truecolor images. #define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24) #define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16) #define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8) #define gdTrueColorGetBlue(c) ((c) & 0x0000FF) So in php you could just do it as so: $rgba = imagecolorat($im,$x,$y); $alpha = ($rgba & 0x7F000000) >> 24; $red = ($rgba & 0xFF0000) >> 16; $green = ($rgba & 0x00FF00) >> 8; $blue = ($rgba & 0x0000FF); And there you have what you would need if you have a truecolor image with an alpha channel. ---- Server IP: 129.16.214.50 Probable Submitter: 85.226.31.206 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imagecolorat.php Edit -- http://master.php.net/note/edit/64769 Del: integrated -- http://master.php.net/note/delete/64769/integrated Del: useless -- http://master.php.net/note/delete/64769/useless Del: bad code -- http://master.php.net/note/delete/64769/bad+code Del: spam -- http://master.php.net/note/delete/64769/spam Del: non-english -- http://master.php.net/note/delete/64769/non-english Del: in docs -- http://master.php.net/note/delete/64769/in+docs Del: other reasons-- http://master.php.net/note/delete/64769 Reject -- http://master.php.net/note/reject/64769 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#108805) next »