xref: /webtrees/app/Report/ReportBaseImage.php (revision cfe766af61e4d860f17afd91dc1b2e538caffa79)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Report;
17
18/**
19 * Class ReportBaseImage
20 */
21class ReportBaseImage extends ReportBaseElement
22{
23    /** @var string Filename of the image */
24    public $file;
25
26    /** @var int Height of the image */
27    public $height;
28
29    /** @var int Width of the image */
30    public $width;
31
32    /** @var int X-position (left) of the image */
33    public $x;
34
35    /** @var int Y-position (top) of the image */
36    public $y;
37
38    /** @var string Placement fo the image. L: left, C:center, R:right (or empty for x/y) */
39    public $align;
40
41    /** @var string T:same line, N:next line */
42    public $line;
43
44    /**
45     * Image class function - Base
46     *
47     * @param string $file  Filename of the image
48     * @param int    $x     X-position (left) of the image
49     * @param int    $y     Y-position (top) of the image
50     * @param int    $w     Width of the image
51     * @param int    $h     Height of the image
52     * @param string $align Placement of the image. L: left, C:center, R:right
53     * @param string $ln    T:same line, N:next line
54     */
55    public function __construct(string $file, int $x, int $y, int $w, int $h, string $align, string $ln)
56    {
57        $this->file   = $file;
58        $this->width  = $w;
59        $this->height = $h;
60        $this->x      = $x;
61        $this->y      = $y;
62        $this->align  = $align;
63        $this->line   = $ln;
64    }
65
66    /**
67     * Get the height.
68     *
69     * @param $renderer
70     *
71     * @return float
72     */
73    public function getHeight($renderer): float
74    {
75        return $this->height;
76    }
77
78    /**
79     * Get the width.
80     *
81     * @param $renderer
82     *
83     * @return float|array
84     */
85    public function getWidth($renderer)
86    {
87        return $this->width;
88    }
89}
90