Update v1.0.6

This commit is contained in:
Bhanu Slathia
2016-02-16 23:22:09 +05:30
parent 62d04a0372
commit c710c20b9e
7620 changed files with 244752 additions and 1070312 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 B

View File

@@ -0,0 +1,66 @@
<?php
/**
* @package Demos
*/
?>
<form style="font-family: Verdana, Tahoma; font-size: 11px">
<input type="hidden" name="demo" value="<?php echo $activeDemo->name; ?>" />
<div style="background-color: #f0f0f0; padding: 5px;">
<input type="submit" value="refresh" />
<?php
foreach ($activeDemo->fields as $field)
$field->render();
?>
<br />
<span style="font-family: Verdana, Tahoma; font-size: 11px">
Read the <a href="../doc/WideImage/WideImage_Image.html#method<?php echo $activeDemo->name; ?>">API documentation</a> for this operation.
</span>
<div style="background-color: #d0d0d0; padding: 5px; text-align: right; float: right; width: 300px;">
<?php
$top_form['output']->render();
echo "<br />\n";
echo ' Palette options (only for <em>png8</em> and <em>gif</em> output):<br />';
$top_form['ncolors']->render();
echo "<br />\n";
$top_form['dither']->render();
$top_form['match_palette']->render();
?>
</div>
</div>
</form>
<?php
$activeDemo->text();
?>
<?php
$images_in_row = 2;
$in_row = 0;
$images = array();
$di = new DirectoryIterator(dirname(__FILE__) . '/images/');
foreach ($di as $file)
if (!$file->isDot() && strpos($file->getFilename(), '.') !== 0)
$images[] = $file->getFilename();
asort($images);
foreach ($images as $image_file)
{
echo '<div class="images">';
echo '<img src="images/' . $image_file . '" />';
$img_url = 'image.php?image=' . $image_file . '&output=' . $top_form['output']->value .
'&colors=' . $top_form['ncolors']->value . '&dither=' . $top_form['dither']->value .
'&match_palette=' . $top_form['match_palette']->value . '&demo=' . $activeDemo->name;
foreach ($activeDemo->fields as $field)
$img_url .= '&' . $field->getURLValue();
echo '&nbsp;';
echo '<a href="' . $img_url . '">';
echo '<img src="' . $img_url . '" />';
echo '</a>';
echo "</div>\n";
}
?>
<div style="clear: both"></div>

View File

@@ -0,0 +1,19 @@
<?php
/**
* @package Demos
*/
class Demo_addNoise extends Demo
{
public $order = 9350;
function init()
{
$this->addField(new IntField('amount', 300));
$this->addField(new SelectField('type', array('salt&pepper','mono','color'), 'mono'));
}
function execute($image, $request)
{
return $image->addNoise($this->fields['amount']->value, $this->fields['type']->value);
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* @package Demos
*/
class Demo_applyConvolution extends Demo
{
public $order = 2025;
protected $base_matrix = array(array(2, 0, 0), array(0, -1, 0), array(0, 0, -1));
function init()
{
$this->addField(new Field('matrix', '2 0 0, 0 -1 0, 0 0 -1', '3x3 float matrix; separate rows with a comma, and columns with a space'));
$this->addField(new FloatField('div', 1));
$this->addField(new FloatField('offset', 220));
}
function execute($image, $request)
{
$mstr = $this->fval('matrix');
$rows = explode(',', $mstr);
$matrix = array();
foreach ($this->base_matrix as $idx => $base_row)
{
$build_row = array();
if (isset($rows[$idx]))
{
$row = trim($rows[$idx]);
$cols = explode(' ', $row);
for ($c = 0; $c < 3; $c++)
if (isset($cols[$c]))
$build_row[] = floatval(trim($cols[$c]));
else
$build_row[] = $base_row[$c];
}
else
$build_row = $base_row;
$matrix[] = $build_row;
}
return $image->applyConvolution($matrix, $this->fval('div'), $this->fval('offset'));
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* @package Demos
*/
class Demo_applyFilter extends Demo
{
public $order = 2000;
function init()
{
$this->addField(new SelectField('filter', array(
'IMG_FILTER_NEGATE',
'IMG_FILTER_GRAYSCALE',
'IMG_FILTER_BRIGHTNESS',
'IMG_FILTER_CONTRAST',
'IMG_FILTER_COLORIZE',
'IMG_FILTER_EDGEDETECT',
'IMG_FILTER_EMBOSS',
'IMG_FILTER_GAUSSIAN_BLUR',
'IMG_FILTER_SELECTIVE_BLUR',
'IMG_FILTER_MEAN_REMOVAL',
'IMG_FILTER_SMOOTH'
))
);
$this->addField(new IntField('arg1', null));
$this->addField(new IntField('arg2', null));
$this->addField(new IntField('arg3', null));
}
function execute($image)
{
$filter = constant($this->fields['filter']->value);
$arg1 = $this->fields['arg1']->value;
$arg2 = $this->fields['arg2']->value;
$arg3 = $this->fields['arg3']->value;
return $image->applyFilter($filter, $arg1, $arg2, $arg3);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* @package Demos
*/
class Demo_applyMask extends Demo
{
public $order = 600;
function init()
{
$this->addField(new FileSelectField('mask', 'masks'));
$this->addField(new CoordinateField('left', 10));
$this->addField(new CoordinateField('top', '30%'));
if (!$this->request->get('mask'))
$this->request->set('mask', 'mask-circle.gif');
}
function execute($image)
{
$mask = WideImage::load(DEMO_PATH . 'masks/' . $this->fields['mask']->value);
$left = $this->fields['left']->value;
$top = $this->fields['top']->value;
return $image->applyMask($mask, $left, $top);
}
function getFormat()
{
return 'png';
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @package Demos
*/
class Demo_asGrayscale extends Demo
{
public $order = 300;
function execute($img, $request)
{
return $img->asGrayscale();
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @package Demos
*/
class Demo_asNegative extends Demo
{
public $order = 300;
function execute($img, $request)
{
return $img->asNegative();
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* @package Demos
*/
class Demo_autoCrop extends Demo
{
public $order = 1050;
function init()
{
$this->addField(new IntField('margin', 0));
$this->addField(new IntField('rgb_threshold', 0));
$this->addField(new IntField('pixel_cutoff', 1));
$this->addField(new IntField('base_color', null, 'Index of the color'));
}
function execute($image, $request)
{
$margin = $this->fields['margin']->value;
$rgb_threshold = $this->fields['rgb_threshold']->value;
$pixel_cutoff = $this->fields['pixel_cutoff']->value;
$base_color = $this->fields['base_color']->value;
return $image->autoCrop($margin, $rgb_threshold, $pixel_cutoff, $base_color);
}
}

View File

@@ -0,0 +1,19 @@
<?php
/**
* @package Demos
*/
class Demo_correctGamma extends Demo
{
public $order = 2050;
function init()
{
$this->addField(new FloatField('in_gamma', 1.1));
$this->addField(new FloatField('out_gamma', 3.7));
}
function execute($image, $request)
{
return $image->correctGamma($this->fval('in_gamma'), $this->fval('out_gamma'));
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* @package Demos
*/
class Demo_crop extends Demo
{
public $order = 1000;
function init()
{
$this->addField(new CoordinateField('left', 10));
$this->addField(new CoordinateField('top', 20));
$this->addField(new CoordinateField('width', 120));
$this->addField(new CoordinateField('height', 60));
}
function execute($image, $request)
{
$left = $this->fields['left']->value;
$top = $this->fields['top']->value;
$width = $this->fields['width']->value;
$height = $this->fields['height']->value;
return $image->crop($left, $top, $width, $height);
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @package Demos
*/
class Demo_flip extends Demo
{
public $order = 1200;
function execute($image, $request)
{
return $image->flip();
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* @package Demos
*/
class Demo_getCanvas extends Demo
{
public $order = 1300;
function init()
{
$this->addField(new Field('text', 'Hello world!'));
$this->addField(new CoordinateField('x', 'middle'));
$this->addField(new CoordinateField('y', 'bottom-5'));
$this->addField(new IntField('angle', 5));
$this->addField(new FileSelectField('font', 'fonts', array('show' => false, 'pattern' => '/(.*)\.ttf$/', 'default' => 'VeraSe.ttf')));
$this->addField(new IntField('size', 18));
}
function execute($image, $request)
{
$text = $this->fields['text']->value;
$x = $this->fields['x']->value;
$y = $this->fields['y']->value;
$angle = $this->fields['angle']->value;
$font = $this->fields['font']->value;
$font_size = $this->fields['size']->value;
$canvas = $image->getCanvas();
$canvas->filledRectangle(10, 10, 80, 40, $image->allocateColor(255, 127, 255));
$canvas->line(60, 80, 30, 100, $image->allocateColor(255, 0, 0));
$font_file = DEMO_PATH . 'fonts/' . $font;
$canvas->useFont($font_file, $font_size, $image->allocateColor(0, 0, 0));
$canvas->writeText("$x+1", "$y+1", $text, $angle);
$canvas->useFont($font_file, $font_size, $image->allocateColor(200, 220, 255));
$canvas->writeText($x, $y, $text, $angle);
return $image;
}
function et($name)
{
return htmlentities($this->fval($name));
}
function text()
{
echo "This demo executes:
<pre>
\$canvas->filledRectangle(10, 10, 80, 40, \$img->allocateColor(255, 127, 255));
\$canvas->line(60, 80, 30, 100, \$img->allocateColor(255, 0, 0));
\$canvas->useFont('{$this->et('font')}', '{$this->et('size')}', \$image->allocateColor(0, 0, 0));
\$canvas->writeText('{$this->et('x')}+1', '{$this->et('y')}+1', '{$this->et('text')}', {$this->et('angle')});
\$canvas->useFont('{$this->et('font')}', '{$this->et('size')}', \$image->allocateColor(200, 220, 255));
\$canvas->writeText('{$this->et('x')}', '{$this->et('y')}', '{$this->et('text')}', {$this->et('angle')});
</pre>";
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* @package Demos
*/
class Demo_getChannels extends Demo
{
public $order = 500;
protected $channels = array('red', 'green', 'blue', 'alpha');
function init()
{
$this->addField(new CheckboxField('red', true));
$this->addField(new CheckboxField('green', false));
$this->addField(new CheckboxField('blue', true));
$this->addField(new CheckboxField('alpha', false));
}
function execute($img, $request)
{
$on = array();
foreach ($this->channels as $name)
if ($this->fields[$name]->value)
$on[] = $name;
return $img->getChannels($on);
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @package Demos
*/
class Demo_getMask extends Demo
{
public $order = 550;
function execute($img, $request)
{
return $img->getMask();
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* @package Demos
*/
class Demo_merge extends Demo
{
public $order = 800;
function init()
{
$this->addField(new FileSelectField('overlay', 'images', array('default' => '6-logo.gif')));
$this->addField(new CoordinateField('left', 'right-10'));
$this->addField(new CoordinateField('top', 'bottom-15%'));
$this->addField(new IntField('opacity', 50));
}
function execute($image, $request)
{
$overlay = WideImage::load(DEMO_PATH . 'images/' . $this->fields['overlay']->value);
$left = $this->fields['left']->value;
$top = $this->fields['top']->value;
$opacity = $this->fields['opacity']->value;
return $image->merge($overlay, $left, $top, $opacity);
}
function text()
{
echo "For alpha images, set opacity=100, otherwise alpha channel won't work.";
}
}

View File

@@ -0,0 +1,13 @@
<?php
/**
* @package Demos
*/
class Demo_mirror extends Demo
{
public $order = 1150;
function execute($image, $request)
{
return $image->mirror();
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* @package Demos
*/
class Demo_resize extends Demo
{
public $order = 900;
function init()
{
$this->addField(new CoordinateField('width', 120));
$this->addField(new CoordinateField('height', null));
$this->addField(new SelectField('fit', array('inside', 'fill', 'outside')));
$this->addField(new SelectField('scale', array('any', 'down', 'up')));
}
function execute($image, $request)
{
$width = $this->fields['width']->value;
$height = $this->fields['height']->value;
$fit = $this->fields['fit']->value;
$scale = $this->fields['scale']->value;
return $image->resize($width, $height, $fit, $scale);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* @package Demos
*/
class Demo_resizeCanvas extends Demo
{
public $order = 910;
function init()
{
$this->addField(new CoordinateField('width', '100%+30'));
$this->addField(new CoordinateField('height', 200));
$this->addField(new CoordinateField('left', '2'));
$this->addField(new CoordinateField('top', 'bottom-10'));
$this->addField(new ColorField('color', 'ffffff'));
$this->addField(new SelectField('scale', array('any', 'down', 'up'), 'any'));
$this->addField(new CheckboxField('merge', false, "Merge or copy over"));
}
function execute($image, $request)
{
$width = $this->fields['width']->value;
$height = $this->fields['height']->value;
$left = $this->fields['left']->value;
$top = $this->fields['top']->value;
$color = $this->fields['color']->value;
$scale = $this->fields['scale']->value;
$merge = $this->fields['merge']->value;
return $image->resizeCanvas($width, $height, $left, $top, $color ? hexdec($color) : null, $scale, $merge);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @package Demos
*/
class Demo_rotate extends Demo
{
public $order = 1100;
function init()
{
$this->addField(new AngleField('angle', 25));
$this->addField(new ColorField('color', ''));
}
function execute($image, $request)
{
$angle = $this->fields['angle']->value;
$color = $this->fields['color']->value;
return $image->rotate($angle, $color ? hexdec($color) : null);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* @package Demos
*/
class Demo_roundCorners extends Demo
{
public $order = 1075;
function init()
{
$this->addField(new IntField('radius', 30));
$this->addField(new ColorField('color', 'ffffff'));
$this->addField(new IntField('smoothness', 2));
$this->addField(new CheckboxField('top-left', true));
$this->addField(new CheckboxField('top-right', true));
$this->addField(new CheckboxField('bottom-right', true));
$this->addField(new CheckboxField('bottom-left', true));
}
function execute($image, $request)
{
$color = $this->fields['color']->value;
$radius = $this->fields['radius']->value;
$smoothness = $this->fields['smoothness']->value;
$corners = 0;
if ($this->fval('top-left'))
$corners += WideImage::SIDE_TOP_LEFT;
if ($this->fval('top-right'))
$corners += WideImage::SIDE_TOP_RIGHT;
if ($this->fval('bottom-right'))
$corners += WideImage::SIDE_BOTTOM_RIGHT;
if ($this->fval('bottom-left'))
$corners += WideImage::SIDE_BOTTOM_LEFT;
return $image->roundCorners($radius, $color ? hexdec($color) : null, $smoothness, $corners);
}
}

View File

@@ -0,0 +1,20 @@
<?php
/**
* @package Demos
*/
class Demo_unsharp extends Demo
{
public $order = 1350;
function init()
{
$this->addField(new IntField('amount', 300));
$this->addField(new IntField('radius', 3));
$this->addField(new IntField('threshold', 2));
}
function execute($image, $request)
{
return $image->unsharp($this->fields['amount']->value, $this->fields['radius']->value, $this->fields['threshold']->value);
}
}

View File

@@ -0,0 +1,99 @@
<?php
include('../lib/WideImage.php');
$img = WideImage::createTrueColorImage(400, 200);
$canvas = $img->getCanvas();
$canvas->useFont('fonts/Vera.ttf', 36, $img->allocateColor(255, 0, 0));
$canvas->writeText('left', 'top', 'abc', 0);
$canvas->writeText('right', 'top', 'def', 15);
$canvas->writeText('right', 'bottom', 'ghi', 30);
$canvas->writeText('left', 'bottom', 'jkl', 45);
$canvas->writeText('center', 'center', 'mno', 60);
$img->output('png');
exit;
// Create a 300x150 image
$im = imagecreatetruecolor(600, 350);
$black = imagecolorallocate($im, 0, 0, 0);
$bgcolor = imagecolorallocate($im, 255, 255, 0);
// Set the background to be white
imagefilledrectangle($im, 0, 0, imagesx($im), imagesy($im), $bgcolor);
// Path to our font file
$font = './fonts/Vera.ttf';
$angle = 340;
$font_size = 20;
$text = 'jW| asdkasdlk alk,.,wedwer|w[r=?';
$text = '#j';
// First we create our bounding box
$bbox = imageftbbox($font_size, $angle, $font, $text);
function normalize_bbox($bbox)
{
return array(
'up-left' => array('x' => $bbox[6], 'y' => $bbox[7]),
'up-right' => array('x' => $bbox[4], 'y' => $bbox[5]),
'down-left' => array('x' => $bbox[0], 'y' => $bbox[1]),
'down-right' => array('x' => $bbox[2], 'y' => $bbox[3]),
);
}
function outer_box($box)
{
return array(
'left' => min($box['up-left']['x'], $box['up-right']['x'], $box['down-left']['x'], $box['down-right']['x']),
'top' => min($box['up-left']['y'], $box['up-right']['y'], $box['down-left']['y'], $box['down-right']['y']),
'right' => max($box['up-left']['x'], $box['up-right']['x'], $box['down-left']['x'], $box['down-right']['x']),
'bottom' => max($box['up-left']['y'], $box['up-right']['y'], $box['down-left']['y'], $box['down-right']['y'])
);
}
$box = normalize_bbox($bbox);
// This is our cordinates for X and Y
#$x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) - 5;
#$y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5;
#$x = 300;
#$y = 175;
$obox = outer_box(normalize_bbox(imageftbbox($font_size, $angle, $font, '')));
$obox = outer_box(normalize_bbox(imageftbbox($font_size, $angle, $font, $text)));
#$x = imagesx($im) - $obox['right'] - 1;
#$y = imagesy($im) - $obox['bottom'] - 1;
$x = 0;
$y = 0;
$gc = imagecolorallocate($im, 255, 200, 200);
imageline($im, imagesx($im) / 2, 0, imagesx($im) / 2, imagesy($im), $gc);
imageline($im, 0, imagesy($im) / 2, imagesx($im), imagesy($im) / 2, $gc);
imagefttext($im, $font_size, $angle, $x, $y, $black, $font, $text);
#imagefttext($im, $font_size, $angle, $x, $y, $black, $font, 'aj');
$c = imagecolorallocate($im, 0, 255, 0);
imageline($im, $box['up-left']['x'] + $x, $box['up-left']['y'] + $y, $box['up-right']['x'] + $x, $box['up-right']['y'] + $y, $c);
imageline($im, $box['up-right']['x'] + $x, $box['up-right']['y'] + $y, $box['down-right']['x'] + $x, $box['down-right']['y'] + $y, $c);
imageline($im, $box['down-right']['x'] + $x, $box['down-right']['y'] + $y, $box['down-left']['x'] + $x, $box['down-left']['y'] + $y, $c);
imageline($im, $box['down-left']['x'] + $x, $box['down-left']['y'] + $y, $box['up-left']['x'] + $x, $box['up-left']['y'] + $y, $c);
$c = imagecolorallocate($im, 0, 127, 255);
$obox = outer_box($box);
imageline($im, $obox['left'] + $x, $obox['top'] + $y, $obox['right'] + $x, $obox['top'] + $y, $c);
imageline($im, $obox['right'] + $x, $obox['top'] + $y, $obox['right'] + $x, $obox['bottom'] + $y, $c);
imageline($im, $obox['right'] + $x, $obox['bottom'] + $y, $obox['left'] + $x, $obox['bottom'] + $y, $c);
imageline($im, $obox['left'] + $x, $obox['bottom'] + $y, $obox['left'] + $x, $obox['top'] + $y, $c);
imagefilledellipse($im, $x, $y, 3, 3, imagecolorallocate($im, 255, 0, 0));
// Output to browser
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

View File

@@ -0,0 +1,124 @@
Bitstream Vera Fonts Copyright
The fonts have a generous copyright, allowing derivative works (as
long as "Bitstream" or "Vera" are not in the names), and full
redistribution (so long as they are not *sold* by themselves). They
can be be bundled, redistributed and sold with any software.
The fonts are distributed under the following copyright:
Copyright
=========
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
Vera is a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute
the Font Software, including without limitation the rights to use,
copy, merge, publish, distribute, and/or sell copies of the Font
Software, and to permit persons to whom the Font Software is furnished
to do so, subject to the following conditions:
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Bitstream" or the word "Vera".
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Bitstream Vera" names.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font
Software without prior written authorization from the Gnome Foundation
or Bitstream Inc., respectively. For further information, contact:
fonts at gnome dot org.
Copyright FAQ
=============
1. I don't understand the resale restriction... What gives?
Bitstream is giving away these fonts, but wishes to ensure its
competitors can't just drop the fonts as is into a font sale system
and sell them as is. It seems fair that if Bitstream can't make money
from the Bitstream Vera fonts, their competitors should not be able to
do so either. You can sell the fonts as part of any software package,
however.
2. I want to package these fonts separately for distribution and
sale as part of a larger software package or system. Can I do so?
Yes. A RPM or Debian package is a "larger software package" to begin
with, and you aren't selling them independently by themselves.
See 1. above.
3. Are derivative works allowed?
Yes!
4. Can I change or add to the font(s)?
Yes, but you must change the name(s) of the font(s).
5. Under what terms are derivative works allowed?
You must change the name(s) of the fonts. This is to ensure the
quality of the fonts, both to protect Bitstream and Gnome. We want to
ensure that if an application has opened a font specifically of these
names, it gets what it expects (though of course, using fontconfig,
substitutions could still could have occurred during font
opening). You must include the Bitstream copyright. Additional
copyrights can be added, as per copyright law. Happy Font Hacking!
6. If I have improvements for Bitstream Vera, is it possible they might get
adopted in future versions?
Yes. The contract between the Gnome Foundation and Bitstream has
provisions for working with Bitstream to ensure quality additions to
the Bitstream Vera font family. Please contact us if you have such
additions. Note, that in general, we will want such additions for the
entire family, not just a single font, and that you'll have to keep
both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add
glyphs to the font, they must be stylistically in keeping with Vera's
design. Vera cannot become a "ransom note" font. Jim Lyles will be
providing a document describing the design elements used in Vera, as a
guide and aid for people interested in contributing to Vera.
7. I want to sell a software package that uses these fonts: Can I do so?
Sure. Bundle the fonts with your software and sell your software
with the fonts. That is the intent of the copyright.
8. If applications have built the names "Bitstream Vera" into them,
can I override this somehow to use fonts of my choosing?
This depends on exact details of the software. Most open source
systems and software (e.g., Gnome, KDE, etc.) are now converting to
use fontconfig (see www.fontconfig.org) to handle font configuration,
selection and substitution; it has provisions for overriding font
names and subsituting alternatives. An example is provided by the
supplied local.conf file, which chooses the family Bitstream Vera for
"sans", "serif" and "monospace". Other software (e.g., the XFree86
core server) has other mechanisms for font substitution.

View File

@@ -0,0 +1,11 @@
Contained herin is the Bitstream Vera font family.
The Copyright information is found in the COPYRIGHT.TXT file (along
with being incoporated into the fonts themselves).
The releases notes are found in the file "RELEASENOTES.TXT".
We hope you enjoy Vera!
Bitstream, Inc.
The Gnome Project

View File

@@ -0,0 +1,162 @@
Bitstream Vera Fonts - April 16, 2003
=====================================
The version number of these fonts is 1.10 to distinguish them from the
beta test fonts.
Note that the Vera copyright is incorporated in the fonts themselves.
The License field in the fonts contains the copyright license as it
appears below. The TrueType copyright field is not large enough to
contain the full license, so the license is incorporated (as you might
think if you thought about it) into the license field, which
unfortunately can be obscure to find. (In pfaedit, see: Element->Font
Info->TTFNames->License).
Our apologies for it taking longer to complete the fonts than planned.
Beta testers requested a tighter line spacing (less leading) and Jim
Lyles redesigned Vera's accents to bring its line spacing to more
typical of other fonts. This took additional time and effort. Our
thanks to Jim for this effort above and beyond the call of duty.
There are four monospace and sans faces (normal, oblique, bold, bold
oblique) and two serif faces (normal and bold). Fontconfig/Xft2 (see
www.fontconfig.org) can artificially oblique the serif faces for you:
this loses hinting and distorts the faces slightly, but is visibly
different than normal and bold, and reasonably pleasing.
On systems with fontconfig 2.0 or 2.1 installed, making your sans,
serif and monospace fonts default to these fonts is very easy. Just
drop the file local.conf into your /etc/fonts directory. This will
make the Bitstream fonts your default fonts for all applications using
fontconfig (if sans, serif, or monospace names are used, as they often
are as default values in many desktops). The XML in local.conf may
need modification to enable subpixel decimation, if appropriate,
however, the commented out phrase does so for XFree86 4.3, in the case
that the server does not have sufficient information to identify the
use of a flat panel. Fontconfig 2.2 adds Vera to the list of font
families and will, by default use it as the default sans, serif and
monospace fonts.
During the testing of the final Vera fonts, we learned that screen
fonts in general are only typically hinted to work correctly at
integer pixel sizes. Vera is coded internally for integer sizes only.
We need to investigate further to see if there are commonly used fonts
that are hinted to be rounded but are not rounded to integer sizes due
to oversights in their coding.
Most fonts work best at 8 pixels and below if anti-aliased only, as
the amount of work required to hint well at smaller and smaller sizes
becomes astronomical. GASP tables are typically used to control
whether hinting is used or not, but Freetype/Xft does not currently
support GASP tables (which are present in Vera).
To mitigate this problem, both for Vera and other fonts, there will be
(very shortly) a new fontconfig 2.2 release that will, by default not
apply hints if the size is below 8 pixels. if you should have a font
that in fact has been hinted more agressively, you can use fontconfig
to note this exception. We believe this should improve many hinted
fonts in addition to Vera, though implemeting GASP support is likely
the right long term solution.
Font rendering in Gnome or KDE is the combination of algorithms in
Xft2 and Freetype, along with hinting in the fonts themselves. It is
vital to have sufficient information to disentangle problems that you
may observe.
Note that having your font rendering system set up correctly is vital
to proper judgement of problems of the fonts:
* Freetype may or may not be configured to in ways that may
implement execution of possibly patented (in some parts of the world)
TrueType hinting algorithms, particularly at small sizes. Best
results are obtained while using these algorithms.
* The freetype autohinter (used when the possibly patented
algorithms are not used) continues to improve with each release. If
you are using the autohinter, please ensure you are using an up to
date version of freetype before reporting problems.
* Please identify what version of freetype you are using in any
bug reports, and how your freetype is configured.
* Make sure you are not using the freetype version included in
XFree86 4.3, as it has bugs that significantly degrade most fonts,
including Vera. if you build XFree86 4.3 from source yourself, you may
have installed this broken version without intending it (as I
did). Vera was verified with the recently released Freetype 2.1.4. On
many systems, 'ldd" can be used to see which freetype shared library
is actually being used.
* Xft/X Render does not (yet) implement gamma correction. This
causes significant problems rendering white text on a black background
(causing partial pixels to be insufficiently shaded) if the gamma of
your monitor has not been compensated for, and minor problems with
black text on a while background. The program "xgamma" can be used to
set a gamma correction value in the X server's color pallette. Most
monitors have a gamma near 2.
* Note that the Vera family uses minimal delta hinting. Your
results on other systems when not used anti-aliased may not be
entirely satisfying. We are primarily interested in reports of
problems on open source systems implementing Xft2/fontconfig/freetype
(which implements antialiasing and hinting adjustements, and
sophisticated subpixel decimation on flatpanels). Also, the
algorithms used by Xft2 adjust the hints to integer widths and the
results are crisper on open source systems than on Windows or
MacIntosh.
* Your fontconfig may (probably does) predate the release of
fontconfig 2.2, and you may see artifacts not present when the font is
used at very small sizes with hinting enabled. "vc-list -V" can be
used to see what version you have installed.
We believe and hope that these fonts will resolve the problems
reported during beta test. The largest change is the reduction of
leading (interline spacing), which had annoyed a number of people, and
reduced Vera's utility for some applcations. The Vera monospace font
should also now make '0' and 'O' and '1' and 'l' more clearly
distinguishable.
The version of these fonts is version 1.10. Fontconfig should be
choosing the new version of the fonts if both the released fonts and
beta test fonts are installed (though please discard them: they have
names of form tt20[1-12]gn.ttf). Note that older versions of
fontconfig sometimes did not rebuild their cache correctly when new
fonts are installed: please upgrade to fontconfig 2.2. "fc-cache -f"
can be used to force rebuilding fontconfig's cache files.
If you note problems, please send them to fonts at gnome dot org, with
exactly which face and size and unicode point you observe the problem
at. The xfd utility from XFree86 CVS may be useful for this (e.g. "xfd
-fa sans"). A possibly more useful program to examine fonts at a
variety of sizes is the "waterfall" program found in Keith Packard's
CVS.
$ cvs -d :pserver:anoncvs@keithp.com:/local/src/CVS login
Logging in to :pserver:anoncvs@keithp.com:2401/local/src/CVS
CVS password: <hit return>
$ cvs -d :pserver:anoncvs@keithp.com:/local/src/CVS co waterfall
$ cd waterfall
$ xmkmf -a
$ make
# make install
# make install.man
Again, please make sure you are running an up-to-date freetype, and
that you are only examining integer sizes.
Reporting Problems
==================
Please send problem reports to fonts at gnome org, with the following
information:
1. Version of Freetype, Xft2 and fontconfig
2. Whether TT hinting is being used, or the autohinter
3. Application being used
4. Character/Unicode code point that has problems (if applicable)
5. Version of which operating system
6. Please include a screenshot, when possible.
Please check the fonts list archives before reporting problems to cut
down on duplication.

View File

@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts.conf file to configure system font access -->
<fontconfig>
<!-- Enable sub-pixel rendering
<match target="font">
<test qual="all" name="rgba">
<const>unknown</const>
</test>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
-->
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
</prefer>
</alias>
</fontconfig>

View File

@@ -0,0 +1,11 @@
<?php
/**
* @package Demos
*/
class AngleField extends IntField
{
function __construct($name, $default, $hint = 'In degrees clockwise, negative values accepted')
{
parent::__construct($name, $default, $hint);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @package Demos
*/
class CheckboxField extends Field
{
function init($request)
{
$this->value = $request->get($this->name, $this->default ? '1' : null) === '1';
}
function renderBody($name, $id)
{
if ($this->value)
$chk = 'checked="checked"';
else
$chk = '';
echo '<input type="hidden" name="' . $name . '" id="' . $id . '_val" value="' . ($this->value ? '1' : '') . '" />';
echo '<input type="checkbox" ' . $chk . ' name="' . $name . '_cb" id="' . $id . '" value="1" onclick="document.getElementById(\'' . $id . '_val\').value = Number(this.checked);" />';
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* @package Demos
*/
class CheckboxSetField extends Field
{
public $options;
public $request;
function __construct($name, $options)
{
$this->name = $name;
$this->options = $options;
}
function init($request)
{
$this->value = array();
if (is_array($request->get($this->name)))
foreach ($request->get($this->name) as $val)
if (in_array($val, $this->options))
$this->value[] = $val;
}
function render()
{
$request = $this->request;
foreach ($this->options as $option)
{
if (is_array($request->get($this->name)) && in_array($option, $request->get($this->name)))
$chk = 'checked="checked"';
else
$chk = '';
$name = $this->name . '[]';
$id = $this->name . '_' . $option;
echo '<input type="checkbox" ' . $chk . ' name="' . $name . '" id="' . $id . '" value="' . $option . '" />';
echo '<label for="' . $id . '">' . $option . '</label> ';
}
}
function getURLValue()
{
$v = '';
foreach ($this->value as $value)
$v .= $this->name . '[]=' . $value . '&';
return $v;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @package Demos
*/
class ColorField extends Field
{
function __construct($name, $default, $hint = 'RRGGBB hex, leave blank for transparent background')
{
parent::__construct($name, $default, $hint);
}
function init($request)
{
$c = $request->getColor($this->name, $this->default);
if ($c === '')
$this->value = null;
else
$this->value = str_pad(dechex(hexdec($c)), 6, '0', STR_PAD_LEFT);
}
function getRenderValue()
{
return $this->value;
}
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* @package Demos
*/
class CoordinateField extends Field
{
function __construct($name, $default, $hint = 'Smart coordinate')
{
parent::__construct($name, $default, $hint);
}
function init($request)
{
$this->value = $request->getCoordinate($this->name, $this->default);
if ($this->value > 1000)
$this->value = 1000;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* @package Demos
*/
class Demo
{
public $name;
public $format = null;
public $fields = array();
public $order = 1000;
function __construct($name)
{
$this->name = $name;
}
function init()
{
}
static function create($name)
{
$file = DEMO_PATH . '/demos/' . $name . '.php';
if (!file_exists($file))
throw new Exception("Invalid demo: {$name}");
include $file;
$className = 'Demo_' . $name;
$demo = new $className($name);
$demo->request = Request::getInstance();
$demo->init();
foreach ($demo->fields as $field)
{
$field->request = Request::getInstance();
$field->init(Request::getInstance());
}
return $demo;
}
function getFormat()
{
return 'as input';
}
function addField($field)
{
$this->fields[$field->name] = $field;
}
function __toString()
{
return $this->name;
}
function text()
{
}
function fval($name)
{
return $this->fields[$name]->value;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* @package Demos
*/
class Field
{
public $name;
public $default;
public $value;
public $request;
public $hint;
function __construct($name, $default = null, $hint = '')
{
$this->name = $name;
$this->default = $default;
if ($hint == '')
$hint = $name;
$this->hint = $hint;
}
function init($request)
{
$this->value = $request->get($this->name, $this->default);
}
function render()
{
$id = htmlentities($this->name);
echo '<label style="background-color: #c0c0c0; padding: 5px; margin: 2px;" for="imgparam_' . $id . '" title="' . htmlentities($this->hint) . '">';
echo $this->name . ': ';
$this->renderBody($id, 'imgparam_' . $id);
echo '</label> ';
}
function renderBody($name, $id)
{
echo '<input id="' . $id . '" type="text" size="15" name="' . $name . '" value="' . $this->getRenderValue() . '" />';
}
function getRenderValue()
{
return $this->value;
}
function getUrlValue()
{
return urlencode($this->name) . '=' . urlencode($this->value);
}
}

View File

@@ -0,0 +1,83 @@
<?php
/**
* @package Demos
*/
class FileSelectField extends Field
{
public $request;
public $files = array();
public $options;
function __construct($name, $path, $options = array())
{
$this->name = $name;
$this->path = $path;
$this->options = $options;
if (!isset($options['show']))
$this->options['show'] = true;
if (!isset($options['pattern']))
$this->options['pattern'] = '/(.*)/';
}
function init($request)
{
$this->value = null;
$di = new DirectoryIterator(DEMO_PATH . $this->path);
foreach ($di as $file)
if (!$file->isDot() && strpos($file->getFilename(), '.') !== 0 && preg_match($this->options['pattern'], $file->getFilename()))
{
$this->files[] = $file->getFilename();
if ($this->value === null && isset($this->options['default']) && $this->options['default'] == $file->getFilename())
$this->value = $this->options['default'];
if ($this->request->get($this->name) == $file->getFilename())
$this->value = $file->getFilename();
}
sort($this->files);
if (!$this->value && count($this->files) > 0)
$this->value = $this->files[0];
}
function renderBody($name, $id)
{
if ($this->options['show'])
{
$onch = "document.getElementById('sel_{$id}').src = '{$this->path}/' + this.options[this.selectedIndex].value;";
}
else
$onch = '';
echo '<select id="' . $id . '" name="' . $name . '" onchange="' . $onch . '">';
$selected_file = null;
foreach ($this->files as $file)
{
if ($this->value == $file)
{
$sel = 'selected="selected"';
$selected_file = $file;
}
else
$sel = '';
echo '<option ' . $sel . ' value="' . $file . '">' . $file . '</option>' . PHP_EOL;
}
echo '</select>';
if ($this->options['show'] && $selected_file)
{
echo '<div style="display: inline; min-width: 50px; min-height: 50px">';
echo '<img style="position: absolute" id="sel_' . $id . '" width="50" src="' . $this->path . '/' . $selected_file . '" /> ';
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo '</div>';
}
}
function getURLValue()
{
return $this->name . '=' . $this->value;
}
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* @package Demos
*/
class FloatField extends Field
{
function __construct($name, $default, $hint = 'Float')
{
parent::__construct($name, $default, $hint);
}
function init($request)
{
$this->value = $request->getFloat($this->name, $this->default);
}
}

View File

@@ -0,0 +1,11 @@
<?php
/**
* @package Demos
*/
class FormatSelectField extends SelectField
{
function __construct($name)
{
parent::__construct($name, array('preset for demo', 'as input', 'png8', 'png24', 'jpeg', 'gif', 'bmp'), null, 'Image format');
}
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* @package Demos
*/
class IntField extends Field
{
function __construct($name, $default, $hint = 'Integer')
{
parent::__construct($name, $default, $hint);
}
function init($request)
{
$this->value = $request->getInt($this->name, $this->default);
}
}

View File

@@ -0,0 +1,135 @@
<?php
/**
This file is part of WideImage.
WideImage is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
WideImage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with WideImage; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
/**
* @package Demos
*/
class Request
{
protected $vars = array();
protected static $instance;
static function getInstance()
{
if (self::$instance === null)
self::$instance = new Request;
return self::$instance;
}
protected function __construct()
{
$this->vars = $_GET;
/*
// have to rely on parsing QUERY_STRING, thanks to PHP
// http://bugs.php.net/bug.php?id=39078
// http://bugs.php.net/bug.php?id=45149
$all_vars = explode('&', $_SERVER['QUERY_STRING']);
foreach ($all_vars as $keyval)
{
if (strlen($keyval) == 0)
continue;
if (strpos($keyval, '=') === false)
{
$key = $keyval;
$value = true;
}
else
{
list($key, $value) = explode('=', $keyval);
#$value = str_replace('%2B', '[[PLUS]]', $value);
$value = urldecode($value);
#$value = str_replace('[[PLUS]]', '+', $value);
}
$this->vars[$key] = $value;
}
*/
}
function get($key, $default = null)
{
if (isset($this->vars[$key]))
return $this->vars[$key];
else
return $default;
}
function set($key, $value)
{
$this->vars[$key] = $value;
}
function getInt($key, $default = 0)
{
$value = self::get($key);
if (strlen($value) > 0)
return intval($value);
else
return $default;
}
function getFloat($key, $default = 0)
{
$value = self::get($key);
if (strlen($value) > 0)
return floatval($value);
else
return $default;
}
function getCoordinate($key, $default = 0)
{
$v = self::get($key);
if (strlen($v) > 0 && WideImage_Coordinate::parse($v) !== null)
return self::get($key);
else
return $default;
}
function getOption($key, $valid = array(), $default = null)
{
$value = self::get($key);
if ($value !== null && in_array($value, $valid))
return strval($value);
else
return $default;
}
function getColor($key, $default = '000000')
{
$value = self::get($key);
if (substr($value, 0, 1) == '#')
$value = substr($value, 1);
if ($value === '' || preg_match('~^[0-9a-f]{1,6}$~i', $value))
return $value;
else
return $default;
}
function getRegex($key, $regex, $default = null)
{
$value = self::get($key);
if ($value !== null && preg_match($regex, $value))
return $value;
else
return $default;
}
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* @package Demos
*/
class SelectField extends Field
{
public $options;
function __construct($name, $options, $default = null, $hint = null)
{
parent::__construct($name, $default, $hint);
$this->name = $name;
$this->options = $options;
if ($default === null)
$this->default = $options[0];
else
$this->default = $default;
}
function init($request)
{
$this->value = $this->default;
$v = str_replace('+', ' ', $request->get($this->name));
if (in_array($v, $this->options))
$this->value = $v;
}
function renderBody($name, $id)
{
echo '<select id="' . $id . '" name="' . $name . '">';
foreach ($this->options as $option)
{
if ($this->value == $option)
$sel = 'selected="selected"';
else
$sel = '';
echo '<option ' . $sel . ' value="' . $option . '">' . $option . '</option>';
}
echo '</select>';
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @package Demos
*/
define('DEMO_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR);
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
require_once DEMO_PATH . 'helpers/Request.php';
require_once DEMO_PATH . 'helpers/Demo.php';
require_once DEMO_PATH . 'helpers/Field.php';
require_once DEMO_PATH . 'helpers/CheckboxField.php';
require_once DEMO_PATH . 'helpers/FileSelectField.php';
require_once DEMO_PATH . 'helpers/CoordinateField.php';
require_once DEMO_PATH . 'helpers/IntField.php';
require_once DEMO_PATH . 'helpers/FloatField.php';
require_once DEMO_PATH . 'helpers/AngleField.php';
require_once DEMO_PATH . 'helpers/SelectField.php';
require_once DEMO_PATH . 'helpers/FormatSelectField.php';
require_once DEMO_PATH . 'helpers/ColorField.php';

View File

@@ -0,0 +1,52 @@
<?php
/**
* @package Demos
*/
require_once dirname(__FILE__) . '/helpers/common.php';
require_once dirname(__FILE__) . '/../lib/WideImage.php';
$request = Request::getInstance();
$demo = Demo::create($request->get('demo'));
$image = WideImage::load('images/' . $request->get('image'));
$result = $demo->execute($image, $request);
$output = new FormatSelectField('output');
$output->init(Request::getInstance());
if ($output->value == 'preset for demo')
$format = $demo->getFormat();
else
$format = $output->value;
if ($format === 'as input')
$format = substr($request->get('image'), -3);
$output = 24;
if ($format == 'png8')
{
$output = 8;
$format = 'png';
}
elseif ($format == 'png24')
$format = 'png';
elseif ($format == 'gif')
$output = 8;
if ($output == 8)
{
$ncolors = new IntField('colors', 255);
$ncolors->init(Request::getInstance());
$dither = new CheckboxField('dither', true);
$dither->init(Request::getInstance());
$match_palette = new CheckboxField('match_palette', true);
$match_palette->init(Request::getInstance());
$result = $result->asPalette($ncolors->value, $dither->value, $match_palette->value);
}
$result->output($format);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,174 @@
<?php
/**
This file is part of WideImage.
WideImage is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
WideImage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with WideImage; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* @package Demos
**/
include 'helpers/common.php';
require_once '../lib/WideImage.php';
$demos = array();
$di = new DirectoryIterator(dirname(__FILE__) . '/demos/');
foreach ($di as $file)
if (substr($file->getFilename(), -4) == '.php')
$demos[] = Demo::create(substr($file->getFilename(), 0, -4));
usort($demos, 'cmp_demos');
function cmp_demos($d1, $d2)
{
if ($d1->order === $d2->order)
return 0;
return ($d1->order < $d2->order ? -1 : 1);
}
if (isset($_GET['demo']))
$activeDemoName = $_GET['demo'];
else
$activeDemoName = null;
$activeDemo = null;
foreach ($demos as $demo)
if ($demo->name == $activeDemoName)
{
$activeDemo = $demo;
break;
}
if (!$activeDemo)
$activeDemoName = null;
?>
<html>
<head>
<title>WideImage -<?php if ($activeDemo) echo " " . $activeDemo->name; ?> demo</title>
<style>
body
{
background-color: #f0f0f0;
background-image: url("bg.gif");
background-attachment: fixed;
}
div.images {
float: left;
margin: 20px;
}
div.images img {
border-width: 0px;
vertical-align: middle;
}
div.images a img
{
border: 1px dashed red;
}
td { border-bottom: 1px solid grey; padding: 10px; }
td.left { text-align: left }
td.right { text-align: right }
.navbar {
width: 150px;
background-color: white;
float: left;
}
.navbar a
{
color: black;
}
.navbar a:visited
{
color: gray;
}
a.active_demo {
color: green;
}
a.active_demo:visited {
color: green;
}
</style>
</head>
<body>
<div class="navbar">
<strong><a href="index.php">WideImage demos</a></strong>
<ul>
<?php
$top_form = array();
$top_form['output'] = new FormatSelectField('output');
$top_form['output']->init(Request::getInstance());
$top_form['ncolors'] = new IntField('colors', 255);
$top_form['ncolors']->init(Request::getInstance());
$top_form['dither'] = new CheckboxField('dither', true);
$top_form['dither']->init(Request::getInstance());
$top_form['match_palette'] = new CheckboxField('match_palette', true);
$top_form['match_palette']->init(Request::getInstance());
foreach ($demos as $demo)
{
if ($activeDemo !== null && $demo->name == $activeDemo->name)
$css = 'active_demo';
else
$css = '';
echo "<li><a class=\"$css\" href=\"?demo={$demo->name}&output={$top_form['output']->value}&colors={$top_form['ncolors']->value}&dither={$top_form['dither']->value}&match_palette={$top_form['match_palette']->value}\">{$demo->name}</a></li>\n";
}
?>
</ul>
<span style="font-family: Verdana, Tahoma; font-size: 11px">
This demo is primarily intended to easily try some of the features.
There may be some bugs that don't actually occur with WideImage if used properly.
<br />
<br />
Version: <?php echo WideImage::version(); ?>
<br />
<br />
&copy; 2007-2011
<br />
<a href="http://kozak.si/widethoughts/">Gasper Kozak</a><br />
<br />
Read more about WideImage on the
<a href="http://wideimage.sourceforge.net">project page</a>.
</span>
</div>
<div style="margin-left: 200px">
<?php
if ($activeDemo)
{
include 'demo_screen.php';
}
?>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB