From Ralf.Neubauer [...] wido.bv.aok.de Wed Sep 28 09: | 52:59 2011 |
X-Originalarrivaltime: | 28 Sep 2011 13:52:24.0090 (UTC) FILETIME=[D9BC97A0:01CC7DE5] |
MIME-Version: | 1.0 |
X-Spam-Status: | No, score=-6.899 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_FAIL=0.001] autolearn=ham |
Content-Class: | urn:content-classes:message |
X-Spam-Flag: | NO |
Message-ID: | <DA5D2621C9566F488C32ACE506A7BB89019F5BC9 [...] wido-exch01.wido.bv.aok.de> |
content-type: | text/plain; charset="utf-8" |
X-Virus-Scanned: | Debian amavisd-new at bestpractical.com |
X-MS-Tnef-Correlator: | |
X-Ironport-Anti-Spam-Tag: | nospam |
X-Ironport-Av: | E=Sophos;i="4.68,455,1312149600"; d="scan'208";a="169528182" |
X-Spam-Score: | -6.899 |
Received: | from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B31EC240A2F for <cpan-bug+Imager [...] hipster.bestpractical.com>; Wed, 28 Sep 2011 09:52:59 -0400 (EDT) |
Received: | from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JCGY2euvVLz7 for <cpan-bug+Imager [...] hipster.bestpractical.com>; Wed, 28 Sep 2011 09:52:57 -0400 (EDT) |
Received: | from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id A7393240902 for <bug-Imager [...] rt.cpan.org>; Wed, 28 Sep 2011 09:52:57 -0400 (EDT) |
Received: | (qmail 3191 invoked by uid 103); 28 Sep 2011 13:52:56 -0000 |
Received: | from x16.dev (10.0.100.26) by x1.dev with QMQP; 28 Sep 2011 13:52:56 -0000 |
Received: | from mailext.aok.de (HELO mailext.aok.de) (217.111.83.65) by 16.mx.develooper.com (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Wed, 28 Sep 2011 06:52:52 -0700 |
Received: | from gfgv-aok-li37-fromint.zsa.aok.de (HELO gfgv-aok-li37.localdomain) ([10.160.41.219]) by mailint3.zsa.aok.de with ESMTP; 28 Sep 2011 15:52:24 +0200 |
Received: | from gfgv-aok-li37 (localhost.localdomain [127.0.0.1]) by gfgv-aok-li37.localdomain (Postfix) with ESMTP id 63EC1651717 for <bug-Imager [...] rt.cpan.org>; Wed, 28 Sep 2011 15:52:24 +0200 (CEST) |
Received: | from mailext.aok.de (gfgv-aok-ip01ext.zsa.aok.de [10.160.41.206]) by gfgv-aok-li37.localdomain (Postfix) with ESMTP id 5ABBD6516EF for <bug-Imager [...] rt.cpan.org>; Wed, 28 Sep 2011 15:52:24 +0200 (CEST) |
Received: | from gfgv-aok-ip11.zsa.aok.de (HELO mailhub1.zsa.aok.de) ([10.160.36.3]) by mailint3.zsa.aok.de with ESMTP; 28 Sep 2011 15:52:24 +0200 |
Received: | from unknown (HELO exch02.bv.aok.de) ([10.116.0.21]) by mailhub1.zsa.aok.de with ESMTP; 28 Sep 2011 15:52:24 +0200 |
Received: | from wido-exch01.wido.bv.aok.de ([10.116.2.3]) by exch02.bv.aok.de with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Sep 2011 15:52:24 +0200 |
Delivered-To: | cpan-bug+Imager [...] hipster.bestpractical.com |
Subject: | polygons don't fit |
Return-Path: | <Ralf.Neubauer [...] wido.bv.aok.de> |
Thread-Index: | Acx95djaU1QTyBEkRtKWpNERRGriZQ== |
X-RT-Mail-Extension: | imager |
X-Original-To: | cpan-bug+Imager [...] hipster.bestpractical.com |
X-Spam-Check-BY: | 16.mx.develooper.com |
Date: | Wed, 28 Sep 2011 15:52:23 +0200 |
X-Spam-Level: | |
Thread-Topic: | polygons don't fit |
X-MS-Has-Attach: | |
X-Mimeole: | Produced By Microsoft Exchange V6.5 |
To: | <bug-Imager [...] rt.cpan.org> |
Content-Transfer-Encoding: | quoted-printable |
X-Ironport-Faked-Sender: | false |
X-Ironport-Faked-Sender: | false |
From: | "Neubauer, Ralf" <Ralf.Neubauer [...] wido.bv.aok.de> |
X-RT-Original-Encoding: | us-ascii |
Content-Length: | 3014 |
Hi.
Distribution name and version: Imager-0.85
Perl version: v5.12.4 -- Binary build 1205 [294981] provided by
ActiveState
Operating System vendor and version: WinXP
After building the very useful Imager module myself (because the
ActiveState PPMs are buggy and e.g. don't support PNG and JPEG) I still
get an effect that I first discovered some years ago with older
(ActiveState and trouchelle distributed) Versions of Imager and perl:
#! /usr/bin/perl
use warnings;
use strict;
use Imager;
my $img = new Imager(xsize => 100, ysize => 100, channels => 1);
my $white = Imager::Color->new(255, 255, 255);
my $black = Imager::Color->new(0, 0, 0);
$img->box(color => $white, filled => 1,
xmin => 0, ymin => 0, xmax => 99, ymax => 99);
$img->polygon(color => $black, points => [[0,0], [0,99], [99,99]]);
$img->polygon(color => $black, points => [[0,0], [99,99], [99,0]]);
$img->write(file => 'polygonmatch.bmp')
There is a fine grey line from (0,0) to (99,99). If I draw a shaded
triangulation, e.g. 3D shaded boxes, I don't get a nice shaded image,
but there are these lines between the triangles. Example:
use Imager::Fountain;
use Imager::Fill;
my $cells = 10;
my $xcell = 100;
my $ycell = 150;
$img = new Imager(xsize => $xcell*$cells, ysize => $ycell*$cells,
channels => 3);
my @color = map Imager::Color->new(map int rand 256, 0..2), 0..2;
my $fountain = Imager::Fountain->simple
(positions => [0, 0.1, 0.3, 0.7, 0.9, 1.0],
colors => [@color[0, 1, 2, 2, 3, 0]]);
for my $x (0..99) {
for my $y (0..99) {
my $tl = [$xcell*$x, $ycell*$y];
my $tr = [$xcell*$x+$xcell-1, $ycell*$y];
my $bl = [$xcell*$x, $ycell*$y+$ycell-1];
my $br = [$xcell*$x+$xcell-1, $ycell*$y+$ycell-1];
my $center = [$xcell*$x+int(($xcell-1)/2),
$ycell*$y+int(($ycell-1)/2)];
my $fill_top_bottom =
Imager::Fill->new(fountain => 'linear',
segments => $fountain,
xa => $tl->[0], ya => $tl->[1],
xb => $bl->[0], yb => $bl->[1],
);
my $fill_left_right =
Imager::Fill->new(fountain => 'linear',
segments => $fountain,
xa => $tl->[0], ya => $tl->[1],
xb => $tr->[0], yb => $tr->[1],
);
$img->polygon(fill => $fill_top_bottom, points => [$br, $center,
$bl]);
$img->polygon(fill => $fill_top_bottom, points => [$tl, $center,
$tr]);
$img->polygon(fill => $fill_left_right, points => [$bl, $center,
$tl]);
$img->polygon(fill => $fill_left_right, points => [$tr, $center,
$br]);
}
}
$img->write(file => 'polygonmatch2.bmp');
The easiest fix would be an option for non-antialiased polygons.
I tried hiding the artefacts behind lines:
for my $xincr (-1,0,1) {
$img->line(color => $color, aa => 0,
x1 => $bl->[0]+$xincr, y1 => $bl->[1],
x2 => $tr->[0]+$xincr, y2 => $tr->[1]);
$img->line(color => $color, aa => 0,
x1 => $br->[0]+$xincr, y1 => $br->[1],
x2 => $tl->[0]+$xincr, y2 => $tl->[1]);
}
but that doesn't catch all pixels -- and is still the wrong color
anyways.
Ralf