├── tests ├── CairoFontFace │ ├── CairoFtFontFace │ │ ├── broken.ttf │ │ └── Vera.ttf │ ├── create_toyfont.inc │ ├── CairoToyFontFace │ │ ├── getFamily.phpt │ │ ├── getSlant.phpt │ │ └── getWeight.phpt │ ├── getType.phpt │ ├── CairoFontWeight_constants.phpt │ ├── CairoFontSlant_constants.phpt │ ├── status.phpt │ ├── __construct.phpt │ ├── CairoFontType_constants.phpt │ ├── CairoWin32FontFace │ │ └── cairo_win32_font_face_create.phpt │ └── cairo_font_face_get_type.phpt ├── CairoSurface │ ├── CairoImageSurface │ │ ├── red.png │ │ ├── getWidth.phpt │ │ ├── getFormat.phpt │ │ ├── getHeight.phpt │ │ ├── CairoFormat_constants.phpt │ │ ├── getStride.phpt │ │ ├── getData.phpt │ │ └── cairo_image_surface_create_from_png.phpt │ ├── CairoSvgSurface │ │ ├── cairo_svg_get_versions.phpt │ │ ├── getVersions.phpt │ │ ├── CairoSvgVersion_constants.phpt │ │ └── cairo_svg_version_to_string.phpt │ ├── flush.phpt │ ├── finish.phpt │ ├── markDirty.phpt │ ├── CairoPsSurface │ │ ├── cairo_ps_get_levels.phpt │ │ ├── dscBeginSetup.phpt │ │ ├── CairoPsLevel_constants.phpt │ │ ├── dscBeginPageSetup.phpt │ │ ├── getLevels.phpt │ │ ├── getEps.phpt │ │ └── cairo_ps_level_to_string.phpt │ ├── getType.phpt │ ├── getContent.phpt │ ├── CairoContent_constants.phpt │ ├── getFontOptions.phpt │ ├── copyPage.phpt │ ├── showPage.phpt │ ├── status.phpt │ ├── getDeviceOffset.phpt │ ├── __construct.phpt │ ├── hasShowTextGlyphs.phpt │ ├── CairoSubSurface │ │ └── __construct.phpt │ ├── CairoSurfaceType_constants.phpt │ └── getFallbackResolution.phpt ├── CairoContext │ ├── Paths │ │ ├── cairo_glyph_path.phpt │ │ ├── glyphPath.phpt │ │ ├── closePath.phpt │ │ ├── copyPath.phpt │ │ ├── copyPathFlat.phpt │ │ ├── getCurrentPoint.phpt │ │ ├── hasCurrentPoint.phpt │ │ ├── newPath.phpt │ │ ├── pathExtents.phpt │ │ └── newSubPath.phpt │ ├── Text │ │ ├── create_toyfont.inc │ │ └── fontExtents.phpt │ ├── getTarget.phpt │ ├── cairo_get_target.phpt │ ├── clip.phpt │ ├── copyPage.phpt │ ├── clipPreserve.phpt │ ├── getTarget_errors.phpt │ ├── fill.phpt │ ├── save.phpt │ ├── paint.phpt │ ├── stroke.phpt │ ├── showPage.phpt │ ├── pushGroup.phpt │ ├── resetClip.phpt │ ├── fillPreserve.phpt │ ├── getLineCap.phpt │ ├── getLineJoin.phpt │ ├── strokePreserve.phpt │ ├── getFillRule.phpt │ ├── getAntialias.phpt │ ├── getDashCount.phpt │ ├── Transformations │ │ └── identityMatrix.phpt │ ├── getTarget_custom_class.phpt │ ├── cairo_get_target_custom_class.phpt │ ├── clipExtents.phpt │ ├── getTolerance.phpt │ ├── getOperator.phpt │ ├── getMiterLimit.phpt │ ├── getSource.phpt │ ├── getLineWidth.phpt │ ├── status.phpt │ ├── popGroup.phpt │ ├── getDash.phpt │ ├── cairo_get_target_errors.phpt │ ├── popGroupToSource.phpt │ ├── fillExtents.phpt │ ├── clipRectangleList.phpt │ ├── strokeExtents.phpt │ ├── getGroupTarget.phpt │ ├── restore.phpt │ ├── setSourceRGBA.phpt │ ├── cairo_get_source.phpt │ └── setAntialias.phpt ├── cairo_version.phpt ├── CairoScaledFont │ ├── create_toyfont.inc │ ├── glyphExtents.phpt │ ├── cairo_scaled_font_glyph_extents.phpt │ ├── getType.phpt │ ├── getScaleMatrix.phpt │ ├── status.phpt │ ├── getCtm.phpt │ ├── getFontFace.phpt │ ├── getFontMatrix.phpt │ ├── getFontOptions.phpt │ └── extents.phpt ├── cairo_version_string.phpt ├── CairoPattern │ ├── CairoExtend_constants.phpt │ ├── CairoPatternType_constants.phpt │ ├── CairoSurfacePattern │ │ ├── CairoFilter_constants.phpt │ │ ├── getExtend.phpt │ │ ├── getSurface.phpt │ │ └── getFilter.phpt │ ├── getType.phpt │ ├── CairoGradientPattern │ │ ├── getExtend.phpt │ │ ├── __construct.phpt │ │ ├── CairoLinearGradient │ │ │ └── getPoints.phpt │ │ ├── CairoRadialGradient │ │ │ └── getCircles.phpt │ │ └── getColorStopCount.phpt │ ├── __construct.phpt │ ├── status.phpt │ ├── getMatrix.phpt │ └── CairoSolidPattern │ │ └── getRgba.phpt ├── CairoFontOptions │ ├── CairoHintMetrics_constants.phpt │ ├── cairo_font_options_create.phpt │ ├── CairoHintStyle_constants.phpt │ ├── __construct.phpt │ ├── hash.phpt │ ├── getAntialias.phpt │ ├── getHintStyle.phpt │ ├── getHintMetrics.phpt │ ├── getSubpixelOrder.phpt │ └── status.phpt ├── cairo_available_fonts.phpt ├── cairo_available_surfaces.phpt ├── CairoMatrix │ ├── cairo_matrix_init_identity.phpt │ ├── invert.phpt │ ├── initIdentity.phpt │ ├── matrix_extended_class.phpt │ ├── cairo_matrix_init_rotate.phpt │ ├── rotate.phpt │ ├── initRotate.phpt │ ├── cairo_matrix_init_scale.phpt │ ├── cairo_matrix_invert.phpt │ └── cairo_matrix_init_translate.phpt ├── Cairo │ ├── version.phpt │ ├── versionString.phpt │ ├── availableFonts.phpt │ └── availableSurfaces.phpt ├── cairo_status_to_string.phpt └── cairo_phpinfo.phpt ├── examples ├── info.php ├── romedalen.png ├── temp1-expected.png ├── temp2-expected.png ├── sphere-expected.png ├── surface-check.php ├── create-from-png-ref.png ├── dash-curve-expected.png ├── image_dash-expected.png ├── long-lines-expected.png ├── pdf-surface-source.pdf ├── self-copy-expected.png ├── a1-mask-php-expected.png ├── a8-mask-php-expected.png ├── big-line-php-expected.png ├── clip-all-php-expected.png ├── fill-rule-php-expected.png ├── mask-ctm-php-expected.png ├── source-clip-expected.png ├── text-extents-expected.png ├── bitmap-font-php-expected.png ├── caps-joins-php-expected.png ├── clip-empty-php-expected.png ├── clip-twice-php-expected.png ├── close-path-php-expected.png ├── dash-scale-php-expected.png ├── degenerate-arc-expected.png ├── extend-pad-php-expected.png ├── group-paint-php-expected.png ├── large-font-php-expected.png ├── set-source-php-expected.png ├── bilevel-image-php-expected.png ├── caps-sub-paths-php-expected.png ├── clip-fill-rule-php-expected.png ├── clip-nesting-php-expected.png ├── clip-operator-php-expected.png ├── degenerate-pen-php-expected.png ├── device-offset-php-expected.png ├── extend-reflect-php-expected.png ├── extend-repeat-php-expected.png ├── gradient-alpha-php-expected.png ├── infinite-join-php-expected.png ├── large-source-php-expected.png ├── operator-clear-php-expected.png ├── reflected-stroke-expected.png ├── self-intersecting-expected.png ├── a1-image-sample-php-expected.png ├── a1-traps-sample-php-expected.png ├── clip-push-group-php-expected.png ├── create-from-png-php-expected.png ├── dash-caps-joins-php-expected.png ├── degenerate-path-php-expected.png ├── fill-and-stroke-php-expected.png ├── fill-missed-stop-php-expected.png ├── get-group-target-php-expected.png ├── line-width-scale-php-expected.png ├── mask-surface-ctm-php-expected.png ├── miter-precision-php-expected.png ├── operator-source-php-expected.png ├── select-font-face-php-expected.png ├── gradient-zero-stops-php-expected.png ├── over-above-source-php-expected.png ├── over-between-source-php-expected.png ├── paint-source-alpha-php-expected.png ├── pdf-surface-source-php-expected.png ├── ps-surface-source-php-expected.png ├── random-intersection-php-expected.png ├── rectilinear-stroke-php-expected.png ├── extend-repeat-similar-php-expected.png ├── meta-surface-pattern-php-expected.png ├── move-to-show-surface-php-expected.png ├── create-from-png-stream-php-expected.png ├── device-offset-positive-php-expected.png ├── filter-bilinear-extents-php-expected.png ├── finer-grained-fallbacks-php-expected.png ├── font-matrix-translation-php-expected.png ├── leaky-dashed-rectangle-php-expected.png ├── linear-gradient-reflect-php-expected.png ├── rectangle-rounding-error-php-expected.png ├── show-text-current-point-php-expected.png ├── fill-degenerate-sort-order-php-expected.png ├── rotate-image-surface-paint-php-expected.png ├── scale-source-surface-paint-php-expected.png ├── scale-down-source-surface-paint-php-expected.png ├── composite-integer-translate-over-php-expected.png ├── composite-integer-translate-source-php-expected.png ├── composite-integer-translate-over-repeat-php-expected.png ├── gradient-alpha.php ├── group-paint.php ├── create-from-png.php ├── create-from-png-stream.php ├── fill-missed-stop.php ├── gradient-zero-stops.php ├── large-font.php ├── extend-reflect.php ├── fill-and-stroke.php ├── extend-repeat.php ├── clip-push-group.php ├── caps-sub-paths.php ├── nil-surface.php ├── leaky-dash.php ├── fill-degenerate-sort-order.php ├── clip-empty.php ├── composite-integer-translate-over.php ├── composite-integer-translate-source.php ├── dashes.php ├── show-text-current-point.php ├── rectangle-rounding-error.php ├── close-path.php ├── big-line.php ├── linear-gradient-reflect.php ├── infinite-join.php ├── get-group-target.php ├── text-extents.php ├── filter-bilinear-extents.php ├── device-offset.php ├── extend-repeat-similar.php ├── sphere.php ├── over-above-source.php ├── a1-traps-sample.php ├── device-offset-positive.php ├── a8-mask.php ├── clip-all.php ├── dash-curve.php ├── mask-ctm.php ├── self-intersecting.php ├── mask-surface-ctm.php ├── degenerate-arc.php ├── clip-fill-rule.php ├── source-clip.php ├── a1-mask.php ├── over-between-source.php ├── set-source.php ├── move-to-show.php ├── composite-integer-translate-over-repeat.php ├── clip-nesting.php ├── clip-twice.php ├── miter-precision.php ├── select-font-face.php ├── random-intersections.php ├── large-source.php ├── long-lines.php ├── a1-image-sample.php ├── bilevel-image.php ├── fill-rule.php └── font-matrix-translation.php ├── TODO ├── cairo_context.c ├── CREDITS ├── README ├── CHANGELOG └── .gitignore /tests/CairoFontFace/CairoFtFontFace/broken.ttf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/info.php: -------------------------------------------------------------------------------- 1 | 7 | --FILE-- 8 | 11 | --EXPECTF-- -------------------------------------------------------------------------------- /tests/CairoContext/Paths/glyphPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->glyphPath() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECTF-- -------------------------------------------------------------------------------- /examples/gradient-alpha.php: -------------------------------------------------------------------------------- 1 | addColorStopRgba(0,1,0,0,1); 7 | $pat->addColorStopRgba(1,0,0,1,0.5); 8 | $con->setSource($pat); 9 | $con->paint(); 10 | 11 | $sur->writeToPng(dirname(__FILE__) . "/gradient-alpha-php.png"); 12 | ?> 13 | -------------------------------------------------------------------------------- /examples/group-paint.php: -------------------------------------------------------------------------------- 1 | pushGroup(); 6 | $con->setSourceRgb(0,0,1); 7 | $con->paint(); 8 | 9 | $con->popGroupToSource(); 10 | $con->setOperator(CairoOperator::SOURCE); 11 | $con->paint(); 12 | 13 | $sur->writeToPng(dirname(__FILE__) . "/group-paint-php.png"); 14 | ?> 15 | 16 | -------------------------------------------------------------------------------- /examples/create-from-png.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) ."/create-from-png-ref.png"); 7 | $con->setSourceSurface($s); 8 | $con->paint(); 9 | 10 | $sur->writeToPng(dirname(__FILE__) . "/create-from-png-php.png"); 11 | ?> 12 | -------------------------------------------------------------------------------- /tests/cairo_version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_version() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 14 | --EXPECTF-- 15 | int(%d) 16 | 17 | Warning: cairo_version() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoFontFace/create_toyfont.inc: -------------------------------------------------------------------------------- 1 | selectFontFace('sans-serif'); 8 | $fontface = $context->getFontFace(); 9 | unset($surface, $context); 10 | } -------------------------------------------------------------------------------- /tests/CairoScaledFont/create_toyfont.inc: -------------------------------------------------------------------------------- 1 | selectFontFace('sans-serif'); 8 | $fontface = $context->getFontFace(); 9 | unset($surface, $context); 10 | } -------------------------------------------------------------------------------- /tests/CairoContext/Text/create_toyfont.inc: -------------------------------------------------------------------------------- 1 | selectFontFace('sans-serif'); 8 | //$fontface = $context->getFontFace(); 9 | //unset($surface, $context); 10 | } -------------------------------------------------------------------------------- /examples/create-from-png-stream.php: -------------------------------------------------------------------------------- 1 | createFromPng($file); 7 | $con->setSourceSurface($s); 8 | $con->paint(); 9 | 10 | $sur->writeToPng(dirname(__FILE__) . "/create-from-png-stream-php.png"); 11 | ?> 12 | -------------------------------------------------------------------------------- /examples/fill-missed-stop.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,0,0); 6 | $con->translate(1,1); 7 | $con->moveTo(0,0); 8 | $con->lineTo(25,50); 9 | $con->lineTo(25,0); 10 | $con->lineTo(50,25); 11 | $con->lineTo(0,25); 12 | $con->closePath(); 13 | $con->fill(); 14 | $sur->writeToPng(dirname(__FILE__) . "/fill-missed-stop-php.png"); 15 | ?> 16 | 17 | -------------------------------------------------------------------------------- /examples/gradient-zero-stops.php: -------------------------------------------------------------------------------- 1 | setSource($pat); 7 | $con->paint(); 8 | 9 | unset($pat); 10 | 11 | $pat = new CairoRadialGradient(0,0,0,1,1,1); 12 | $con->setSource($pat); 13 | $con->paint(); 14 | 15 | $sur->writeToPng(dirname(__FILE__) . "/gradient-zero-stops-php.png"); 16 | ?> 17 | 18 | -------------------------------------------------------------------------------- /tests/cairo_version_string.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_version_string() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 14 | --EXPECTF-- 15 | string(%d) %s 16 | 17 | Warning: cairo_version_string() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /examples/large-font.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,1,1); 7 | $con->paint(); 8 | $con->selectFontFace("Bitstream Vera Sans"); 9 | $con->setFontSize(10000); 10 | $con->setSourceRgb(0,0,0); 11 | $con->moveTo(-5000, 5000); 12 | $con->showText("xW"); 13 | 14 | $sur->writeToPng(dirname(__FILE__) . "/large-font-php.png"); 15 | ?> 16 | -------------------------------------------------------------------------------- /examples/extend-reflect.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) ."/romedalen.png"); 7 | 8 | $con->setSourceSurface($s,32,32); 9 | 10 | $pat = $con->getSource(); 11 | $pat->setExtend(CairoExtend::REFLECT); 12 | $con->paint(); 13 | 14 | $sur->writeToPng(dirname(__FILE__) . "/extend-reflect-php.png"); 15 | ?> 16 | -------------------------------------------------------------------------------- /tests/CairoPattern/CairoExtend_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoExtend class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 20 | --EXPECT-- 21 | bool(true) 22 | bool(true) 23 | bool(true) 24 | bool(true) -------------------------------------------------------------------------------- /tests/CairoFontOptions/CairoHintMetrics_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoHintMetrics class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECT-- 20 | bool(true) 21 | bool(true) 22 | bool(true) -------------------------------------------------------------------------------- /examples/fill-and-stroke.php: -------------------------------------------------------------------------------- 1 | rectangle(2,2,10,10); 5 | $con->setSourceRgb(0,0,1); 6 | $con->fillPreserve(); 7 | $con->setSourceRgb(1,0,0); 8 | $con->stroke(); 9 | 10 | $con->translate(14,0); 11 | $con->arc(7, 7, 5, 0, 2*M_PI); 12 | $con->fillPreserve(); 13 | $con->setSourceRgb(0,0,1); 14 | $con->stroke(); 15 | 16 | $sur->writeToPng(dirname(__FILE__) . "/fill-and-stroke-php.png"); 17 | ?> 18 | 19 | -------------------------------------------------------------------------------- /tests/CairoPattern/CairoPatternType_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPatternType class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 20 | --EXPECT-- 21 | bool(true) 22 | bool(true) 23 | bool(true) 24 | bool(true) -------------------------------------------------------------------------------- /examples/extend-repeat.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) . "/romedalen.png"); 6 | $con->setSourceSurface($s,32,32); 7 | $pat = $con->getSource(); 8 | $pat->setExtend(CairoExtend::REPEAT); 9 | $con->setSource($pat); 10 | $con->paint(); 11 | 12 | $sur->writeToPng(dirname(__FILE__) . "/extend-repeat-php.png"); 13 | ?> 14 | 15 | -------------------------------------------------------------------------------- /examples/clip-push-group.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,0,0); 9 | $con->paint(); 10 | 11 | $con->arc($size/2, $size/2, $size/2 - $pad, 0, 2*M_PI); 12 | $con->clip(); 13 | $con->pushGroup(); 14 | $con->setSourceRgb(0,0,1); 15 | $con->paint(); 16 | $con->popGroupToSource(); 17 | $con->paint(); 18 | 19 | $sur->writeToPng(dirname(__FILE__) . "/clip-push-group-php.png"); 20 | ?> 21 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/glyphExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->glyphExtents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 18 | --EXPECTF-- -------------------------------------------------------------------------------- /tests/cairo_available_fonts.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_available_fonts() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 15 | --EXPECTF-- 16 | bool(true) 17 | string(%d) %s 18 | 19 | Warning: cairo_available_fonts() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoToyFontFace/getFamily.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoToyFontFace::getFamily() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | getFamily()); 13 | ?> 14 | --EXPECTF-- 15 | string(10) "sans-serif" 16 | -------------------------------------------------------------------------------- /tests/cairo_available_surfaces.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_available_surfaces() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 15 | --EXPECTF-- 16 | bool(true) 17 | string(5) "IMAGE" 18 | 19 | Warning: cairo_available_surfaces() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /examples/caps-sub-paths.php: -------------------------------------------------------------------------------- 1 | save(); 6 | $con->setSourceRgb(1,1,1); 7 | $con->paint(); 8 | $con->restore(); 9 | 10 | $con->setLineWidth(4); 11 | $con->setLineCap(CairoLineCap::ROUND); 12 | $con->moveTo(4,4); 13 | $con->lineTo(4,16); 14 | $con->moveTo(10,4); 15 | $con->lineTo(10,16); 16 | $con->moveTo(16,4); 17 | $con->lineTo(16,16); 18 | 19 | $con->stroke(); 20 | $sur->writeToPng(dirname(__FILE__) . "/caps-sub-paths-php.png"); 21 | ?> 22 | -------------------------------------------------------------------------------- /tests/CairoFontOptions/cairo_font_options_create.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_font_options_create() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 15 | --EXPECTF-- 16 | object(CairoFontOptions)#%d (0) { 17 | } 18 | 19 | Warning: cairo_font_options_create() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoMatrix/cairo_matrix_init_identity.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_matrix_init_identity function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 15 | --EXPECTF-- 16 | object(CairoMatrix)#%d (0) { 17 | } 18 | 19 | Warning: cairo_matrix_init_identity() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoScaledFont/cairo_scaled_font_glyph_extents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_scaled_font_glyph_extents() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECT-- -------------------------------------------------------------------------------- /examples/nil-surface.php: -------------------------------------------------------------------------------- 1 | createFromPng('__THIS_FILE_DOES_NOT_EXIST'); 8 | 9 | $pat = new CairoSurfacePattern($s); 10 | $con2->setSource($pat); 11 | $con2->paint(); 12 | 13 | $con2=$con->getTarget(); 14 | $pat = new CairoSurfacePattern(NULL); 15 | $con2->setSource($pat); 16 | $con2->paint(); 17 | 18 | $sur->writeToPng(dirname(__FILE__) . '/nil-surface-php.png'); -------------------------------------------------------------------------------- /tests/Cairo/version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Cairo::version() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 18 | } 19 | ?> 20 | --EXPECTF-- 21 | int(%d) 22 | Cairo::version() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontOptions/CairoHintStyle_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoHintStyle class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 21 | --EXPECT-- 22 | bool(true) 23 | bool(true) 24 | bool(true) 25 | bool(true) 26 | bool(true) -------------------------------------------------------------------------------- /examples/leaky-dash.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1, 1, 1); 9 | $con->paint(); 10 | 11 | $con->setSourceRgb(0., 0., 0); 12 | 13 | $con->setLineWidth(2); /* This is vital to reproduce the bug. */ 14 | 15 | /* First check simple rectangles */ 16 | $con->rectangle(2,2,67,24); 17 | 18 | $con->setDash($dash, 9.0); 19 | $con->stroke(); 20 | 21 | $sur->writeToPng(dirname(__FILE__) . '/leaky-dash.png'); -------------------------------------------------------------------------------- /tests/CairoPattern/CairoSurfacePattern/CairoFilter_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFilter class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 22 | --EXPECT-- 23 | bool(true) 24 | bool(true) 25 | bool(true) 26 | bool(true) 27 | bool(true) 28 | bool(true) -------------------------------------------------------------------------------- /examples/fill-degenerate-sort-order.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,0,0); 6 | $con->moveTo(43,103); 7 | $con->lineTo(91,101); 8 | $con->lineTo(0,112); 9 | $con->lineTo(60,0); 10 | $con->lineTo(91,101); 11 | $con->lineTo(43,103); 12 | $con->lineTo(176,110); 13 | $con->lineTo(116,100); 14 | $con->lineTo(176,0); 15 | $con->lineTo(176,110); 16 | $con->closePath(); 17 | $con->fill(); 18 | $sur->writeToPng(dirname(__FILE__) . "/fill-degenerate-sort-order-php.png"); 19 | ?> 20 | 21 | -------------------------------------------------------------------------------- /tests/Cairo/versionString.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Cairo::versionString() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 18 | } 19 | ?> 20 | --EXPECTF-- 21 | string(%d) %s 22 | Cairo::versionString() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSvgSurface/cairo_svg_get_versions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_svg_get_versions() function 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 14 | --EXPECTF-- 15 | array(2) { 16 | [0]=> 17 | int(0) 18 | [1]=> 19 | int(1) 20 | } 21 | 22 | Warning: cairo_svg_get_versions() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoMatrix/invert.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoMatrix->invert method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | invert(); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $matrix->invert('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoMatrix)#%d (0) { 24 | } 25 | CairoMatrix::invert() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoMatrix/initIdentity.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoMatrix::initIdentity method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 18 | } 19 | ?> 20 | --EXPECTF-- 21 | object(CairoMatrix)#%d (0) { 22 | } 23 | CairoMatrix::initIdentity() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/clip-empty.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,1); 5 | $con->paint(); 6 | 7 | $con->resetClip(); 8 | $con->clip(); 9 | 10 | $con->translate(0.5,0.5); 11 | 12 | $con->setSourceRgb(0,1,0); 13 | $con->rectangle(0,0,10,10); 14 | $con->fillPreserve(); 15 | $con->setSourceRgb(1,0,0); 16 | $con->stroke(); 17 | $con->selectFontFace("Bitstream Vera Sans", CairoFontSlant::NORMAL, CairoFontWeight::NORMAL); 18 | $con->moveTo(0,10); 19 | $con->showText("cairo"); 20 | $sur->writeToPng(dirname(__FILE__) . "/clip-empty-php.png"); 21 | ?> 22 | -------------------------------------------------------------------------------- /examples/composite-integer-translate-over.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) . "/romedalen.png"); 7 | 8 | $con->setSourceRgb(0,0,0); 9 | $con->rectangle(0,0,100,100); 10 | $con->fill(); 11 | 12 | $con->translate(10,10); 13 | $con->setOperator(CairoOperator::OVER); 14 | $con->setSourceSurface($s,0,0); 15 | $con->rectangle(0,0,90,90); 16 | $con->fill(); 17 | $sur->writeToPng(dirname(__FILE__) . "/composite-integer-translate-over-php.png"); 18 | ?> 19 | 20 | -------------------------------------------------------------------------------- /examples/composite-integer-translate-source.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) . "/romedalen.png"); 7 | 8 | $con->setSourceRgb(0,0,0); 9 | $con->rectangle(0,0,100,100); 10 | $con->fill(); 11 | 12 | $con->translate(10,10); 13 | $con->setOperator(CairoOperator::SOURCE); 14 | $con->setSourceSurface($s,0,0); 15 | $con->rectangle(0,0,90,90); 16 | $con->fill(); 17 | $sur->writeToPng(dirname(__FILE__) . "/composite-integer-translate-source-php.png"); 18 | ?> 19 | 20 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | 2010-02-02 Michael Maclean 2 | * Complete Freetype font support 3 | 4 | 2009-07-27 Michael Maclean 5 | * Add the beginnings of support for FreeType fonts 6 | 7 | 2009-07-17 Michael Maclean 8 | 9 | * Change types in cairo_set_* operators to long to avoid segfaults on 10 | 64-bit machines 11 | 12 | 2009-07-15 Michael Maclean 13 | 14 | * Fix a bug in CairoImageSurface::getData/cairo_image_surface_get_data, 15 | which caused it to return the wrong length of string. String length now 16 | calculated based on stride and height 17 | -------------------------------------------------------------------------------- /tests/CairoContext/getTarget.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getTarget() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getTarget(); 16 | var_dump($surface2); 17 | var_dump($surface2 == $surface); 18 | ?> 19 | --EXPECTF-- 20 | object(CairoImageSurface)#%d (0) { 21 | } 22 | object(CairoContext)#%d (0) { 23 | } 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | bool(true) -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoToyFontFace/getSlant.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoToyFontFace::getSlant() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | getSlant()); 13 | 14 | $c = new CairoToyFontFace("sans-serif", CairoFontSlant::ITALIC, CairoFontWeight::NORMAL); 15 | var_dump($c->getSlant()); 16 | ?> 17 | --EXPECTF-- 18 | int(0) 19 | int(1) 20 | -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoToyFontFace/getWeight.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoToyFontFace::getWeight() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | getWeight()); 13 | 14 | $c = new CairoToyFontFace("sans-serif", CairoFontWeight::NORMAL, CairoFontWeight::BOLD); 15 | var_dump($c->getWeight()); 16 | ?> 17 | --EXPECTF-- 18 | int(0) 19 | int(1) 20 | -------------------------------------------------------------------------------- /tests/CairoFontOptions/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoFontOptions [ __construct() method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 18 | } 19 | ?> 20 | --EXPECTF-- 21 | object(CairoFontOptions)#%d (0) { 22 | } 23 | CairoFontOptions::__construct() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/cairo_get_target.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_get_target function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECTF-- 20 | object(CairoImageSurface)#%d (0) { 21 | } 22 | object(CairoContext)#%d (0) { 23 | } 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | bool(true) -------------------------------------------------------------------------------- /tests/CairoSurface/flush.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->flush() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | flush(); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->flush('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | CairoSurface::flush() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/dashes.php: -------------------------------------------------------------------------------- 1 | setDash ($dashes, $offset); 12 | $con->setLineWidth (10.0); 13 | $con->moveTo (128.0, 25.6); 14 | $con->lineTo ( 230.4, 230.4); 15 | $con->relLineTo ( -102.4, 0.0); 16 | $con->curveTo ( 51.2, 230.4, 51.2, 128.0, 128.0, 128.0); 17 | $con->stroke (); 18 | $sur->writeToPng(dirname(__FILE__) . "/image_dash.png"); 19 | ?> 20 | -------------------------------------------------------------------------------- /tests/Cairo/availableFonts.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Cairo::availableFonts() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 19 | } 20 | ?> 21 | --EXPECTF-- 22 | bool(true) 23 | string(%d) %s 24 | Cairo::availableFonts() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontOptions/hash.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->hash() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | hash()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $options->hash('foo'); 17 | trigger_error('hash requires no args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoFontOptions)#%d (0) { 24 | } 25 | int(0) 26 | CairoFontOptions::hash() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/finish.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->finish() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | finish(); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->finish('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | CairoSurface::finish() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/getType.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontFace->getType() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getType()); 13 | 14 | try { 15 | $fontface->getType('foo'); 16 | trigger_error('CairoFontFace->getType requires no arguments'); 17 | } catch (CairoException $e) { 18 | echo $e->getMessage(); 19 | } 20 | ?> 21 | --EXPECTF-- 22 | object(CairoToyFontFace)#%d (0) { 23 | } 24 | int(0) 25 | CairoFontFace::getType() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/show-text-current-point.php: -------------------------------------------------------------------------------- 1 | save(); 5 | $con->setSourceRgb ( 1.0, 1.0, 1.0); /* white */ 6 | $con->paint(); 7 | $con->restore(); 8 | 9 | $con->selectFontFace('Bitstream Vera Sans', 10 | CairoFontSlant::NORMAL, 11 | CairoFontWeight::NORMAL); 12 | $con->setFontSize(12); 13 | $con->setSourceRgb( 0, 0, 0); /* black */ 14 | 15 | $con->moveTo(0, 12); 16 | $con->showText('Hello from the '); 17 | $con->showText('show-text-current-point-php'); 18 | $con->showText(' test.'); 19 | $sur->writeToPng(dirname(__FILE__) . '/show-text-current-point.png'); -------------------------------------------------------------------------------- /tests/CairoContext/clip.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->clip() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | clip(); 16 | try { 17 | $context->clip('foo'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(); 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | object(CairoContext)#%d (0) { 26 | } 27 | CairoContext::clip() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/markDirty.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->markDirty() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | markDirty(); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->markDirty('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | CairoSurface::markDirty() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/rectangle-rounding-error.php: -------------------------------------------------------------------------------- 1 | setSourceRgb ( 1, 1, 1); 6 | $con->paint (); 7 | $con->setAntialias (CairoAntialias::MODE_NONE); 8 | $con->setSourceRgb ( 0, 0, 0); 9 | 10 | $con->translate( -300, -300); 11 | $con->scale( 677.0/26, 677.0/26); 12 | $con->translate( 1, 1); 13 | $con->rectangle( 11, 11, 1, 1); 14 | $con->rectangle( 11, 12, 1, 1); 15 | $con->rectangle( 12, 11, 1, 1); 16 | $con->rectangle( 12, 12, 1, 1); 17 | $con->setSourceRgb( 0, 0, 0); 18 | $con->fill(); 19 | 20 | $sur->writeToPng(dirname(__FILE__) . "/rectangle-rounding-error-php.png"); 21 | ?> 22 | 23 | -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/cairo_ps_get_levels.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_ps_get_levels() function 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 15 | --EXPECTF-- 16 | array(2) { 17 | [0]=> 18 | int(0) 19 | [1]=> 20 | int(1) 21 | } 22 | 23 | Warning: cairo_ps_get_levels() expects exactly 0 parameters, 1 given in %s on line %d -------------------------------------------------------------------------------- /examples/close-path.php: -------------------------------------------------------------------------------- 1 | save(); 6 | $con->setSourceRgb(1,1,1); 7 | $con->paint(); 8 | $con->restore(); 9 | 10 | $con->arc(8, 8, 4, 0, M_PI); 11 | $con->closePath(); 12 | $con->arc(8,8,4,M_PI,2*M_PI); 13 | $con->fill(); 14 | 15 | $con->translate(16,0); 16 | $con->moveTo(8,4); 17 | $con->arcNegative(8,8,4,3*M_PI/2,M_PI/2); 18 | $con->closePath(); 19 | $con->curveTo(12,4,12,12,8,12); 20 | 21 | $path = $con->copyPathFlat(); 22 | $con->newPath(); 23 | $con->appendPath($path); 24 | $con->fill(); 25 | 26 | $sur->writeToPng(dirname(__FILE__) . "/close-path-php.png"); 27 | ?> 28 | 29 | -------------------------------------------------------------------------------- /tests/Cairo/availableSurfaces.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Cairo::availableSurfaces() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 19 | } 20 | ?> 21 | --EXPECTF-- 22 | bool(true) 23 | string(5) "IMAGE" 24 | Cairo::availableSurfaces() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoFontWeight_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontWeight class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 27 | --EXPECT-- 28 | No missing constants, checked 2! 29 | Done -------------------------------------------------------------------------------- /tests/CairoSurface/getType.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->getType() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getType()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getType('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(0) 26 | CairoSurface::getType() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/big-line.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,1); 8 | $con->moveTo(50,50); 9 | $con->lineTo(50000,50000); 10 | $con->stroke(); 11 | 12 | $con->setSourceRgb(0,1,0); 13 | $con->moveTo(50,50); 14 | $con->lineTo(-50000,50000); 15 | $con->stroke(); 16 | 17 | $con->setSourceRgb(1,0,0); 18 | $con->moveTo(50,50); 19 | $con->lineTo(50000,-50000); 20 | $con->stroke(); 21 | 22 | $con->setSourceRgb(1,1,0); 23 | $con->moveTo(50,50); 24 | $con->lineTo(-50000,-50000); 25 | $con->stroke(); 26 | 27 | $sur->writeToPng(dirname(__FILE__) . "/big-line-php.png"); 28 | ?> 29 | -------------------------------------------------------------------------------- /examples/linear-gradient-reflect.php: -------------------------------------------------------------------------------- 1 | setSourceRgb ( 0.5, 0.5, 0.5); 8 | $con->paint (); 9 | $con->save (); 10 | $pattern = new CairoLinearGradient(0, 0, 10.0, 0); 11 | $pattern->addColorStopRgb ( 0.0, 0.0, 0.0, 1.0); 12 | $pattern->addColorStopRgb ( 1.0,1.0, 0.0, 0.0); 13 | $pattern->setExtend (CairoExtend::REFLECT); 14 | $con->setSource ($pattern); 15 | $con->rectangle ( 0.0, 0.0, $width, $height); 16 | $con->fill (); 17 | $con->restore (); 18 | 19 | $sur->writeToPng(dirname(__FILE__) . "/linear-gradient-reflect-php.png"); 20 | ?> 21 | 22 | -------------------------------------------------------------------------------- /tests/CairoContext/copyPage.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->copyPage() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | copyPage(); 16 | try { 17 | $context->copyPage('foo'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(); 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | object(CairoContext)#%d (0) { 26 | } 27 | CairoContext::copyPage() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoFontSlant_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontSlant class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 26 | --EXPECT-- 27 | No missing constants, checked 3! 28 | Done -------------------------------------------------------------------------------- /examples/infinite-join.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,1,1); 6 | $con->paint(); 7 | 8 | $con->setSourceRgb(0,0,0); 9 | $con->setLineJoin(CairoLineJoin::ROUND); 10 | $con->scale(20.0/100.0, 20/100.); 11 | $con->scale(1./20, 1./20); 12 | $con->setLineWidth(20); 13 | $con->translate ( -18300, -13200); 14 | 15 | $con->newPath (); 16 | $con->moveTo ( 18928, 13843); 17 | $con->lineTo ( 18500, 13843); 18 | $con->lineTo ( 18500, 13400); 19 | $con->lineTo ( 18928, 13400); 20 | $con->lineTo ( 18928, 13843); 21 | $con->stroke (); 22 | $sur->writeToPng(dirname(__FILE__) . "/infinite-join-php.png"); 23 | ?> 24 | 25 | -------------------------------------------------------------------------------- /examples/get-group-target.php: -------------------------------------------------------------------------------- 1 | save(); 5 | $con->setSourceRgb(0,0,1); 6 | $con->paint(); 7 | 8 | $con->rectangle(2,2,4,4); 9 | $con->clip(); 10 | $con->setSourceRgb(1,0,0); 11 | $con->paint(); 12 | $con->restore(); 13 | $con->pushGroup(); 14 | $s = $con->getGroupTarget(); 15 | 16 | $con->setSourceRgb(0,1,0); 17 | $con->fill(); 18 | $off = $s->getDeviceOffset(); 19 | $te = $off["x"]; 20 | echo $te; 21 | $con->rectangle(2, 2, 4, 4); 22 | $con->fill(); 23 | $con->popGroupToSource(); 24 | $con->paint(); 25 | 26 | $sur->writeToPng(dirname(__FILE__) . "/get-group-target-php.png"); 27 | 28 | ?> 29 | 30 | -------------------------------------------------------------------------------- /examples/text-extents.php: -------------------------------------------------------------------------------- 1 | selectFontFace('Sans'); 7 | $con->setFontSize(100); 8 | $ext = $con->textExtents($char); 9 | 10 | $x = 25.0; 11 | $y = 150.0; 12 | $con->moveTo($x, $y); 13 | $con->showText($char); 14 | 15 | $con->setSourceRgba(1,0.2,0.2,0.6); 16 | $con->setLineWidth(6.0); 17 | $con->arc($x, $y, 10, 0, 2*3.14); 18 | $con->fill(); 19 | $con->moveTo($x, $y); 20 | $con->relLineTo(0, -1*$ext['height']); 21 | $con->relLineTo($ext['width'], 0); 22 | $con->relLineTo($ext['x_bearing'], -1*$ext['y_bearing']); 23 | $con->stroke(); 24 | $sur->writeToPng(dirname(__FILE__) . '/text-extents.png'); -------------------------------------------------------------------------------- /tests/CairoFontOptions/getAntialias.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->getAntialias() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getAntialias()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $options->getAntialias('foo'); 17 | trigger_error('getAntialias requires no args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoFontOptions)#%d (0) { 24 | } 25 | int(0) 26 | CairoFontOptions::getAntialias() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontOptions/getHintStyle.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->getHintStyle() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getHintStyle()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $options->getHintStyle('foo'); 17 | trigger_error('getHintStyle requires no args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoFontOptions)#%d (0) { 24 | } 25 | int(0) 26 | CairoFontOptions::getHintStyle() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/getContent.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->getContent() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getContent()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getContent('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(12288) 26 | CairoSurface::getContent() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoContent_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContent class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 28 | --EXPECTF-- 29 | No missing constants, checked %d! 30 | Done -------------------------------------------------------------------------------- /examples/filter-bilinear-extents.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,0,0); 7 | $con2->paint(); 8 | $con2->setSourceRgb(0,0,1); 9 | $con2->rectangle(0,1,1,1); 10 | $con2->rectangle(1,0,1,1); 11 | $con2->fill(); 12 | $con->setSourceRgb(0,0,0); 13 | $con->paint(); 14 | $con->save(); 15 | $con->translate(3,3); 16 | $con->scale(10,10); 17 | $con->translate(0.5,0.5); 18 | $con->setSourceSurface($s,0,0); 19 | $con->paint(); 20 | $con->restore(); 21 | $sur->writeToPng(dirname(__FILE__) . "/filter-bilinear-extents-php.png"); 22 | ?> 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/CairoFontOptions/getHintMetrics.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->getHintMetrics() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getHintMetrics()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $options->getHintMetrics('foo'); 17 | trigger_error('getHintMetrics requires no args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoFontOptions)#%d (0) { 24 | } 25 | int(0) 26 | CairoFontOptions::getHintMetrics() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/getWidth.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoImageSurface->getWidth() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getWidth()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getWidth('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(50) 26 | CairoImageSurface::getWidth() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/clipPreserve.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->clipPreserve() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | clipPreserve(); 16 | 17 | try { 18 | $context->clipPreserve('foo'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(); 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | object(CairoContext)#%d (0) { 27 | } 28 | CairoContext::clipPreserve() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoMatrix/matrix_extended_class.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | extend CairoMatrix Class 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | invert(); 20 | echo 'First call to any method should throw a fatal error'; 21 | ?> 22 | --EXPECTF-- 23 | object(CairoMatrix)#%d (0) { 24 | } 25 | 26 | Fatal error: Internal matrix object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/getFormat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoImageSurface->getFormat() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFormat()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getFormat('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(0) 26 | CairoImageSurface::getFormat() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/getHeight.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoImageSurface->getHeight() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getHeight()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getHeight('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(50) 26 | CairoImageSurface::getHeight() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getTarget_errors.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getTarget() error conditions 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getTarget('foobar'); 17 | echo 'Exception not thrown properly'; 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(); 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | object(CairoContext)#%d (0) { 26 | } 27 | CairoContext::getTarget() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontOptions/getSubpixelOrder.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->getSubpixelOrder() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getSubpixelOrder()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $options->getSubpixelOrder('foo'); 17 | trigger_error('getSubpixelOrder requires no args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoFontOptions)#%d (0) { 24 | } 25 | int(0) 26 | CairoFontOptions::getSubpixelOrder() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/CairoFormat_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFormat class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 29 | --EXPECTF-- 30 | No missing constants, checked %d! 31 | Done -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/getStride.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoImageSurface->getStride() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getStride()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getStride('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(200) 26 | CairoImageSurface::getStride() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/getData.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoImageSurface->getData() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getData())); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getData('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | int(10000) 26 | CairoImageSurface::getData() expects exactly 0 parameters, 1 given 27 | -------------------------------------------------------------------------------- /examples/device-offset.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,1); 8 | $con->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad); 9 | $con->fill(); 10 | 11 | $s = $con->getGroupTarget(); 12 | $c = $s->getContent(); 13 | $s1 = $s->createSimilar($c, $size/2, $size/2); 14 | 15 | $s1->setDeviceOffset($size/-2, $size/-2); 16 | 17 | $c = new CairoContext($s1); 18 | $c->setSourceRgb(1,0,0); 19 | $c->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad); 20 | $c->fill(); 21 | 22 | $con->setSourceSurface($s1, 0, 0); 23 | $con->paint(); 24 | 25 | $sur->writeToPng(dirname(__FILE__) . "/device-offset-php.png"); 26 | 27 | ?> 28 | -------------------------------------------------------------------------------- /examples/extend-repeat-similar.php: -------------------------------------------------------------------------------- 1 | createFromPng(dirname(__FILE__) . "/romedalen.png"); 6 | //$s1 = new CairoImageSurface(FORMATARGB32,100, 100); 7 | $s1 = $sur->createSimilar($sur->getContent(), 320, 256); 8 | $con2 = new CairoContext($s1); 9 | $con2->setSourceSurface($s, 32 ,32); 10 | $con2->setOperator(CairoOperator::SOURCE); 11 | $pat = $con2->getSource(); 12 | $pat->setExtend(CairoExtend::REPEAT); 13 | $con2->paint(); 14 | $con->setSourceSurface($s1, 0, 0); 15 | $con->paint(); 16 | $sur->writeToPng(dirname(__FILE__) . "/extend-repeat-similar-php.png"); 17 | ?> 18 | 19 | -------------------------------------------------------------------------------- /examples/sphere.php: -------------------------------------------------------------------------------- 1 | setAntialias(0); 5 | $ctx->setFillRule(0); 6 | $ctx->scale(256/1.0, 256/1.0); 7 | 8 | $pat = new CairoLinearGradient(0.0, 0.0, 0.0, 1.0); 9 | $pat->addColorStopRgba(1, 0, 0, 0, 1); 10 | $pat->addColorStopRgba(0, 1, 1, 1, 1); 11 | $ctx->rectangle(0,0,1,1); 12 | $ctx->setSource($pat); 13 | $ctx->fill(); 14 | 15 | $pat = new CairoRadialGradient(0.45, 0.4, 0.1, 0.4, 0.4, 0.5); 16 | $pat->addColorStopRgba(0, 1, 1, 1, 1); 17 | $pat->addColorStopRgba(1, 0, 0, 0, 1); 18 | $ctx->setSource($pat); 19 | $ctx->arc(.5, .5, .3, 0, 2*3.14); 20 | $ctx->fill(); 21 | 22 | $check = $ctx->getTarget(); 23 | $check->writeToPng(dirname(__FILE__) . '/sphere.png'); -------------------------------------------------------------------------------- /tests/CairoSurface/getFontOptions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->getFontOptions() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFontOptions()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getFontOptions('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | object(CairoFontOptions)#%d (0) { 26 | } 27 | CairoSurface::getFontOptions() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontOptions/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontOptions->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 13 | var_dump($status); 14 | var_dump($status == CairoStatus::SUCCESS); 15 | 16 | /* Wrong number args */ 17 | try { 18 | $options->status('foo'); 19 | trigger_error('status requires no args'); 20 | } catch (CairoException $e) { 21 | echo $e->getMessage(), PHP_EOL; 22 | } 23 | ?> 24 | --EXPECTF-- 25 | object(CairoFontOptions)#%d (0) { 26 | } 27 | int(0) 28 | bool(true) 29 | CairoFontOptions::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSvgSurface/getVersions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSvgSurface::getVersions() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | getMessage(), PHP_EOL; 18 | } 19 | ?> 20 | --EXPECTF-- 21 | array(2) { 22 | [0]=> 23 | int(0) 24 | [1]=> 25 | int(1) 26 | } 27 | CairoSvgSurface::getVersions() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/over-above-source.php: -------------------------------------------------------------------------------- 1 | translate($pad, $pad); 10 | $con->moveTo($size/2, $size/2); 11 | $con->relLineTo($size/2, 0); 12 | $con->relLineTo($size/-2, $size/2); 13 | $con->closePath(); 14 | 15 | $con->setOperator(CairoOperator::SOURCE); 16 | $con->setSourceRgba(1,0,0,0.5); 17 | 18 | $con->fill(); 19 | 20 | $con->arc($size/2, $size/2, $size/4, 0, 2*M_PI); 21 | $con->setOperator(CairoOperator::OVER); 22 | $con->setSourceRgba(0,1,0,0.5); 23 | 24 | $con->fill(); 25 | 26 | $sur->writeToPng(dirname(__FILE__) . "/over-above-source-php.png"); 27 | ?> 28 | 29 | -------------------------------------------------------------------------------- /examples/a1-traps-sample.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,1,1); 10 | $con->paint(); 11 | 12 | $con->setSourceRgb(0,0,0); 13 | $con->translate($pad, $pad); 14 | $con->setAntialias(CairoAntialias::MODE_NONE); 15 | 16 | for($i = 0; $i < $points; $i++) 17 | for($j = 0; $j < $points; $j++) { 18 | $t1 = (2 * $i * 1.0) + (($i) * $step * 2.0); 19 | $t2 = (2 * $j * 1.0) + (($j) * $step * 1.0); 20 | $con->rectangle($t1, $t2, 1, 1); 21 | $con->fill(); 22 | } 23 | $sur->writeToPng(dirname(__FILE__) . '/a1-traps-sample-php.png'); 24 | ?> 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/device-offset-positive.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,1); 8 | $con->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad); 9 | $con->fill(); 10 | 11 | $s = $con->getGroupTarget(); 12 | $c = $s->getContent(); 13 | $s1 = $s->createSimilar($c, $size/2, $size/2); 14 | 15 | $c = new CairoContext($s1); 16 | $c->setSourceRgb(1,0,0); 17 | $c->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad); 18 | $c->fill(); 19 | 20 | $s1->setDeviceOffset($size/2, $size/2); 21 | $con->setSourceSurface($s1, $size/2, $size/2); 22 | $con->paint(); 23 | 24 | $sur->writeToPng(dirname(__FILE__) . "/device-offset-positive-php.png"); 25 | 26 | ?> 27 | -------------------------------------------------------------------------------- /tests/CairoContext/fill.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->fill() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | fill(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->fill('foobar'); 20 | trigger_error('fill requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::fill() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/save.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->save() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | save(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->save('foo'); 20 | trigger_error('save requires only one arg'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::save() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/copyPage.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->copyPage() method 3 | --SKIPIF-- 4 | copyPage not available'); 7 | ?> 8 | --FILE-- 9 | copyPage(); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->copyPage('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | CairoSurface::copyPage() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/showPage.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->showPage() method 3 | --SKIPIF-- 4 | showPage not available'); 7 | ?> 8 | --FILE-- 9 | showPage(); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->showPage('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | CairoSurface::showPage() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 13 | 14 | var_dump($status); 15 | var_dump($status == CairoStatus::SUCCESS); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $surface->status('foo'); 20 | trigger_error('We should bomb here'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | int(0) 29 | bool(true) 30 | CairoSurface::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/paint.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->paint() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | paint(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->paint('foobar'); 20 | trigger_error('paint requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::paint() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontFace->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 13 | var_dump($status); 14 | 15 | var_dump($status == CairoStatus::SUCCESS); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $fontface->status('foo'); 20 | trigger_error('status requires only one arg'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoToyFontFace)#%d (0) { 27 | } 28 | int(0) 29 | bool(true) 30 | CairoFontFace::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/stroke.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->stroke() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | stroke(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->stroke('foobar'); 20 | trigger_error('stroke requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::stroke() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/dscBeginSetup.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPsSurface->dscBeginSetup() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | dscBeginSetup(); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->dscBeginSetup('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoPsSurface)#%d (0) { 25 | } 26 | CairoPsSurface::dscBeginSetup() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/a8-mask.php: -------------------------------------------------------------------------------- 1 | getStride(); 9 | 10 | for($i=0; $i<8; $i++) { 11 | $str=$str . chr(0); 12 | $str=$str . chr(0); 13 | $str=$str . chr(255); 14 | $str=$str . chr(0); 15 | $str=$str . chr(255); 16 | $str=$str . chr(0); 17 | $str=$str . chr(0); 18 | $str=$str . chr(0); 19 | } 20 | 21 | echo $str; 22 | $s->createForData($str, CairoFormat::A8, $width, $height); 23 | $con->setSourceRgb(0,0,1); 24 | $con->paint(); 25 | 26 | $con->setSourceRgb(1,0,0); 27 | $con->maskSurface($s,0,0); 28 | $sur->writeToPng(dirname(__FILE__) . "/a8-mask-php.png"); 29 | ?> 30 | -------------------------------------------------------------------------------- /examples/clip-all.php: -------------------------------------------------------------------------------- 1 | rectangle(0,0,10,10); 5 | $con->setSourceRgb(0,0,1); 6 | $con->fill(); 7 | 8 | $con->resetClip(); 9 | $con->rectangle(2,2,2,2); 10 | $con->clip(); 11 | $con->rectangle(6,6,2,2); 12 | $con->clip(); 13 | 14 | $con->translate(0.5,0.5); 15 | 16 | $con->resetClip(); 17 | $con->rectangle(2,2,2,2); 18 | $con->clip(); 19 | $con->rectangle(6,6,6,6); 20 | $con->clip(); 21 | 22 | $con->rectangle(0,0,10,10); 23 | $con->setSourceRgb(1,1,0); 24 | $con->fill(); 25 | $con->selectFontFace("Bitstream Vera Sans", CairoFontSlant::NORMAL, CairoFontWeight::NORMAL); 26 | $con->moveTo(0,10); 27 | $con->showText("cairo"); 28 | $sur->writeToPng(dirname(__FILE__) . "/clip-all-php.png"); 29 | -------------------------------------------------------------------------------- /tests/CairoContext/showPage.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->showPage() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | showPage(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->showPage('foobar'); 20 | trigger_error('showPage requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::showPage() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/getDeviceOffset.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->getDeviceOffset() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getDeviceOffset()); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $surface->getDeviceOffset('foo'); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | array(2) { 26 | [0]=> 27 | float(0) 28 | [1]=> 29 | float(0) 30 | } 31 | CairoSurface::getDeviceOffset() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.deps 2 | /Makefile 3 | /*.lo 4 | /*.loT 5 | /*.slo 6 | /*.mk 7 | /*.la 8 | /.libs 9 | /libs.mk 10 | /ac*.m4 11 | /build 12 | /config.h 13 | /config.h.in 14 | /config.nice 15 | /config.sub 16 | /configure 17 | /configure.in 18 | /config.status 19 | /config.cache 20 | /conftest 21 | /conftest.c 22 | /core 23 | /dynlib.m4 24 | /install-sh 25 | /ltmain.sh 26 | /include 27 | /Makefile.fragments 28 | /Makefile.global 29 | /Makefile.objects 30 | /missing 31 | /mkinstalldirs 32 | /modules 33 | /scan_makefile_in.awk 34 | /config.guess 35 | /*swp 36 | /config.log 37 | /libtool 38 | /Debug 39 | /Release 40 | /Debug_TS 41 | /Release_TS 42 | /*.plg 43 | /*.patch 44 | /*.tgz 45 | /*.ncb 46 | /*.opt 47 | /*.dsw 48 | /autom4te.cache 49 | /run-tests-config.php 50 | /run-tests.php 51 | /tmp-php.ini 52 | .svn 53 | -------------------------------------------------------------------------------- /tests/CairoContext/pushGroup.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->pushGroup() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | pushGroup(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->pushGroup('foo'); 20 | trigger_error('save requires only one arg'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::pushGroup() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/resetClip.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->resetClip() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | resetClip(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->resetClip('foobar'); 20 | trigger_error('resetClip requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::resetClip() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/getType.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPattern->getType() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getType()); 16 | 17 | try { 18 | $pattern->getType('foo'); 19 | trigger_error('CairoPattern->getType requires no arguments'); 20 | } catch (CairoException $e) { 21 | echo $e->getMessage(); 22 | } 23 | ?> 24 | --EXPECTF-- 25 | object(CairoImageSurface)#%d (0) { 26 | } 27 | object(CairoSurfacePattern)#%d (0) { 28 | } 29 | int(1) 30 | CairoPattern::getType() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/CairoPsLevel_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPsLevel class constants 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 28 | --EXPECTF-- 29 | No missing constants, checked %d! 30 | Done -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/dscBeginPageSetup.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPsSurface->dscBeginPageSetup() method 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | dscBeginPageSetup(); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->dscBeginPageSetup('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoPsSurface)#%d (0) { 25 | } 26 | CairoPsSurface::dscBeginPageSetup() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/Paths/closePath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->closePath() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | closePath(); 16 | 17 | /* Wrong number args - expects 0 */ 18 | try { 19 | $context->closePath('foo'); 20 | trigger_error('newPath requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::closePath() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/fillPreserve.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->fill() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | fillPreserve(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->fillPreserve('foobar'); 20 | trigger_error('fillPreserve requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::fillPreserve() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoGradientPattern/getExtend.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoGradientPattern->getExtend() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getExtend(); 13 | var_dump($extend); 14 | var_dump($extend == CairoExtend::PAD); 15 | 16 | /* Total number of args needed = 0 */ 17 | try { 18 | $pattern->getExtend(1); 19 | trigger_error('getExtend with too many args'); 20 | } catch (CairoException $e) { 21 | echo $e->getMessage(), PHP_EOL; 22 | } 23 | ?> 24 | --EXPECTF-- 25 | object(CairoLinearGradient)#%d (0) { 26 | } 27 | int(3) 28 | bool(true) 29 | CairoGradientPattern::getExtend() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSvgSurface/CairoSvgVersion_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSvgVersion class constants 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 28 | --EXPECTF-- 29 | No missing constants, checked %d! 30 | Done -------------------------------------------------------------------------------- /tests/CairoContext/getLineCap.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getLineCap() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getLineCap()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->getLineCap('foobar'); 20 | trigger_error('getLineCap requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | int(0) 31 | CairoContext::getLineCap() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getLineJoin.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getLineJoin() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getLineJoin()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->getLineJoin('foobar'); 20 | trigger_error('getLineJoin requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | int(0) 31 | CairoContext::getLineJoin() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/strokePreserve.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->strokePreserve() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | strokePreserve(); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->strokePreserve('foobar'); 20 | trigger_error('strokePreserve requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::strokePreserve() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getFillRule.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getFillRule() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFillRule()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->getFillRule('foobar'); 20 | trigger_error('getAntialias requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | int(0) 31 | CairoContext::getFillRule() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getAntialias.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getAntialias() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getAntialias()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->getAntialias('foobar'); 20 | trigger_error('getAntialias requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | int(0) 31 | CairoContext::getAntialias() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoPattern [ __construct method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(); 19 | } 20 | 21 | $pattern = new test2(); 22 | $pattern->getType(); 23 | echo 'First call to any method should throw a fatal error'; 24 | ?> 25 | --EXPECTF-- 26 | CairoPattern cannot be constructed 27 | Fatal error: Internal pattern object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d -------------------------------------------------------------------------------- /tests/CairoContext/getDashCount.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getDashCount() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getDashCount()); 16 | 17 | /* Wrong number args - expects 0*/ 18 | try { 19 | $context->getDashCount('foo'); 20 | trigger_error('getDashCount requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | int(0) 31 | CairoContext::getDashCount() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoSurface [ __construct method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(); 20 | } 21 | 22 | $surface = new test2(); 23 | $surface->finish(); 24 | echo 'First call to any method should throw a fatal error'; 25 | ?> 26 | --EXPECTF-- 27 | CairoSurface cannot be constructed 28 | Fatal error: Internal surface object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d -------------------------------------------------------------------------------- /tests/CairoContext/Transformations/identityMatrix.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->identityMatrix() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | identityMatrix(); 16 | 17 | /* Wrong number args - expects 0 */ 18 | try { 19 | $context->identityMatrix('foo'); 20 | trigger_error('identityMatrix requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | CairoContext::identityMatrix() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getTarget_custom_class.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getTarget() should return custom classes derived from CairoImageSurface 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getTarget() instanceof TestSurface); 18 | var_dump($c->getTarget() instanceof TestSurface); 19 | unset($t); 20 | var_dump($c->getTarget() instanceof TestSurface); 21 | die; // PHP bug? get a memleak without this 22 | ?> 23 | --EXPECTF-- 24 | bool(true) 25 | bool(true) 26 | bool(true) 27 | -------------------------------------------------------------------------------- /tests/CairoFontFace/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoFontFace [ __construct method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(); 19 | } 20 | 21 | $pattern = new test2(); 22 | $pattern->getType(); 23 | echo 'First call to any method should throw a fatal error'; 24 | ?> 25 | --EXPECTF-- 26 | CairoFontFace cannot be constructed 27 | Fatal error: Internal font face object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/getLevels.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPsSurface::getLevels() method 3 | --SKIPIF-- 4 | 10 | --FILE-- 11 | getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | array(2) { 24 | [0]=> 25 | int(0) 26 | [1]=> 27 | int(1) 28 | } 29 | CairoPsSurface::getLevels() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoFontType_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoFontType class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 10600) { 17 | $constants[] = 'QUARTZ'; 18 | } 19 | if($version > 10800) { 20 | $constants[] = 'USER'; 21 | } 22 | $error = false; 23 | foreach($constants as $name) { 24 | if (!defined('CairoFontType::' . $name)) { 25 | $error = true; 26 | echo 'Missing Constant: CairoFontType::' . $name . "\n"; 27 | } 28 | } 29 | if (!$error) { 30 | echo "No missing constants, checked " . sizeof($constants) . "!\n"; 31 | } 32 | echo "Done\n"; 33 | ?> 34 | --EXPECTF-- 35 | No missing constants, checked %d! 36 | Done -------------------------------------------------------------------------------- /tests/CairoContext/Paths/copyPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->copyPath() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | copyPath()); 16 | 17 | /* Wrong number args - expects 0 */ 18 | try { 19 | $context->copyPath('foo'); 20 | trigger_error('identityMatrix requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | object(CairoPath)#%d (0) { 31 | } 32 | CairoContext::copyPath() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/cairo_get_target_custom_class.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_get_target() should return custom classes derived from CairoImageSurface 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 23 | --EXPECTF-- 24 | bool(true) 25 | bool(true) 26 | bool(true) 27 | -------------------------------------------------------------------------------- /tests/CairoContext/clipExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->clipExtents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | clipExtents()); 16 | try { 17 | $context->clipExtents('foo'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(); 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoImageSurface)#%d (0) { 24 | } 25 | object(CairoContext)#%d (0) { 26 | } 27 | array(4) { 28 | [0]=> 29 | float(0) 30 | [1]=> 31 | float(0) 32 | [2]=> 33 | float(50) 34 | [3]=> 35 | float(50) 36 | } 37 | CairoContext::clipExtents() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/hasShowTextGlyphs.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->hasShowTextGlyphs() method 3 | --SKIPIF-- 4 | hasShowTextGlyphs not available'); 7 | ?> 8 | --FILE-- 9 | hasShowTextGlyphs()); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->hasShowTextGlyphs('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | bool(false) 27 | CairoSurface::hasShowTextGlyphs() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/dash-curve.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0, 0, 0); 8 | $con->paint(); 9 | 10 | for($a=0; $a<4; $a++) 11 | for($b=0; $b<5; $b++) 12 | for($c=0; $c<5; $c++) { 13 | 14 | $con->moveTo((($b*5)+$c)*60 + 10, $a*60 + 10); 15 | $con->relCurveTo(0, $b*10, 0, $b*10, $c*10, $b*10); 16 | $con->setSourceRgb(1,1,1); 17 | $con->setLineWidth(8); 18 | $con->setLineCap(CairoLineCap::ROUND); 19 | $con->setDash($dash, $a*10); 20 | $con->strokePreserve(); 21 | $con->setSourceRgb(0,0.5,1); 22 | $con->setLineWidth(2); 23 | $con->setLineCap(2); 24 | $ar = array(8.0,8.0); 25 | $con->setDash($ar,0); 26 | $con->stroke(); 27 | } 28 | 29 | $sur->writeToPng(dirname(__FILE__) . '/dash-curve-php.png'); -------------------------------------------------------------------------------- /tests/CairoContext/getTolerance.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getTolerance() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setTolerance(1); 16 | var_dump($context->getTolerance()); 17 | 18 | try { 19 | $context->getTolerance(1); 20 | trigger_error('CairoContext->getTolerance expects 0 parameters.'); 21 | } 22 | catch (CairoException $ex) { 23 | echo $ex->getMessage(), PHP_EOL; 24 | } 25 | 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#1 (0) { 29 | } 30 | object(CairoContext)#2 (0) { 31 | } 32 | float(1) 33 | CairoContext::getTolerance() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPattern->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 16 | var_dump($status); 17 | var_dump($status == CairoStatus::SUCCESS); 18 | 19 | try { 20 | $pattern->status('foo'); 21 | trigger_error('status requires no args'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(); 24 | } 25 | ?> 26 | --EXPECTF-- 27 | object(CairoImageSurface)#%d (0) { 28 | } 29 | object(CairoSurfacePattern)#%d (0) { 30 | } 31 | int(0) 32 | bool(true) 33 | CairoPattern::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/mask-ctm.php: -------------------------------------------------------------------------------- 1 | createForData(data,CairoFormat::ARGB32, 2, 2, 8); 15 | $pat = new CairoSurfacePattern($s); 16 | $con->setSourceRgb(1,0,0); 17 | 18 | $con->save(); 19 | $con->translate(2,2); 20 | $con->mask($pat); 21 | $con->restore(); 22 | 23 | $mat = new CairoMatrix(); 24 | $mat->translate(-4,-4); 25 | $pat->setMatrix($mat); 26 | 27 | $con->mask($pat); 28 | 29 | $con->translate(2,2); 30 | $con->mask($pat); 31 | 32 | $sur->writeToPng(dirname(__FILE__) . "/mask-ctm-php.png"); 33 | ?> 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /examples/self-intersecting.php: -------------------------------------------------------------------------------- 1 | translate(1.0, 1.0); 5 | $con->setSourceRgb(1, 0, 0); /* red */ 6 | 7 | /* First draw the desired shape with a fill */ 8 | $con->rectangle(0.5, 0.5, 4.0, 4.0); 9 | $con->rectangle(3.5, 3.5, 4.0, 4.0); 10 | $con->rectangle(3.5, 1.5, -2.0, 2.0); 11 | $con->rectangle(6.5, 4.5, -2.0, 2.0); 12 | $con->fill(); 13 | 14 | /* Then try the same thing with a stroke */ 15 | $con->translate(0, 10); 16 | $con->moveTo(1.0, 1.0); 17 | $con->relLineTo( 3.0, 0.0); 18 | $con->relLineTo( 0.0, 6.0); 19 | $con->relLineTo( 3.0, 0.0); 20 | $con->relLineTo( 0.0, -3.0); 21 | $con->relLineTo(-6.0, 0.0); 22 | $con->closePath(); 23 | 24 | $con->setLineWidth(1.0); 25 | $con->stroke(); 26 | 27 | $sur->writeToPng(dirname(__FILE__) . '/self-intersecting.png'); -------------------------------------------------------------------------------- /tests/CairoContext/getOperator.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getOperator() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setOperator(CAIRO_FORMAT_ARGB32); 16 | var_dump($context->getOperator()); 17 | 18 | try { 19 | $context->getOperator(1); 20 | trigger_error('CairoContext->getOperator expects 0 parameters.'); 21 | } 22 | catch (CairoException $ex) { 23 | echo $ex->getMessage(), PHP_EOL; 24 | } 25 | 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoContext)#%d (0) { 31 | } 32 | int(0) 33 | CairoContext::getOperator() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/Paths/copyPathFlat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->copyPathFlat() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | copyPathFlat()); 16 | 17 | /* Wrong number args - expects 0 */ 18 | try { 19 | $context->copyPathFlat('foo'); 20 | trigger_error('identityMatrix requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | object(CairoPath)#%d (0) { 31 | } 32 | CairoContext::copyPathFlat() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getMiterLimit.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Cairo->getMiterLimit() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setMiterLimit(1); 16 | var_dump($context->getMiterLimit()); 17 | 18 | /* wrong params */ 19 | try { 20 | $context->getMiterLimit('foobar'); 21 | trigger_error('Cairo->getMiterLimit() expects no params'); 22 | } 23 | catch (CairoException $ex) { 24 | echo $ex->getMessage(), PHP_EOL; 25 | } 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoContext)#%d (0) { 31 | } 32 | float(1) 33 | CairoContext::getMiterLimit() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getSource.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getSource() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getSource(); 16 | var_dump($pattern); 17 | 18 | /* Wrong number args */ 19 | try { 20 | $context->getSource('foobar'); 21 | trigger_error('getSource requires no arg'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(), PHP_EOL; 24 | } 25 | ?> 26 | --EXPECTF-- 27 | object(CairoImageSurface)#%d (0) { 28 | } 29 | object(CairoContext)#%d (0) { 30 | } 31 | object(CairoSolidPattern)#%d (0) { 32 | } 33 | CairoContext::getSource() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/getEps.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPsSurface->getEps() method 3 | --SKIPIF-- 4 | getEps not available'); 8 | ?> 9 | --FILE-- 10 | getEps()); 15 | 16 | /* Wrong number args */ 17 | try { 18 | $surface->getEps('foo'); 19 | trigger_error('We should bomb here'); 20 | } catch (CairoException $e) { 21 | echo $e->getMessage(), PHP_EOL; 22 | } 23 | ?> 24 | --EXPECTF-- 25 | object(CairoPsSurface)#%d (0) { 26 | } 27 | bool(false) 28 | CairoPsSurface::getEps() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSubSurface/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoSubSurface [ __construct method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(); 20 | } 21 | 22 | $surface = new test2(); 23 | $surface->finish(); 24 | echo 'First call to any method should throw a fatal error'; 25 | ?> 26 | --EXPECTF-- 27 | CairoSubSurface cannot be constructed 28 | Fatal error: Internal surface object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d 29 | -------------------------------------------------------------------------------- /tests/CairoContext/getLineWidth.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getLineWidth() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setLineWidth(1); 16 | var_dump($context->getLineWidth()); 17 | 18 | 19 | /* wrong params */ 20 | try { 21 | $context->getLineWidth(1); 22 | trigger_error('CairoContext->getLineWidth() expects 1 param'); 23 | } 24 | catch (CairoException $ex) { 25 | echo $ex->getMessage(), PHP_EOL; 26 | } 27 | 28 | ?> 29 | --EXPECTF-- 30 | object(CairoImageSurface)#%d (0) { 31 | } 32 | object(CairoContext)#%d (0) { 33 | } 34 | float(1) 35 | CairoContext::getLineWidth() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoMatrix/cairo_matrix_init_rotate.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_matrix_init_rotate function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECTF-- 20 | object(CairoMatrix)#%d (0) { 21 | } 22 | 23 | Warning: cairo_matrix_init_rotate() expects exactly 1 parameter, 0 given in %s on line %d 24 | 25 | Warning: cairo_matrix_init_rotate() expects exactly 1 parameter, 2 given in %s on line %d 26 | 27 | Warning: cairo_matrix_init_rotate() expects parameter 1 to be double, array given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoPattern/CairoGradientPattern/__construct.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | new CairoGradientPattern [ __construct method ] 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(); 19 | } 20 | 21 | $pattern = new test2(); 22 | $pattern->getType(); 23 | echo 'First call to any method should throw a fatal error'; 24 | ?> 25 | --EXPECTF-- 26 | CairoPattern cannot be constructed 27 | Fatal error: Internal pattern object missing in test2 wrapper, you must call parent::__construct in extended classes in %s on line %d -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSurfaceType_constants.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurfaceType class constants 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 39 | --EXPECTF-- 40 | No missing constants, checked %d! 41 | Done -------------------------------------------------------------------------------- /tests/CairoPattern/CairoGradientPattern/CairoLinearGradient/getPoints.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoLinearGradient->getPoints() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getPoints()); 13 | 14 | /* Total number of args needed = 0 */ 15 | try { 16 | $pattern->getPoints(1); 17 | trigger_error('getPoints with too many args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoLinearGradient)#%d (0) { 24 | } 25 | array(4) { 26 | ["x0"]=> 27 | float(1) 28 | ["y0"]=> 29 | float(2) 30 | ["x1"]=> 31 | float(3) 32 | ["y1"]=> 33 | float(4) 34 | } 35 | CairoLinearGradient::getPoints() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/mask-surface-ctm.php: -------------------------------------------------------------------------------- 1 | createForData(data,CairoFormat::ARGB32, 2, 2, 8); 15 | //$pat = new CairoSurfacePattern($s); 16 | $con->setSourceRgb(1,0,0); 17 | 18 | $con->save(); 19 | $con->translate(2,2); 20 | $con->maskSurface($s,0,0); 21 | $con->restore(); 22 | 23 | $con->maskSurface($s,4,4); 24 | 25 | //$mat = new CairoMatrix(); 26 | $con->translate(2,2); 27 | //$pat->setMatrix($mat); 28 | 29 | $con->maskSurface($s,4,4); 30 | 31 | 32 | $sur->writeToPng(dirname(__FILE__) . "/mask-surface-ctm-php.png"); 33 | ?> 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/CairoContext/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 16 | var_dump($status); 17 | 18 | var_dump($status == CairoStatus::SUCCESS); 19 | 20 | /* Wrong number args */ 21 | try { 22 | $context->status('foo'); 23 | trigger_error('status requires only one arg'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | ?> 28 | --EXPECTF-- 29 | object(CairoImageSurface)#%d (0) { 30 | } 31 | object(CairoContext)#%d (0) { 32 | } 33 | int(0) 34 | bool(true) 35 | CairoContext::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/degenerate-arc.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,1,1); 6 | $con->paint(); 7 | $con->setLineCap(CairoLineCap::ROUND); 8 | $con->setLineWidth(5); 9 | $con->setSourceRgb(0,1,0); 10 | 11 | for($n=0;$n<8;$n++) { 12 | $theta = $n * 2 * M_PI / 8; 13 | $con->newSubPath(); 14 | $con->arc(20, 20, 15, $theta, $theta); 15 | $con->closePath(); 16 | } 17 | 18 | $con->stroke(); 19 | 20 | $con->setLineWidth(2); 21 | $con->setSourceRgb(0,0,1); 22 | 23 | for($n=0;$n<8;$n++) { 24 | $theta = $n * 2 * M_PI / 8; 25 | $con->moveTo(20,20); 26 | $con->arc(20,20,15, $theta, $theta); 27 | $con->closePath(); 28 | } 29 | 30 | $con->stroke(); 31 | $con->setSourceRgb(1,0,0); 32 | $con->arc(20,20,2,0,2*M_PI); 33 | $con->fill(); 34 | 35 | $sur->writeToPng(dirname(__FILE__) . '/degenerate-arc.png'); -------------------------------------------------------------------------------- /tests/CairoContext/popGroup.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->popGroup() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | pushGroup(); 16 | $pattern = $context->popGroup(); 17 | var_dump($pattern); 18 | 19 | /* Wrong number args */ 20 | try { 21 | $context->popGroup('foo'); 22 | trigger_error('popGroup requires only one arg'); 23 | } catch (CairoException $e) { 24 | echo $e->getMessage(), PHP_EOL; 25 | } 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoContext)#%d (0) { 31 | } 32 | object(CairoSurfacePattern)#%d (0) { 33 | } 34 | CairoContext::popGroup() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/getDash.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getDash() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getDash()); 16 | 17 | /* Wrong number args - expects 0*/ 18 | try { 19 | $context->getDash('foo'); 20 | trigger_error('getDash requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | array(2) { 31 | ["dashes"]=> 32 | array(0) { 33 | } 34 | ["offset"]=> 35 | float(0) 36 | } 37 | CairoContext::getDash() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/cairo_get_target_errors.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_get_target error conditions 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECTF-- 20 | object(CairoImageSurface)#%d (0) { 21 | } 22 | object(CairoContext)#%d (0) { 23 | } 24 | 25 | Warning: cairo_get_target() expects exactly 1 parameter, 0 given in %s on line %d 26 | 27 | Warning: cairo_get_target() expects exactly 1 parameter, 2 given in %s on line %d 28 | 29 | Catchable fatal error: Argument 1 passed to cairo_get_target() must be an instance of CairoContext, string given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoContext/Paths/getCurrentPoint.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getCurrentPoint() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getCurrentPoint()); 16 | 17 | /* Wrong number args - expects 0 */ 18 | try { 19 | $context->getCurrentPoint('foo'); 20 | trigger_error('hasCurrentPoint requires 0 args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | array(2) { 31 | [0]=> 32 | float(0) 33 | [1]=> 34 | float(0) 35 | } 36 | CairoContext::getCurrentPoint() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/clip-fill-rule.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(1,0,0); 6 | $con->translate(1,1); 7 | $con->save(); 8 | 9 | $con->moveTo(10, 0); 10 | $con->relLineTo ( 6, 20); 11 | $con->relLineTo ( -16, -12); 12 | $con->relLineTo ( 20, 0); 13 | $con->relLineTo ( -16, 12); 14 | 15 | $con->setFillRule (CairoFillRule::WINDING); 16 | $con->clip (); 17 | $con->paint (); 18 | 19 | $con->restore (); 20 | $con->translate ($starsize + 1, 0); 21 | $con->save (); 22 | 23 | $con->moveTo(10, 0); 24 | $con->relLineTo ( 6, 20); 25 | $con->relLineTo ( -16, -12); 26 | $con->relLineTo ( 20, 0); 27 | $con->relLineTo ( -16, 12); 28 | 29 | $con->setFillRule (CairoFillRule::EVEN_ODD); 30 | $con->clip (); 31 | $con->paint (); 32 | 33 | $con->restore(); 34 | $sur->writeToPng(dirname(__FILE__) . "/clip-fill-rule-php.png"); 35 | ?> 36 | 37 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/getType.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getType() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getType()); 19 | 20 | try { 21 | $scaled->getType('foo'); 22 | trigger_error('CairoScaledFont->getType requires no arguments'); 23 | } catch (CairoException $e) { 24 | echo $e->getMessage(); 25 | } 26 | ?> 27 | --EXPECTF-- 28 | object(CairoToyFontFace)#%d (0) { 29 | } 30 | object(CairoScaledFont)#%d (0) { 31 | } 32 | int(%d) 33 | CairoScaledFont::getType() expects exactly 0 parameters, 1 given 34 | -------------------------------------------------------------------------------- /tests/CairoContext/popGroupToSource.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->popGroupToSource() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | pushGroup(); 16 | $context->popGroupToSource(); 17 | 18 | var_dump($context->getSource()); 19 | 20 | /* wrong params */ 21 | try { 22 | $context->popGroupToSource(1); 23 | trigger_error('popGroupToSource() expects 0 params'); 24 | } 25 | catch (CairoException $ex) { 26 | echo $ex->getMessage(), PHP_EOL; 27 | } 28 | 29 | ?> 30 | --EXPECTF-- 31 | object(CairoImageSurface)#%d (0) { 32 | } 33 | object(CairoContext)#%d (0) { 34 | } 35 | object(CairoSurfacePattern)#%d (0) { 36 | } 37 | CairoContext::popGroupToSource() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/getFallbackResolution.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurface->getFallbackResolution() method 3 | --SKIPIF-- 4 | getFallbackResolution not available'); 7 | ?> 8 | --FILE-- 9 | getFallbackResolution()); 14 | 15 | /* Wrong number args */ 16 | try { 17 | $surface->getFallbackResolution('foo'); 18 | trigger_error('We should bomb here'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(), PHP_EOL; 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | array(2) { 27 | [0]=> 28 | float(%d) 29 | [1]=> 30 | float(%d) 31 | } 32 | CairoSurface::getFallbackResolution() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/fillExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->fillExtents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | fillExtents()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->fillExtents('foobar'); 20 | trigger_error('fillExtents requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | array(4) { 31 | [0]=> 32 | float(0) 33 | [1]=> 34 | float(0) 35 | [2]=> 36 | float(0) 37 | [3]=> 38 | float(0) 39 | } 40 | CairoContext::fillExtents() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoSurfacePattern/getExtend.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurfacePattern->getExtend() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getExtend(); 16 | var_dump($extend); 17 | var_dump($extend == CairoExtend::NONE); 18 | 19 | /* Total number of args needed = 0 */ 20 | try { 21 | $pattern->getExtend(1); 22 | trigger_error('getExtend with too many args'); 23 | } catch (CairoException $e) { 24 | echo $e->getMessage(), PHP_EOL; 25 | } 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoSurfacePattern)#%d (0) { 31 | } 32 | int(0) 33 | bool(true) 34 | CairoSurfacePattern::getExtend() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/clipRectangleList.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->clipRectangleList() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | clipRectangleList()); 16 | 17 | try { 18 | $context->clipRectangleList('foo'); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(); 21 | } 22 | ?> 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | object(CairoContext)#%d (0) { 27 | } 28 | array(1) { 29 | [0]=> 30 | array(4) { 31 | ["x"]=> 32 | float(0) 33 | ["y"]=> 34 | float(0) 35 | ["width"]=> 36 | float(50) 37 | ["height"]=> 38 | float(50) 39 | } 40 | } 41 | CairoContext::clipRectangleList() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/strokeExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->strokeExtents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | strokeExtents()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->strokeExtents('foobar'); 20 | trigger_error('strokeExtents requires no args'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | array(4) { 31 | [0]=> 32 | float(0) 33 | [1]=> 34 | float(0) 35 | [2]=> 36 | float(0) 37 | [3]=> 38 | float(0) 39 | } 40 | CairoContext::strokeExtents() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoSvgSurface/cairo_svg_version_to_string.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_svg_version_to_string() function 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 19 | --EXPECTF-- 20 | SVG 1.1 21 | 22 | Warning: cairo_svg_version_to_string() expects exactly 1 parameter, 0 given in %s on line %d 23 | 24 | Warning: cairo_svg_version_to_string() expects exactly 1 parameter, 2 given in %s on line %d 25 | 26 | Warning: cairo_svg_version_to_string() expects parameter 1 to be long, array given in %s on line %d -------------------------------------------------------------------------------- /examples/source-clip.php: -------------------------------------------------------------------------------- 1 | createSimilar(CairoContent::COLOR_ALPHA, 12, 12); 5 | $con2 = new CairoContext($source); 6 | 7 | /* Fill the source surface with green */ 8 | $con2->setSourceRgb ( 0, 1, 0); 9 | $con2->paint (); 10 | 11 | /* Draw a blue square in the middle of the source with clipping, 12 | * and leave the clip there. */ 13 | $con2->rectangle ( 14 | 12 / 4, 12 / 4, 15 | 12 / 2, 12 / 2); 16 | $con2->clip (); 17 | $con2->setSourceRgb(0, 0, 1); 18 | $con2->paint (); 19 | 20 | /* Fill the destination surface with solid red (should not appear 21 | * in final result) */ 22 | $con->setSourceRgb ( 1, 0, 0); 23 | $con->paint (); 24 | 25 | /* Now draw the source surface onto the destination surface */ 26 | $con->setSourceSurface ( $source, 0, 0); 27 | $con->paint (); 28 | $sur->writeToPng(dirname(__FILE__) . '/source-clip.png'); -------------------------------------------------------------------------------- /tests/CairoContext/getGroupTarget.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->getGroupTarget() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getGroupTarget(); 16 | var_dump($surface2); 17 | var_dump($surface2 == $surface); 18 | 19 | /* wrong params */ 20 | /* wrong params */ 21 | try { 22 | $context->getGroupTarget(1); 23 | trigger_error('getGroupTarget() expects 0 params'); 24 | } 25 | catch (CairoException $ex) { 26 | echo $ex->getMessage(), PHP_EOL; 27 | } 28 | ?> 29 | --EXPECTF-- 30 | object(CairoImageSurface)#%d (0) { 31 | } 32 | object(CairoContext)#%d (0) { 33 | } 34 | object(CairoImageSurface)#%d (0) { 35 | } 36 | bool(true) 37 | CairoContext::getGroupTarget() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/Paths/hasCurrentPoint.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->hasCurrentPoint() method 3 | --SKIPIF-- 4 | hasCurrentPoint not available'); 7 | ?> 8 | --FILE-- 9 | hasCurrentPoint()); 17 | 18 | /* Wrong number args - expects 0 */ 19 | try { 20 | $context->hasCurrentPoint('foo'); 21 | trigger_error('hasCurrentPoint requires 0 args'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(), PHP_EOL; 24 | } 25 | ?> 26 | --EXPECTF-- 27 | object(CairoImageSurface)#%d (0) { 28 | } 29 | object(CairoContext)#%d (0) { 30 | } 31 | bool(false) 32 | CairoContext::hasCurrentPoint() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoGradientPattern/CairoRadialGradient/getCircles.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoRadialGradient->getCircles() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getCircles()); 13 | 14 | /* Total number of args needed = 0 */ 15 | try { 16 | $pattern->getCircles(1); 17 | trigger_error('getCircles with too many args'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | ?> 22 | --EXPECTF-- 23 | object(CairoRadialGradient)#%d (0) { 24 | } 25 | array(6) { 26 | ["x0"]=> 27 | float(0.5) 28 | ["y0"]=> 29 | float(0.5) 30 | ["r0"]=> 31 | float(0.25) 32 | ["x1"]=> 33 | float(0.5) 34 | ["y1"]=> 35 | float(0.5) 36 | ["r1"]=> 37 | float(0.5) 38 | } 39 | CairoRadialGradient::getCircles() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoSurfacePattern/getSurface.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurfacePattern->getSurface() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getSurface(); 16 | var_dump($surface2); 17 | var_dump($surface === $surface2); 18 | 19 | /* Total number of args needed = 0 */ 20 | try { 21 | $pattern->getSurface(1); 22 | trigger_error('getSurface with too many args'); 23 | } catch (CairoException $e) { 24 | echo $e->getMessage(), PHP_EOL; 25 | } 26 | ?> 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoSurfacePattern)#%d (0) { 31 | } 32 | object(CairoImageSurface)#%d (0) { 33 | } 34 | bool(true) 35 | CairoSurfacePattern::getSurface() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/cairo_status_to_string.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_status_to_string function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 21 | --EXPECTF-- 22 | object(CairoImageSurface)#%d (0) { 23 | } 24 | object(CairoContext)#%d (0) { 25 | } 26 | string(21) "no error has occurred" 27 | 28 | Warning: cairo_status_to_string() expects exactly 1 parameter, 0 given in %s on line %d 29 | 30 | Warning: cairo_status_to_string() expects exactly 1 parameter, 2 given in %s on line %d 31 | 32 | Warning: cairo_status_to_string() expects parameter 1 to be long, array given in %s on line %d 33 | -------------------------------------------------------------------------------- /tests/CairoPattern/CairoSurfacePattern/getFilter.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSurfacePattern->getFilter() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setFilter(CairoFilter::GOOD); 16 | $filter = $pattern->getFilter(); 17 | var_dump($filter); 18 | var_dump($filter == CairoFilter::GOOD); 19 | 20 | /* Total number of args needed = 0 */ 21 | try { 22 | $pattern->getFilter(1); 23 | trigger_error('getFilter with too many args'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | ?> 28 | --EXPECTF-- 29 | object(CairoImageSurface)#%d (0) { 30 | } 31 | object(CairoSurfacePattern)#%d (0) { 32 | } 33 | int(1) 34 | bool(true) 35 | CairoSurfacePattern::getFilter() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/a1-mask.php: -------------------------------------------------------------------------------- 1 | getStride(); 16 | 17 | echo "Stride: " . $stride . "\n"; 18 | 19 | 20 | 21 | for($i=0; $i<8; $i++) { 22 | 23 | $str=$str . chr(0x14); 24 | 25 | $str=$str . chr(0xAA); 26 | 27 | /*$str=$str . chr(255); 28 | 29 | $str=$str . chr(0); 30 | 31 | $str=$str . chr(255); 32 | 33 | $str=$str . chr(0); 34 | 35 | $str=$str . chr(0); 36 | 37 | $str=$str . chr(0);*/ 38 | 39 | } 40 | 41 | 42 | 43 | echo $str; 44 | 45 | $s->createForData($str, CairoFormat::A1, $width, $height); 46 | 47 | $con->setSourceRgb(0,0,1); 48 | 49 | $con->paint(); 50 | 51 | 52 | 53 | $con->setSourceRgb(1,0,0); 54 | 55 | $con->maskSurface($s,0,0); 56 | 57 | $sur->writeToPng( dirname(__FILE__) . "/a1-mask-php.png"); 58 | 59 | ?> 60 | 61 | -------------------------------------------------------------------------------- /examples/over-between-source.php: -------------------------------------------------------------------------------- 1 | translate($pad, $pad); 10 | $con->moveTo($size/5, $size/5); 11 | $con->relLineTo($size/2, 0); 12 | $con->relLineTo($size/-2, $size/2); 13 | $con->closePath(); 14 | 15 | $con->setOperator(CairoOperator::SOURCE); 16 | $con->setSourceRgba(1,0,0,0.5); 17 | 18 | $con->fill(); 19 | 20 | $con->arc($size/2, $size/2, $size/4, 0, 2*M_PI); 21 | $con->setOperator(CairoOperator::OVER); 22 | $con->setSourceRgba(0,1,0,0.5); 23 | 24 | $con->fill(); 25 | 26 | $con->moveTo($size/2, $size/2); 27 | $con->relLineTo($size/2, 0); 28 | $con->relLineTo($size/-2, $size/2); 29 | $con->closePath(); 30 | 31 | $con->setOperator(CairoOperator::SOURCE); 32 | $con->setSourceRgba(1,0,0,0.5); 33 | 34 | $con->fill(); 35 | 36 | $sur->writeToPng(dirname(__FILE__) . "/over-between-source-php.png"); 37 | ?> 38 | 39 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/getScaleMatrix.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getScaleMatrix() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getScaleMatrix()); 19 | 20 | /* Wrong number args */ 21 | try { 22 | $scaled->getScaleMatrix('foo'); 23 | trigger_error('status requires only one arg'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | ?> 28 | --EXPECTF-- 29 | object(CairoToyFontFace)#%d (0) { 30 | } 31 | object(CairoScaledFont)#%d (0) { 32 | } 33 | object(CairoMatrix)#%d (0) { 34 | } 35 | CairoScaledFont::getScaleMatrix() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/set-source.php: -------------------------------------------------------------------------------- 1 | createForData($color, CairoFormat::ARGB32, 1,1,4); 17 | 18 | $pat = new CairoSurfacePattern($s); 19 | $pat->setExtend(CairoExtend::REPEAT); 20 | 21 | for($i=0; $i<5; $i++) { 22 | switch($i) { 23 | case 0: 24 | $con->setSourceRgb(.6,.7,.8); 25 | break; 26 | case 1: 27 | $con->setSourceRgba(.2,.4,.6,.5); 28 | break; 29 | case 2: 30 | $con->setSourceRgba(.2,.4,.6,.5); 31 | break; 32 | case 3: 33 | default: 34 | $con->setSource($pat); 35 | } 36 | 37 | $con->rectangle($i,0,1,5); 38 | 39 | $con->fill(); 40 | } 41 | 42 | $sur->writeToPng(dirname(__FILE__) . '/set-source.png'); -------------------------------------------------------------------------------- /examples/move-to-show.php: -------------------------------------------------------------------------------- 1 | createForData($c[$i], CairoFormat::RGB24, 1 , 1, 4); 43 | $con->setSourceSurface($s, $i%2, $i/2); 44 | $con->paint(); 45 | } 46 | 47 | 48 | $sur->writeToPng(dirname(__FILE__) . "/move-to-show-surface-php.png"); 49 | ?> 50 | -------------------------------------------------------------------------------- /tests/CairoContext/Text/fontExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->fontExtents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | fontExtents()); 16 | 17 | /* Wrong number args */ 18 | try { 19 | $context->fontExtents('foo'); 20 | trigger_error('fontExtents requires only one arg'); 21 | } catch (CairoException $e) { 22 | echo $e->getMessage(), PHP_EOL; 23 | } 24 | ?> 25 | --EXPECTF-- 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | object(CairoContext)#%d (0) { 29 | } 30 | array(5) { 31 | ["ascent"]=> 32 | float(%f) 33 | ["descent"]=> 34 | float(%f) 35 | ["height"]=> 36 | float(%f) 37 | ["max_x_advance"]=> 38 | float(%f) 39 | ["max_y_advance"]=> 40 | float(%f) 41 | } 42 | CairoContext::fontExtents() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoScaledFont/status.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->status() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | status(); 19 | var_dump($status); 20 | 21 | var_dump($status == CairoStatus::SUCCESS); 22 | 23 | /* Wrong number args */ 24 | try { 25 | $scaled->status('foo'); 26 | trigger_error('status requires only one arg'); 27 | } catch (CairoException $e) { 28 | echo $e->getMessage(), PHP_EOL; 29 | } 30 | ?> 31 | --EXPECTF-- 32 | object(CairoToyFontFace)#%d (0) { 33 | } 34 | object(CairoScaledFont)#%d (0) { 35 | } 36 | int(0) 37 | bool(true) 38 | CairoScaledFont::status() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoSurface/CairoPsSurface/cairo_ps_level_to_string.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_ps_level_to_string() function 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 20 | --EXPECTF-- 21 | PS Level 2 22 | 23 | Warning: cairo_ps_level_to_string() expects exactly 1 parameter, 0 given in %s on line %d 24 | 25 | Warning: cairo_ps_level_to_string() expects exactly 1 parameter, 2 given in %s on line %d 26 | 27 | Warning: cairo_ps_level_to_string() expects parameter 1 to be long, array given in %s on line %d -------------------------------------------------------------------------------- /examples/composite-integer-translate-over-repeat.php: -------------------------------------------------------------------------------- 1 | setSourceRgba(1,0,0,1); 9 | $con2->rectangle(0,0,10,10); 10 | $con2->fill(); 11 | $con2->setSourceRgba(0,1,0,1); 12 | $con2->rectangle(10,0,10,10); 13 | $con2->fill(); 14 | $con2->setSourceRgba(0,0,1,1); 15 | $con2->rectangle(0,10,10,10); 16 | $con2->fill(); 17 | $con2->setSourceRgba(1,1,0,1); 18 | $con2->rectangle(10,10,10,10); 19 | $con2->fill(); 20 | 21 | $pat = new CairoSurfacePattern($s); 22 | $pat->setExtend(CairoExtend::REPEAT); 23 | $con->setSourceRgba(0,0,0,1); 24 | $con->rectangle(0,0,100,100); 25 | $con->fill(); 26 | $con->translate(10,10); 27 | $con->setOperator(CairoOperator::OVER); 28 | $con->setSource($pat); 29 | $con->rectangle(0,0,90,90); 30 | $con->fill(); 31 | $sur->writeToPng(dirname(__FILE__) . "/composite-integer-translate-over-repeat-php.png"); 32 | ?> 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/clip-nesting.php: -------------------------------------------------------------------------------- 1 | getGroupTarget(); 8 | $c = new CairoContext($s); 9 | 10 | $c->moveTo($border, $border); 11 | $c->lineTo($border + $linewidth, $border); 12 | $c->lineTo($size - $border, $size - $border); 13 | $c->lineTo($size - $border-$linewidth, $size - $border); 14 | 15 | $c->clip(); 16 | $c->setSourceRgb(0,0,1); 17 | $c->paint(); 18 | 19 | $c->setSourceRgb(1,1,1); 20 | $c->rectangle($size/2 - $linewidth/2, $border, $linewidth, $size - 2*$border); 21 | $c->fill(); 22 | 23 | $c2 = new CairoContext($sur); 24 | $c2->setSourceRgb(1,1,1); 25 | $c2->rectangle($size - $border - $linewidth, $border, $linewidth, $size - 2 * $border); 26 | $c2->fill(); 27 | 28 | $con->setSourceRgb(1,1,1); 29 | $con->rectangle($border, $border, $linewidth, $size - 2 * $border); 30 | $con->fill(); 31 | 32 | $sur->writeToPng(dirname(__FILE__) . "/clip-nesting-php.png"); 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /examples/clip-twice.php: -------------------------------------------------------------------------------- 1 | newPath(); 7 | $con->arc($width/2, $height/2, $width/3, 0, 2 * M_PI); 8 | $con->clip(); 9 | $con->newPath(); 10 | $con->moveTo(0,0); 11 | $con->lineTo($width/4, $height/2); 12 | $con->lineTo(0, $height); 13 | $con->lineTo($width, $height); 14 | $con->lineTo(3*$width/4, $height/2); 15 | $con->lineTo($width, 0); 16 | $con->closePath(); 17 | $con->clip(); 18 | $con->setSourceRgb(0,0,0.6); 19 | $con->newPath(); 20 | $con->moveTo(0,0); 21 | $con->lineTo(0, $height); 22 | $con->lineTo($width/2, 3*$height/4); 23 | $con->lineTo($width, $height); 24 | $con->lineTo($width, 0); 25 | $con->lineTo($width/2, $height/4); 26 | $con->closePath(); 27 | $con->fill(); 28 | $con->newPath(); 29 | $con->arc($width/2, $height/2, $width/5, 0, 2 * M_PI); 30 | $con->clip(); 31 | $con->setSourceRgb(1,1,0); 32 | $con->paint(); 33 | 34 | 35 | $sur->writeToPng(dirname(__FILE__) . "/clip-twice-php.png"); 36 | ?> 37 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/getCtm.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getCtm() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getCtm()); 19 | 20 | /* Wrong number args */ 21 | try { 22 | $scaled->getCtm('foo'); 23 | trigger_error('status requires only one arg'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | 28 | die; // GC issue, bogus memleaks reported without this 29 | ?> 30 | --EXPECTF-- 31 | object(CairoToyFontFace)#%d (0) { 32 | } 33 | object(CairoScaledFont)#%d (0) { 34 | } 35 | object(CairoMatrix)#%d (0) { 36 | } 37 | CairoScaledFont::getCtm() expects exactly 0 parameters, 1 given 38 | -------------------------------------------------------------------------------- /tests/CairoContext/restore.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->restore() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | save(); 16 | $context->restore(); 17 | 18 | /* restore without save */ 19 | try { 20 | $context->restore(); 21 | trigger_error('save requires only one arg'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(), PHP_EOL; 24 | } 25 | 26 | /* Wrong number args */ 27 | try { 28 | $context->restore('foo'); 29 | trigger_error('save requires only one arg'); 30 | } catch (CairoException $e) { 31 | echo $e->getMessage(), PHP_EOL; 32 | } 33 | ?> 34 | --EXPECTF-- 35 | object(CairoImageSurface)#%d (0) { 36 | } 37 | object(CairoContext)#%d (0) { 38 | } 39 | cairo_restore() without matching cairo_save() 40 | CairoContext::restore() expects exactly 0 parameters, 1 given 41 | -------------------------------------------------------------------------------- /tests/CairoContext/setSourceRGBA.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->setSourceRGBA() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setSourceRGBA(0.1, 0.1, 0.1, 0.5); 16 | 17 | try { 18 | $context->setSourceRGBA("1", "1", "1", "0"); 19 | } catch (CairoException $e) { 20 | echo $e->getMessage(); 21 | } 22 | 23 | try { 24 | $context->setSourceRGBA("1.0", "1.0", "1.0", "0.0"); 25 | } catch (CairoException $e) { 26 | echo $e->getMessage(); 27 | } 28 | 29 | try { 30 | $context->setSourceRGBA("foo", "bar", "baz", "foo"); 31 | } catch (CairoException $e) { 32 | echo $e->getMessage(); 33 | } 34 | 35 | ?> 36 | --EXPECTF-- 37 | object(CairoImageSurface)#%d (0) { 38 | } 39 | object(CairoContext)#%d (0) { 40 | } 41 | CairoContext::setSourceRGBA() expects parameter 1 to be double, string given 42 | -------------------------------------------------------------------------------- /tests/CairoContext/Paths/newPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->newPath() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | lineTo(5, 5); 16 | var_dump($context->getCurrentPoint()); 17 | 18 | $context->newPath(); 19 | var_dump($context->getCurrentPoint()); 20 | 21 | /* Wrong number args - expects 0 */ 22 | try { 23 | $context->newPath('foo'); 24 | trigger_error('newPath requires 0 args'); 25 | } catch (CairoException $e) { 26 | echo $e->getMessage(), PHP_EOL; 27 | } 28 | ?> 29 | --EXPECTF-- 30 | object(CairoImageSurface)#%d (0) { 31 | } 32 | object(CairoContext)#%d (0) { 33 | } 34 | array(2) { 35 | [0]=> 36 | float(5) 37 | [1]=> 38 | float(5) 39 | } 40 | array(2) { 41 | [0]=> 42 | float(0) 43 | [1]=> 44 | float(0) 45 | } 46 | CairoContext::newPath() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoContext/Paths/pathExtents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->pathExtents() method 3 | --SKIPIF-- 4 | pathExtents extension not available'); 7 | ?> 8 | --FILE-- 9 | pathExtents()); 17 | 18 | /* Wrong number args 10*/ 19 | try { 20 | $context->pathExtents('foobar'); 21 | trigger_error('textExtents requires no args'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(), PHP_EOL; 24 | } 25 | ?> 26 | --EXPECTF-- 27 | object(CairoImageSurface)#%d (0) { 28 | } 29 | object(CairoContext)#%d (0) { 30 | } 31 | array(4) { 32 | [0]=> 33 | float(0) 34 | [1]=> 35 | float(0) 36 | [2]=> 37 | float(0) 38 | [3]=> 39 | float(0) 40 | } 41 | CairoContext::pathExtents() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/miter-precision.php: -------------------------------------------------------------------------------- 1 | setSourceRgb ( 1, 1, 1); 6 | $con->paint (); 7 | 8 | $con->setSourceRgb ( 0, 0, 0); 9 | $con->setMiterLimit (100000); 10 | for ($xscale = 1; $xscale <= 1000; $xscale += 999) 11 | for ($yscale = 1; $yscale <= 1000; $yscale += 999) 12 | { 13 | //$max_scale = ($xscale > $yscale) ? $xscale : $yscale; 14 | $max_scale = max($xscale, $yscale); 15 | $con->save (); 16 | if ($xscale > 1) 17 | $con->translate (50, 0); 18 | if ($yscale > 1) 19 | $con->translate ( 0, 50); 20 | $con->scale ( $xscale,$yscale); 21 | $con->setLineWidth ( 10.0 / $max_scale); 22 | $con->moveTo ( 10.0 / $xscale, 10.0 / $yscale); 23 | $con->lineTo ( 40.0 / $xscale, 10.0 / $yscale); 24 | $con->lineTo ( 10.0 / $xscale, 30.0 / $yscale); 25 | $con->stroke (); 26 | $con->restore (); 27 | } 28 | $sur->writeToPng(dirname(__FILE__) . "/miter-precision-php.png"); 29 | ?> 30 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/getFontFace.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getFontFace() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFontFace(); 19 | var_dump($face2); 20 | 21 | var_dump($face2 == $fontface); 22 | 23 | /* Wrong number args */ 24 | try { 25 | $scaled->getFontFace('foo'); 26 | trigger_error('status requires only one arg'); 27 | } catch (CairoException $e) { 28 | echo $e->getMessage(), PHP_EOL; 29 | } 30 | ?> 31 | --EXPECTF-- 32 | object(CairoToyFontFace)#%d (0) { 33 | } 34 | object(CairoScaledFont)#%d (0) { 35 | } 36 | object(CairoToyFontFace)#%d (0) { 37 | } 38 | bool(true) 39 | CairoScaledFont::getFontFace() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoScaledFont/getFontMatrix.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getFontMatrix() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFontMatrix()); 19 | 20 | /* Wrong number args */ 21 | try { 22 | $scaled->getFontMatrix('foo'); 23 | trigger_error('status requires only one arg'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | 28 | die; // GC issue, bogus memleaks reported without this 29 | ?> 30 | --EXPECTF-- 31 | object(CairoToyFontFace)#%d (0) { 32 | } 33 | object(CairoScaledFont)#%d (0) { 34 | } 35 | object(CairoMatrix)#%d (0) { 36 | } 37 | CairoScaledFont::getFontMatrix() expects exactly 0 parameters, 1 given 38 | -------------------------------------------------------------------------------- /examples/select-font-face.php: -------------------------------------------------------------------------------- 1 | save (); 6 | $con->setSourceRgb ( 1.0, 1.0, 1.0); /* white */ 7 | $con->paint (); 8 | $con->restore (); 9 | 10 | $con->setSourceRgb ( 0, 0, 0); /* black */ 11 | 12 | $con->selectFontFace ( "Bitstream Vera Serif", 13 | CairoFontSlant::NORMAL, 14 | CairoFontWeight::NORMAL); 15 | $con->setFontSize ( $TEXT_SIZE); 16 | 17 | $con->moveTo ( 0, $TEXT_SIZE); 18 | $con->showText ( "i-am-serif"); 19 | 20 | $con->selectFontFace ( "Bitstream Vera Sans", 21 | CairoFontSlant::NORMAL, 22 | CairoFontWeight::NORMAL); 23 | $con->showText ( " i-am-sans"); 24 | 25 | $con->selectFontFace ( "Bitstream Vera Sans Mono", 26 | CairoFontSlant::NORMAL, 27 | CairoFontWeight::NORMAL); 28 | $con->showText ( " i-am-mono"); 29 | $sur->writeToPng(dirname(__FILE__) . "/select-font-face-php.png"); 30 | 31 | 32 | ?> 33 | -------------------------------------------------------------------------------- /tests/CairoContext/Paths/newSubPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->newSubPath() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | lineTo(5, 5); 16 | var_dump($context->getCurrentPoint()); 17 | 18 | $context->newSubPath(); 19 | var_dump($context->getCurrentPoint()); 20 | 21 | /* Wrong number args - expects 0 */ 22 | try { 23 | $context->newSubPath('foo'); 24 | trigger_error('newPath requires 0 args'); 25 | } catch (CairoException $e) { 26 | echo $e->getMessage(), PHP_EOL; 27 | } 28 | ?> 29 | --EXPECTF-- 30 | object(CairoImageSurface)#%d (0) { 31 | } 32 | object(CairoContext)#%d (0) { 33 | } 34 | array(2) { 35 | [0]=> 36 | float(5) 37 | [1]=> 38 | float(5) 39 | } 40 | array(2) { 41 | [0]=> 42 | float(0) 43 | [1]=> 44 | float(0) 45 | } 46 | CairoContext::newSubPath() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoGradientPattern/getColorStopCount.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoGradient->getColorStopCount() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getColorStopCount()); 18 | $pattern->addColorStopRgba(0.2, $red, $green, $blue, $alpha); 19 | $pattern->addColorStopRgba(0.4, $red, $green, $blue, $alpha); 20 | $pattern->addColorStopRgba(0.6, $red, $green, $blue, $alpha); 21 | var_dump($pattern->getColorStopCount()); 22 | 23 | /* Total number of args needed = 0 */ 24 | try { 25 | $pattern->getColorStopCount(1); 26 | trigger_error('getColorStopCount with too many args'); 27 | } catch (CairoException $e) { 28 | echo $e->getMessage(), PHP_EOL; 29 | } 30 | ?> 31 | --EXPECTF-- 32 | object(CairoLinearGradient)#%d (0) { 33 | } 34 | int(0) 35 | int(3) 36 | CairoGradientPattern::getColorStopCount() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/random-intersections.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,0); 19 | $con->paint(); 20 | 21 | $state = 0x123456; 22 | 23 | $con->translate(1,1); 24 | $con->setFillRule(CairoFillRule::EVEN_ODD); 25 | $con->moveTo(0,0); 26 | 27 | for($i=0; $i<$numseg;$i++) { 28 | $x = uniform_random(0,$width); 29 | $y = uniform_random(0,$height); 30 | $con->lineTo($x,$y); 31 | //echo "x = $x"; 32 | //echo "y = $y"; 33 | } 34 | 35 | $con->closePath(); 36 | $con->setSourceRgb(1,0,0); 37 | $con->fillPreserve(); 38 | $con->setSourceRgb(0,1,0); 39 | $con->setLineWidth(0.5); 40 | $con->stroke(); 41 | 42 | $sur->writeToPng(dirname(__FILE__) . "/random-intersection-php.png"); 43 | ?> 44 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/getFontOptions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->getFontOptions() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getFontOptions(); 19 | var_dump($options2); 20 | 21 | var_dump($options2 == $fontoptions); 22 | 23 | /* Wrong number args */ 24 | try { 25 | $scaled->getFontOptions('foo'); 26 | trigger_error('status requires only one arg'); 27 | } catch (CairoException $e) { 28 | echo $e->getMessage(), PHP_EOL; 29 | } 30 | ?> 31 | --EXPECTF-- 32 | object(CairoToyFontFace)#%d (0) { 33 | } 34 | object(CairoScaledFont)#%d (0) { 35 | } 36 | object(CairoFontOptions)#%d (0) { 37 | } 38 | bool(true) 39 | CairoScaledFont::getFontOptions() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /examples/large-source.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,1); 7 | $con->paint(); 8 | $s = new CairoImageSurface(CairoFormat::A1, 6400,20); 9 | $stride = $s->getStride(); 10 | $height = $s->getHeight(); 11 | $width = $s->getWidth(); 12 | $data = ""; 13 | for($y = 0; $y<$height; $y++) { 14 | for($x=0; $x<($width+7)/8; $x++) 15 | $data = $data . chr(5); 16 | } 17 | $s->createForData($data,CairoFormat::A1,$width, $height, $stride); 18 | $con->setSourceRgb(1,0,0); 19 | $con->maskSurface($s); 20 | $con->fill(); 21 | $s = new CairoImageSurface(CairoFormat::A1,20, 6400); 22 | $stride = $s->getStride(); 23 | $height = $s->getHeight(); 24 | $width = $s->getWidth(); 25 | $data = ""; 26 | for($y = 0; $y<$height; $y++) { 27 | for($x=0; $x<($width+7)/8; $x++) 28 | $data = $data . chr(80); 29 | } 30 | $s->createForData($data,CairoFormat::A1,$width, $height, $stride); 31 | $con->setSourceRgb(0,1,0); 32 | $con->maskSurface($s,0,0); 33 | 34 | $sur->writeToPng(dirname(__FILE__) . "/large-source-php.png"); 35 | ?> 36 | -------------------------------------------------------------------------------- /examples/long-lines.php: -------------------------------------------------------------------------------- 1 | 100.0, 'r'=>1, 'g'=>0, 'b'=>0); 8 | $line[1] = array('len'=>10000.0, 'r'=>0, 'g'=>1, 'b'=>0); 9 | $line[2] = array('len'=>10000.0, 'r'=>0, 'g'=>0, 'b'=>1); 10 | $line[3] = array('len'=>10000.0, 'r'=>1, 'g'=>1, 'b'=>0); 11 | $line[4] = array('len'=>10000.0, 'r'=>0, 'g'=>1, 'b'=>1); 12 | $line[5] = array('len'=>10000.0, 'r'=>1, 'g'=>0, 'b'=>1); 13 | 14 | $con->save(); 15 | $con->setSourceRgb(1,1,1); 16 | $con->paint(); 17 | $con->restore(); 18 | $con->save(); 19 | $con->setLineWidth(1); 20 | 21 | $pos = 10.5; 22 | for($i =0; $i < 6; $i++) { 23 | $con->moveTo($pos, -$line[$i]['len']); 24 | $con->lineTo($pos, $line[$i]['len']); 25 | $con->setSourceRgb($line[$i]['r'], $line[$i]['g'], $line[$i]['b']); 26 | $con->stroke(); 27 | $pos+=10; 28 | } 29 | 30 | $con->restore(); 31 | $con->moveTo(35, -10000); 32 | $con->lineTo(35, 10000); 33 | $con->setLineWidth(1); 34 | 35 | $con->stroke(); 36 | 37 | $sur->writeToPng(dirname(__FILE__) . '/long-lines.png'); -------------------------------------------------------------------------------- /examples/a1-image-sample.php: -------------------------------------------------------------------------------- 1 | setSourceRgb(0,0,0); 22 | 23 | $c->paint(); 24 | 25 | $con->setSourceRgb(1,1,1); 26 | 27 | $con->paint(); 28 | 29 | 30 | 31 | $con->setSourceRgb(0,0,0); 32 | 33 | $con->translate($pad, $pad); 34 | 35 | $con->setAntialias(CairoAntialias::MODE_NONE); 36 | 37 | 38 | 39 | for($i = 0; $i < $points; $i++) 40 | 41 | for($j = 0; $j < $points; $j++) { 42 | 43 | $t1 = (2 * $i) + (($i+1) * $step); 44 | 45 | $t2 = (2 * $j) + (($j+1) * $step); 46 | 47 | $con->setSourceSurface($s, $t1, $t2); 48 | 49 | $pat = $con->getSource(); 50 | 51 | $pat->setFilter(CairoFilter::NEAREST); 52 | 53 | $con->paint(); 54 | 55 | } 56 | 57 | $sur->writeToPng(dirname(__FILE__) . '/a1-image-sample-php.png'); 58 | 59 | ?> 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /tests/CairoMatrix/rotate.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoMatrix->rotate method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | rotate(0.1); 13 | 14 | /* Wrong number args */ 15 | try { 16 | $matrix->rotate(); 17 | trigger_error('We should bomb here'); 18 | } catch (CairoException $e) { 19 | echo $e->getMessage(), PHP_EOL; 20 | } 21 | 22 | /* Wrong number args 2 */ 23 | try { 24 | $matrix->rotate(1, 1); 25 | trigger_error('We should bomb here'); 26 | } catch (CairoException $e) { 27 | echo $e->getMessage(), PHP_EOL; 28 | } 29 | 30 | /* Wrong arg type */ 31 | try { 32 | $matrix->rotate(array()); 33 | trigger_error('We should bomb here'); 34 | } catch (CairoException $e) { 35 | echo $e->getMessage(), PHP_EOL; 36 | } 37 | ?> 38 | --EXPECTF-- 39 | object(CairoMatrix)#%d (0) { 40 | } 41 | CairoMatrix::rotate() expects exactly 1 parameter, 0 given 42 | CairoMatrix::rotate() expects exactly 1 parameter, 2 given 43 | CairoMatrix::rotate() expects parameter 1 to be double, array given -------------------------------------------------------------------------------- /tests/cairo_phpinfo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo phpinfo information 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | $info) { 14 | if ($info === 'cairo') { 15 | break; 16 | } 17 | } 18 | $data = $data[$key + 1]; 19 | var_dump($data); 20 | ?> 21 | --EXPECTF-- 22 | string(%d) "Cairo Graphics Library Bindings => enabled 23 | compiled as %s module 24 | Cairo Library Version => %s 25 | Extension Version => %s 26 | Surface Backends Available 27 | Image Surface => %s 28 | PNG Support => %s 29 | PDF Surface => %s 30 | PS Surface => %s 31 | Xlib (X11, X.org) Surface => %s 32 | Quartz (MacOSX) Surface => %s 33 | SVG Surface => %s 34 | Win32 Surface => %s 35 | Recording Surface => %s 36 | Font Backends Available 37 | Freetype Fonts => %s 38 | Quartz Fonts => %s 39 | Win32 Fonts => %s 40 | User Fonts => %s" 41 | -------------------------------------------------------------------------------- /examples/bilevel-image.php: -------------------------------------------------------------------------------- 1 | getStride(); 9 | for($i=0; $i<12; $i++) { 10 | $str=$str . chr(0x00); //blue 11 | $str=$str . chr(0x00);//green 12 | $str=$str . chr(0xff);//red 13 | $str=$str . chr(0xff);//alpha 14 | $str=$str . chr(0x00); 15 | $str=$str . chr(0xff); 16 | $str=$str . chr(0x00); 17 | $str=$str . chr(0xff); 18 | $str=$str . chr(0xff); 19 | $str=$str . chr(0x00); 20 | $str=$str . chr(0x00); 21 | $str=$str . chr(0xff); 22 | $str=$str . chr(0xff); 23 | $str=$str . chr(0xff); 24 | $str=$str . chr(0xff); 25 | $str=$str . chr(0xff); 26 | } 27 | 28 | $s->createForData($str, CairoFormat::ARGB32, $width, $height); 29 | $wid = $s->getHeight(); 30 | $con->setSourceRgb(1,1,1); 31 | $con->paint(); 32 | 33 | $con->setSourceSurface($s,0,0); 34 | //$con->mask_surface($s,0,0); 35 | $con->paint(); 36 | $sur->writeToPng(dirname(__FILE__) . "/bilevel-image-php.png"); 37 | ?> 38 | -------------------------------------------------------------------------------- /tests/CairoContext/cairo_get_source.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_get_source function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 27 | --EXPECTF-- 28 | object(CairoImageSurface)#%d (0) { 29 | } 30 | object(CairoContext)#%d (0) { 31 | } 32 | object(CairoSolidPattern)#%d (0) { 33 | } 34 | CAUGHT ERROR: Argument 1 passed to cairo_get_source() must be an instance of CairoContext, instance of stdClass given 35 | 36 | Warning: cairo_get_source() expects parameter 1 to be CairoContext, object given in %s on line %d 37 | NULL 38 | -------------------------------------------------------------------------------- /examples/fill-rule.php: -------------------------------------------------------------------------------- 1 | moveTo(10,0); 6 | $con->relLineTo(6,20); 7 | $con->relLineTo(-16,-12); 8 | $con->relLineTo(20,0); 9 | $con->relLineTo(-16,12); 10 | } 11 | 12 | function big_star_path() 13 | { 14 | global $con; 15 | $con->moveTo(40,0); 16 | $con->relLineTo(25,80); 17 | $con->relLineTo(-65,-50); 18 | $con->relLineTo(80,0); 19 | $con->relLineTo(-65,50); 20 | $con->closePath(); 21 | } 22 | 23 | $sur = new CairoImageSurface(CairoFormat::ARGB32, 163, 103); 24 | $con = new CairoContext($sur); 25 | $con->setSourceRgb(1,0,0); 26 | $con->translate(1,1); 27 | little_star_path(); 28 | $con->setFillRule(CairoFillRule::WINDING); 29 | $con->fill(); 30 | $con->translate(21,0); 31 | little_star_path(); 32 | $con->setFillRule(CairoFillRule::EVEN_ODD); 33 | $con->fill(); 34 | $con->translate(-21, 21); 35 | big_star_path(); 36 | $con->setFillRule(CairoFillRule::WINDING); 37 | $con->fill(); 38 | $con->translate(81,0); 39 | big_star_path(); 40 | $con->setFillRule(CairoFillRule::EVEN_ODD); 41 | $con->fill(); 42 | $sur->writeToPng(dirname(__FILE__) . "/fill-rule-php.png"); 43 | ?> 44 | 45 | 46 | -------------------------------------------------------------------------------- /tests/CairoScaledFont/extents.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoScaledFont->extents() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | extents()); 19 | 20 | /* Wrong number args */ 21 | try { 22 | $scaled->extents('foo'); 23 | trigger_error('status requires only one arg'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | ?> 28 | --EXPECTF-- 29 | object(CairoToyFontFace)#%d (0) { 30 | } 31 | object(CairoScaledFont)#%d (0) { 32 | } 33 | array(5) { 34 | ["ascent"]=> 35 | float(%f) 36 | ["descent"]=> 37 | float(%f) 38 | ["height"]=> 39 | float(%f) 40 | ["max_x_advance"]=> 41 | float(%f) 42 | ["max_y_advance"]=> 43 | float(%f) 44 | } 45 | CairoScaledFont::extents() expects exactly 0 parameters, 1 given 46 | -------------------------------------------------------------------------------- /tests/CairoMatrix/initRotate.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoMatrix::initRotate function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMessage(), PHP_EOL; 18 | } 19 | 20 | /* Wrong number args 2 */ 21 | try { 22 | CairoMatrix::initRotate(1, 1); 23 | trigger_error('We should bomb here'); 24 | } catch (CairoException $e) { 25 | echo $e->getMessage(), PHP_EOL; 26 | } 27 | 28 | /* Wrong arg type */ 29 | try { 30 | CairoMatrix::initRotate(array()); 31 | trigger_error('We should bomb here'); 32 | } catch (CairoException $e) { 33 | echo $e->getMessage(), PHP_EOL; 34 | } 35 | ?> 36 | --EXPECTF-- 37 | object(CairoMatrix)#%d (0) { 38 | } 39 | CairoMatrix::initRotate() expects exactly 1 parameter, 0 given 40 | CairoMatrix::initRotate() expects exactly 1 parameter, 2 given 41 | CairoMatrix::initRotate() expects parameter 1 to be double, array given -------------------------------------------------------------------------------- /tests/CairoContext/setAntialias.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoContext->setAntialias() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | setAntialias(CairoAntialias::MODE_GRAY); 16 | var_dump($context->getAntialias()); 17 | 18 | /* Wrong number args - 1 */ 19 | try { 20 | $context->setAntialias(1, 1); 21 | trigger_error('setAntialias requires 0 or 1 args'); 22 | } catch (CairoException $e) { 23 | echo $e->getMessage(), PHP_EOL; 24 | } 25 | 26 | /* Wrong args */ 27 | try { 28 | $context->setAntialias(array()); 29 | trigger_error('setAntialias requires int'); 30 | } catch (CairoException $e) { 31 | echo $e->getMessage(), PHP_EOL; 32 | } 33 | ?> 34 | --EXPECTF-- 35 | object(CairoImageSurface)#%d (0) { 36 | } 37 | object(CairoContext)#%d (0) { 38 | } 39 | int(2) 40 | CairoContext::setAntialias() expects at most 1 parameter, 2 given 41 | CairoContext::setAntialias() expects parameter 1 to be long, array given -------------------------------------------------------------------------------- /examples/font-matrix-translation.php: -------------------------------------------------------------------------------- 1 | save(); 6 | $ext = $con->textExtents($str); 7 | $sf = $con->getScaledFont(); 8 | $sext = $sf->textExtents("text"); 9 | $lw = $con->getLineWidth(); 10 | $con->rectangle($x + $ext["x_bearing"]-$lw/2, $y + $ext["y_bearing"] - $lw/2, $ext["width"]+$lw, $ext["height"]+ $lw); 11 | $con->stroke(); 12 | $con->moveTo($x,$y); 13 | $con->showText($str); 14 | $con->restore(); 15 | } 16 | $sur = new CairoImageSurface(CairoFormat::ARGB32, 38, 34); 17 | $con = new CairoContext($sur); 18 | 19 | $con->setSourceRgb(1,1,1); 20 | $con->paint(); 21 | 22 | $con->selectFontFace("Bitstream Vera Sans"); 23 | $con->setFontSize(12); 24 | $con->translate(4,4); 25 | $con->setLineWidth(1); 26 | $ext = $con->textExtents("text"); 27 | 28 | $con->setSourceRgb(0,0,0); 29 | box_text("text", 0, -$ext["y_bearing"]); 30 | $mat = new CairoMatrix(); 31 | $mat->translate(6,16); 32 | $mat->scale(12,12); 33 | $con->setFontMatrix($mat); 34 | $con->setSourceRgb(0,0,1); 35 | box_text("text", 0, -$ext["y_bearing"]); 36 | 37 | $sur->writeToPng(dirname(__FILE__) . "/font-matrix-translation-php.png"); 38 | ?> 39 | 40 | -------------------------------------------------------------------------------- /tests/CairoMatrix/cairo_matrix_init_scale.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_matrix_init_scale function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 21 | --EXPECTF-- 22 | object(CairoMatrix)#%d (0) { 23 | } 24 | 25 | Warning: cairo_matrix_init_scale() expects exactly 2 parameters, 0 given in %s on line %d 26 | 27 | Warning: cairo_matrix_init_scale() expects exactly 2 parameters, 1 given in %s on line %d 28 | 29 | Warning: cairo_matrix_init_scale() expects exactly 2 parameters, 3 given in %s on line %d 30 | 31 | Warning: cairo_matrix_init_scale() expects parameter 1 to be double, array given in %s on line %d 32 | 33 | Warning: cairo_matrix_init_scale() expects parameter 2 to be double, array given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoMatrix/cairo_matrix_invert.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_matrix_invert function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 27 | --EXPECTF-- 28 | object(CairoMatrix)#%d (0) { 29 | } 30 | 31 | Warning: cairo_matrix_invert() expects exactly 1 parameter, 0 given in %s on line %d 32 | 33 | Warning: cairo_matrix_invert() expects exactly 1 parameter, 2 given in %s on line %d 34 | CAUGHT ERROR: Argument 1 passed to cairo_matrix_invert() must be an instance of CairoMatrix, integer given 35 | 36 | Warning: cairo_matrix_invert() expects parameter 1 to be CairoMatrix, integer given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoPattern/getMatrix.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoPattern->getMatrix() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getMatrix()); 13 | 14 | $matrix = new CairoMatrix(5, 5); 15 | var_dump($matrix); 16 | var_dump($orig_matrix === $matrix); 17 | 18 | $pattern->setMatrix($matrix); 19 | var_dump($matrix1 = $pattern->getMatrix()); 20 | var_dump($matrix1 === $matrix); 21 | var_dump($orig_matrix === $matrix); 22 | 23 | try { 24 | $pattern->getMatrix('foo'); 25 | trigger_error('get matrix requires no args'); 26 | } catch (CairoException $e) { 27 | echo $e->getMessage(), PHP_EOL; 28 | } 29 | 30 | die; // DO NOT REMOVE THIS - fixes issue in 5.3 with GC giving bogus memleak reports 31 | ?> 32 | --EXPECTF-- 33 | object(CairoSolidPattern)#%d (0) { 34 | } 35 | object(CairoMatrix)#%d (0) { 36 | } 37 | object(CairoMatrix)#%d (0) { 38 | } 39 | bool(false) 40 | object(CairoMatrix)#%d (0) { 41 | } 42 | bool(true) 43 | bool(false) 44 | CairoPattern::getMatrix() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoPattern/CairoSolidPattern/getRgba.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | CairoSolidPattern->getRgba() method 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getRgba(); 18 | var_dump($values); 19 | var_dump($red === $values['red']); 20 | var_dump($green === $values['green']); 21 | var_dump($blue === $values['blue']); 22 | var_dump($alpha === $values['alpha']); 23 | 24 | /* Total number of args needed = 0 */ 25 | try { 26 | $pattern->getRgba(1); 27 | trigger_error('getRgba with too many args'); 28 | } catch (CairoException $e) { 29 | echo $e->getMessage(), PHP_EOL; 30 | } 31 | ?> 32 | --EXPECTF-- 33 | object(CairoSolidPattern)#%d (0) { 34 | } 35 | array(4) { 36 | ["red"]=> 37 | float(0.8) 38 | ["green"]=> 39 | float(0.6) 40 | ["blue"]=> 41 | float(0.5) 42 | ["alpha"]=> 43 | float(0.7) 44 | } 45 | bool(true) 46 | bool(true) 47 | bool(true) 48 | bool(true) 49 | CairoSolidPattern::getRgba() expects exactly 0 parameters, 1 given -------------------------------------------------------------------------------- /tests/CairoFontFace/CairoWin32FontFace/cairo_win32_font_face_create.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_win32_font_face_create() function 3 | --SKIPIF-- 4 | 10 | --FILE-- 11 | 'Impact', 14 | 'lfWeight' => CairoWin32FontWeight::BOLD 15 | ); 16 | 17 | $font_face = cairo_win32_font_face_create(); 18 | var_dump($font_face); 19 | 20 | $font_face = cairo_win32_font_face_create($f_opts); 21 | var_dump($font_face); 22 | 23 | $font_face = cairo_win32_font_face_create(1); 24 | var_dump($font_face); 25 | 26 | $font_face = cairo_win32_font_face_create($f_opts, 1); 27 | var_dump($font_face); 28 | 29 | ?> 30 | --EXPECTF-- 31 | object(CairoWin32FontFace)#%d (0) { 32 | } 33 | object(CairoWin32FontFace)#%d (0) { 34 | } 35 | 36 | Warning: cairo_win32_font_face_create() expects parameter 1 to be array, integer given in %s on line %d 37 | NULL 38 | 39 | Warning: cairo_win32_font_face_create() expects at most 1 parameter, 2 given in %s on line %d 40 | NULL -------------------------------------------------------------------------------- /tests/CairoFontFace/cairo_font_face_get_type.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_font_face_get_type() function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 28 | --EXPECTF-- 29 | object(CairoToyFontFace)#%d (0) { 30 | } 31 | int(0) 32 | 33 | Warning: cairo_font_face_get_type() expects exactly 1 parameter, 0 given in %s on line %d 34 | CAUGHT ERROR: Argument 1 passed to cairo_font_face_get_type() must be an instance of CairoFontFace, integer given 35 | 36 | Warning: cairo_font_face_get_type() expects parameter 1 to be CairoFontFace, integer given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoMatrix/cairo_matrix_init_translate.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_matrix_init_translate function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 21 | --EXPECTF-- 22 | object(CairoMatrix)#%d (0) { 23 | } 24 | 25 | Warning: cairo_matrix_init_translate() expects exactly 2 parameters, 0 given in %s on line %d 26 | 27 | Warning: cairo_matrix_init_translate() expects exactly 2 parameters, 1 given in %s on line %d 28 | 29 | Warning: cairo_matrix_init_translate() expects exactly 2 parameters, 3 given in %s on line %d 30 | 31 | Warning: cairo_matrix_init_translate() expects parameter 1 to be double, array given in %s on line %d 32 | 33 | Warning: cairo_matrix_init_translate() expects parameter 2 to be double, array given in %s on line %d -------------------------------------------------------------------------------- /tests/CairoSurface/CairoImageSurface/cairo_image_surface_create_from_png.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | cairo_image_surface_create_from_png() function 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 23 | --EXPECTF-- 24 | object(CairoImageSurface)#%d (0) { 25 | } 26 | object(CairoImageSurface)#%d (0) { 27 | } 28 | 29 | Warning: cairo_image_surface_create_from_png() expects exactly 1 parameter, 0 given in %s on line %d 30 | 31 | Warning: cairo_image_surface_create_from_png() expects exactly 1 parameter, 2 given in %s on line %d 32 | 33 | Warning: cairo_image_surface_create_from_png() expects parameter 1 to be a string or a stream resource in %s on line %d --------------------------------------------------------------------------------