Last commit for examples/imlib_filter.php: d0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5

- initial import

pp [2004-05-19 04:59:31]
- initial import


git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a
<?php

function relief($im)
{
	$filter=imlib_create_filter();

      imlib_filter_set_red  ($filter, -1, -1, 0, -1, -1, -1);
      imlib_filter_set_red  ($filter,  0,  0, 0,  1,  1,  1);
      imlib_filter_set_green($filter, -1, -1, 0, -1, -1, -1);
      imlib_filter_set_green($filter,  0,  0, 0,  1,  1,  1);
      imlib_filter_set_blue ($filter, -1, -1, 0, -1, -1, -1);
      imlib_filter_set_blue ($filter,  0,  0, 0,  1,  1,  1);

      imlib_filter_constants($filter, 0, 768, 768, 768);
      imlib_filter_divisors ($filter, 0,   6,   6,   6);

	imlib_image_filter($im,$filter);

	imlib_free_filter($filter);
}

function edge_detect($im)
{
	$filter=imlib_create_filter();

      imlib_filter_set($filter, -1, -1, 0, -1, -1, -1);
      imlib_filter_set($filter, -1,  0, 0, -3, -3, -3);
      imlib_filter_set($filter, -1,  1, 0, -1, -1, -1);
      imlib_filter_set($filter,  0, -1, 0, -3, -3, -3);
      imlib_filter_set($filter,  0,  0, 0, 16, 16, 16);
      imlib_filter_set($filter,  0,  1, 0, -3, -3, -3);
      imlib_filter_set($filter,  1, -1, 0, -1, -1, -1);
      imlib_filter_set($filter,  1,  0, 0, -3, -3, -3);
      imlib_filter_set($filter,  1,  1, 0, -1, -1, -1);
      imlib_filter_divisors ($filter, 0,   3,   3,   3);

	imlib_image_filter($im,$filter);

	imlib_free_filter($filter);
}

$im = imlib_load_image('test.jpg');
$w=imlib_image_get_width($im);
$h=imlib_image_get_height($im);
$im2 = imlib_clone_image($im);

edge_detect($im);
relief($im2);

imlib_blend_image_onto_image($im,$im2,0,$w/2,0,$w/2,$h,$w/2,0,$w/2,$h,0,1,0);

Header('Content-type: image/jpeg');

imlib_dump_image($im);
imlib_free_image($im);
imlib_free_image($im2);

?>
ViewGit