Revert earlier change from <config.h> to "config.h", as the former is suggested in...
[Ale.git] / d2 / render / zero.h
blobdb48dd4fd60dc71b27b1f5a05d7227391f8a4520
1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * zero.h: A renderer for the zero filter.
25 #ifndef __render_zero_h__
26 #define __render_zero_h__
28 #include "incremental.h"
29 #include "../image_zero.h"
31 class zero : public incremental {
32 public:
33 zero(invariant *inv) : incremental(inv) {
34 assert (typeid(*inv->ssfe()->get_scaled_filter()->get_filter()) == typeid(filter::zero));
38 * Perform the current rendering step.
40 virtual void step() {
41 assert (get_step() >= -1);
42 if (get_step() == 0) {
43 transformation t = align::of(0);
45 const image *im = image_rw::open(0);
48 * XXX: This approach to trimming pixels is probably a
49 * bit too aggressive. If it is changed, be sure to
50 * also change the corresponding lines in
51 * incremental.h.
54 unsigned int trim_size = (int) ceil(get_scale_factor()) - 1;
56 accum_image = new image_zero((int) floor(im->height() * get_scale_factor()) - trim_size,
57 (int) floor(im->width() * get_scale_factor()) - trim_size, 3);
59 set_extents_by_map(0, t);
61 image_rw::close(0);
62 } else if (align::match(get_step())) {
63 transformation t = align::of(get_step());
64 if (is_extend())
65 increase_extents_by_map(get_step(), t);
69 void free_memory() {
74 #endif