示例#1
0
/* {{{ proto bool ImagickPixel::getIndex()
	Gets the colormap index of the pixel wand 
*/
PHP_METHOD(imagickpixel, getindex)
{
	php_imagickpixel_object *internp;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
		return;
	}
	
	internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
	RETVAL_LONG(PixelGetIndex(internp->pixel_wand));
}
示例#2
0
/* {{{ proto bool ImagickPixel::getIndex()
	Gets the colormap index of the pixel wand
*/
PHP_METHOD(imagickpixel, getindex)
{
    php_imagickpixel_object *internp;

    if (zend_parse_parameters_none() == FAILURE) {
        return;
    }

    internp = Z_IMAGICKPIXEL_P(getThis());
    RETVAL_LONG(PixelGetIndex(internp->pixel_wand));
}
示例#3
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   P i x e l S y n c I t e r a t o r                                         %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  PixelSyncIterator() syncs the pixel iterator.
%
%  The format of the PixelSyncIterator method is:
%
%      MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
%
%  A description of each parameter follows:
%
%    o iterator: the pixel iterator.
%
*/
WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
{
  IndexPacket
    *indexes;

  register long
    x;

  register PixelPacket
    *p;

  assert(iterator != (const PixelIterator *) NULL);
  assert(iterator->signature == WandSignature);
  if (iterator->debug != MagickFalse)
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
  if (SetCacheViewStorageClass(iterator->view,DirectClass) == MagickFalse)
    return(MagickFalse);
  p=GetCacheViewPixels(iterator->view,iterator->region.x,iterator->region.y+
    iterator->y,iterator->region.width,1);
  if (p == (PixelPacket *) NULL)
    {
      InheritException(iterator->exception,GetCacheViewException(
        iterator->view));
      return(MagickFalse);
    }
  indexes=GetCacheViewIndexes(iterator->view);
  for (x=0; x < (long) iterator->region.width; x++)
  {
    PixelGetQuantumColor(iterator->pixel_wands[x],p);
    if (GetCacheViewColorspace(iterator->view) == CMYKColorspace)
      indexes[x]=PixelGetBlackQuantum(iterator->pixel_wands[x]);
    else
      if (GetCacheViewStorageClass(iterator->view) == PseudoClass)
        indexes[x]=PixelGetIndex(iterator->pixel_wands[x]);
    p++;
  }
  if (SyncCacheView(iterator->view) == MagickFalse)
    {
      InheritException(iterator->exception,GetCacheViewException(
        iterator->view));
      return(MagickFalse);
    }
  return(MagickTrue);
}