Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (26 sloc) 0.655 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php
$width = 8;
$height = 8;
$sur = new CairoImageSurface(CairoFormat::ARGB32, $width, $height);
$con = new CairoContext($sur);
$s = new CairoImageSurface(CairoFormat::A8,$width,$height);
$str="";
$stride = $s->getStride();

for($i=0; $i<8; $i++) {
$str=$str . chr(0);
$str=$str . chr(0);
$str=$str . chr(255);
$str=$str . chr(0);
$str=$str . chr(255);
$str=$str . chr(0);
$str=$str . chr(0);
$str=$str . chr(0);
}

echo $str;
$s->createForData($str, CairoFormat::A8, $width, $height);
$con->setSourceRgb(0,0,1);
$con->paint();

$con->setSourceRgb(1,0,0);
$con->maskSurface($s,0,0);
$sur->writeToPng(dirname(__FILE__) . "/a8-mask-php.png");
?>
Something went wrong with that request. Please try again.