static long s_count_pixeliterator_rows(php_imagickpixeliterator_object *internpix) { long rows = 0, tmp; PixelWand **row; PixelResetIterator(internpix->pixel_iterator); while ((row = PixelGetNextIteratorRow(internpix->pixel_iterator, &tmp)) != NULL) rows++; return rows; }
/* {{{ proto bool ImagickPixelIterator::resetIterator() Resets the pixel iterator. Use it in conjunction with PixelGetNextIteratorRow() to iterate over all the pixels in a pixel container. */ PHP_METHOD(imagickpixeliterator, resetiterator) { php_imagickpixeliterator_object *internpix; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { return; } internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC); if ( internpix->instanciated_correctly < 1 ) { IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "PixelIterator is not initialized correctly", 3 ); } if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) { IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "PixelIterator is not initialized correctly", 3 ); } PixelResetIterator( internpix->pixel_iterator ); #if MagickLibVersion <= 0x628 internpix->iterator_position = 0; #endif RETURN_TRUE; }