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