xref: /webtrees/app/Report/ReportBaseImage.php (revision 67994fb087e1b24564a780e4ae8aeff801733e35)
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 */
16declare(strict_types=1);
17
18namespace Fisharebest\Webtrees\Report;
19
20/**
21 * Class ReportBaseImage
22 */
23class ReportBaseImage extends ReportBaseElement
24{
25    /** @var string Filename of the image */
26    public $file;
27
28    /** @var float Height of the image */
29    public $height;
30
31    /** @var float Width of the image */
32    public $width;
33
34    /** @var float X-position (left) of the image */
35    public $x;
36
37    /** @var float Y-position (top) of the image */
38    public $y;
39
40    /** @var string Placement fo the image. L: left, C:center, R:right (or empty for x/y) */
41    public $align;
42
43    /** @var string T:same line, N:next line */
44    public $line;
45
46    /**
47     * Image class function - Base
48     *
49     * @param string $file  Filename of the image
50     * @param float  $x     X-position (left) of the image
51     * @param float  $y     Y-position (top) of the image
52     * @param float  $w     Width of the image
53     * @param float  $h     Height of the image
54     * @param string $align Placement of the image. L: left, C:center, R:right
55     * @param string $ln    T:same line, N:next line
56     */
57    public function __construct(string $file, float $x, float $y, float $w, float $h, string $align, string $ln)
58    {
59        $this->file   = $file;
60        $this->width  = $w;
61        $this->height = $h;
62        $this->x      = $x;
63        $this->y      = $y;
64        $this->align  = $align;
65        $this->line   = $ln;
66    }
67
68    /**
69     * Get the height.
70     *
71     * @param $renderer
72     *
73     * @return float
74     */
75    public function getHeight($renderer): float
76    {
77        return $this->height;
78    }
79
80    /**
81     * Get the width.
82     *
83     * @param $renderer
84     *
85     * @return float|array
86     */
87    public function getWidth($renderer)
88    {
89        return $this->width;
90    }
91}
92