/* {{{ proto bool ImagickPixel::setColorValueQuantum(int color, float value) Sets the quantum color of the ImagickPixel. */ PHP_METHOD(imagickpixel, setcolorvaluequantum) { php_imagickpixel_object *internp; long color, color_value; /* Parse parameters given to function */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &color, &color_value) == FAILURE) { return; } internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC); switch (color) { case IMAGICKCOLORBLACK: PixelSetBlackQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORBLUE: PixelSetBlueQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORCYAN: PixelSetCyanQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORGREEN: PixelSetGreenQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORRED: PixelSetRedQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORYELLOW: PixelSetYellowQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORMAGENTA: PixelSetMagentaQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLOROPACITY: PixelSetOpacityQuantum(internp->pixel_wand, color_value); break; case IMAGICKCOLORALPHA: PixelSetAlphaQuantum(internp->pixel_wand, color_value); break; default: php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); return; break; } RETVAL_TRUE; }
/* {{{ proto GmagickPixel GmagickPixel::setColorValueQuantum(int color, float value) Sets the normalized color quantum of the GmagickPixel. */ PHP_METHOD(gmagickpixel, setcolorvaluequantum) { php_gmagickpixel_object *internp; zend_long color_quantum; double color_value_quantum_input; Quantum color_value_quantum; /* Parse parameters given to function */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &color_quantum, &color_value_quantum_input) == FAILURE) { return; } // Possible truncation? color_value_quantum = color_value_quantum_input; internp = Z_GMAGICKPIXEL_OBJ_P(getThis()); switch (color_quantum) { case GMAGICK_COLOR_BLACK: PixelSetBlackQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_BLUE: PixelSetBlueQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_CYAN: PixelSetCyanQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_GREEN: PixelSetGreenQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_RED: PixelSetRedQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_YELLOW: PixelSetYellowQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_MAGENTA: PixelSetMagentaQuantum(internp->pixel_wand, color_value_quantum); break; case GMAGICK_COLOR_OPACITY: PixelSetOpacityQuantum(internp->pixel_wand, color_value_quantum); break; default: zend_throw_exception_ex(php_gmagickpixel_exception_class_entry, 2 TSRMLS_CC, "Unknown color type: %d", color_quantum); RETURN_NULL(); } GMAGICK_CHAIN_METHOD; }
/* {{{ proto bool ImagickPixel::setColorValueQuantum(int color, float value) Sets the quantum color of the ImagickPixel. */ PHP_METHOD(imagickpixel, setcolorvaluequantum) { php_imagickpixel_object *internp; im_long color; #if MAGICKCORE_HDRI_ENABLE double color_value; /* Parse parameters given to function */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &color, &color_value) == FAILURE) { return; } #else im_long color_value; /* Parse parameters given to function */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &color, &color_value) == FAILURE) { return; } #endif internp = Z_IMAGICKPIXEL_P(getThis()); switch (color) { case PHP_IMAGICK_COLOR_BLACK: PixelSetBlackQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_BLUE: PixelSetBlueQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_CYAN: PixelSetCyanQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_GREEN: PixelSetGreenQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_RED: PixelSetRedQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_YELLOW: PixelSetYellowQuantum(internp->pixel_wand, color_value); break; case PHP_IMAGICK_COLOR_MAGENTA: PixelSetMagentaQuantum(internp->pixel_wand, color_value); break; #if MagickLibVersion < 0x700 case PHP_IMAGICK_COLOR_OPACITY: PixelSetOpacityQuantum(internp->pixel_wand, color_value); break; #endif case PHP_IMAGICK_COLOR_ALPHA: PixelSetAlphaQuantum(internp->pixel_wand, color_value); break; default: php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); return; break; } RETVAL_TRUE; }