⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpdf.c

📁 php-4.4.7学习linux时下载的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
PHP_FUNCTION(cpdf_set_text_rise){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}		cpdf_setTextRise(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_set_text_matrix(int pdfdoc, arry matrix)   Sets the text matrix */PHP_FUNCTION(cpdf_set_text_matrix){	pval *arg1, *arg2, *data;	int id, type, i;	HashTable *matrix;	CPDFdoc *pdf;	float *pdfmatrixptr;	float pdfmatrix[6];	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_array(arg2);	id=Z_LVAL_P(arg1);	matrix=Z_ARRVAL_P(arg2);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}		if(zend_hash_num_elements(matrix) != 6) {		php_error(E_WARNING, "%s(): Text matrix must have 6 elements", get_active_function_name(TSRMLS_C));		RETURN_FALSE;	}	pdfmatrixptr = pdfmatrix;	zend_hash_internal_pointer_reset(matrix);	for(i=0; i<zend_hash_num_elements(matrix); i++) {		zend_hash_get_current_data(matrix, (void *) &data);		switch(Z_TYPE_P(data)) {			case IS_DOUBLE:				*pdfmatrixptr++ = (float) Z_DVAL_P(data);				break;			default:				*pdfmatrixptr++ = 0.0;				break;		}		zend_hash_move_forward(matrix);	}	cpdf_setTextMatrix(pdf, pdfmatrix[0], pdfmatrix[1],                       pdfmatrix[2], pdfmatrix[3],                       pdfmatrix[4], pdfmatrix[5]);	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])   Sets the position of text for the next cpdf_show call */PHP_FUNCTION(cpdf_set_text_pos){	pval *argv[4];	int id, type, argc, mode=0;	CPDFdoc *pdf;	argc = ZEND_NUM_ARGS();	if((argc < 3) || (argc > 4))		WRONG_PARAM_COUNT;	if (getParametersArray(ht, argc, argv) == FAILURE)		WRONG_PARAM_COUNT;	convert_to_long(argv[0]);	convert_to_double(argv[1]);	convert_to_double(argv[2]);	id=Z_LVAL_P(argv[0]);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}		if(argc > 3) {		convert_to_long(argv[3]);		mode = Z_LVAL_P(argv[3]);	}	if(mode == 1)		cpdf_rawSetTextPosition(pdf, (float) Z_DVAL_P(argv[1]), (float) Z_DVAL_P(argv[2]));	else		cpdf_setTextPosition(pdf, (float) Z_DVAL_P(argv[1]), (float) Z_DVAL_P(argv[2]));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_rotate_text(int pdfdoc, float angle)   Sets text rotation angle */PHP_FUNCTION(cpdf_rotate_text){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_rotateText(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_set_char_spacing(int pdfdoc, float space)   Sets character spacing */PHP_FUNCTION(cpdf_set_char_spacing){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_setCharacterSpacing(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_set_word_spacing(int pdfdoc, float space)   Sets spacing between words */PHP_FUNCTION(cpdf_set_word_spacing){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_setWordSpacing(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto float cpdf_stringwidth(int pdfdoc, string text)   Returns width of text in current font */PHP_FUNCTION(cpdf_stringwidth){	pval *arg1, *arg2;	int id, type;	double width;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_string(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	width = (double) cpdf_stringWidth(pdf, Z_STRVAL_P(arg2));	RETURN_DOUBLE((double)width);}/* }}} *//* {{{ proto bool cpdf_save(int pdfdoc)   Saves current enviroment */PHP_FUNCTION(cpdf_save){	pval *arg1;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_gsave(pdf);	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_restore(int pdfdoc)   Restores formerly saved enviroment */PHP_FUNCTION(cpdf_restore){	pval *arg1;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_grestore(pdf);	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_translate(int pdfdoc, float x, float y)   Sets origin of coordinate system */PHP_FUNCTION(cpdf_translate){	pval *arg1, *arg2, *arg3;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	convert_to_double(arg3);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_rawTranslate(pdf, (float) Z_DVAL_P(arg2), (float) Z_DVAL_P(arg3));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_scale(int pdfdoc, float x_scale, float y_scale)   Sets scaling */PHP_FUNCTION(cpdf_scale){	pval *arg1, *arg2, *arg3;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	convert_to_double(arg3);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_scale(pdf, (float) Z_DVAL_P(arg2), (float) Z_DVAL_P(arg3));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_rotate(int pdfdoc, float angle)   Sets rotation */PHP_FUNCTION(cpdf_rotate){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_rotate(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_setflat(int pdfdoc, float value)   Sets flatness */PHP_FUNCTION(cpdf_setflat){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	if((Z_LVAL_P(arg2) > 100) && (Z_LVAL_P(arg2) < 0)) {		php_error(E_WARNING, "%s(): Parameter has to between 0 and 100", get_active_function_name(TSRMLS_C));		RETURN_FALSE;	}	cpdf_setflat(pdf, (int) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_setlinejoin(int pdfdoc, int value)   Sets linejoin parameter */PHP_FUNCTION(cpdf_setlinejoin){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_long(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) {		php_error(E_WARNING, "%s(): Parameter has to between 0 and 2", get_active_function_name(TSRMLS_C));		RETURN_FALSE;	}	cpdf_setlinejoin(pdf, Z_LVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_setlinecap(int pdfdoc, int value)   Sets linecap parameter */PHP_FUNCTION(cpdf_setlinecap){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_long(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) {		php_error(E_WARNING, "%s(): Parameter has to be > 0 and =< 2", get_active_function_name(TSRMLS_C));		RETURN_FALSE;	}	cpdf_setlinecap(pdf, Z_LVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_setmiterlimit(int pdfdoc, float value)   Sets miter limit */PHP_FUNCTION(cpdf_setmiterlimit){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	if(Z_DVAL_P(arg2) < 1) {		php_error(E_WARNING, "%s(): Parameter has to be >= 1", get_active_function_name(TSRMLS_C));		RETURN_FALSE;	}	cpdf_setmiterlimit(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} *//* {{{ proto bool cpdf_setlinewidth(int pdfdoc, float width)   Sets line width */PHP_FUNCTION(cpdf_setlinewidth){	pval *arg1, *arg2;	int id, type;	CPDFdoc *pdf;	if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {		WRONG_PARAM_COUNT;	}	convert_to_long(arg1);	convert_to_double(arg2);	id=Z_LVAL_P(arg1);	pdf = zend_list_find(id, &type);	if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {		php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);		RETURN_FALSE;	}	cpdf_setlinewidth(pdf, (float) Z_DVAL_P(arg2));	RETURN_TRUE;}/* }}} */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -