xref: /webtrees/app/Report/ReportBaseImage.php (revision 41cfb9e2204e7a7e8919e48098071f28e9a0fc54)
1a25f0a04SGreg Roach<?php
23976b470SGreg Roach
3a25f0a04SGreg Roach/**
4a25f0a04SGreg Roach * webtrees: online genealogy
589f7189bSGreg Roach * Copyright (C) 2021 webtrees development team
6a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
7a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
8a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a25f0a04SGreg Roach * (at your option) any later version.
10a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
11a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a25f0a04SGreg Roach * GNU General Public License for more details.
14a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16a25f0a04SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2076692c8bSGreg Roachnamespace Fisharebest\Webtrees\Report;
21a25f0a04SGreg Roach
22a25f0a04SGreg Roach/**
23a25f0a04SGreg Roach * Class ReportBaseImage
24a25f0a04SGreg Roach */
25c1010edaSGreg Roachclass ReportBaseImage extends ReportBaseElement
26c1010edaSGreg Roach{
2783cdc021SGreg Roach    /** @var string Filename of the image */
28a25f0a04SGreg Roach    public $file;
2983cdc021SGreg Roach
30589feda3SGreg Roach    /** @var float Height of the image */
31a25f0a04SGreg Roach    public $height;
3283cdc021SGreg Roach
33589feda3SGreg Roach    /** @var float Width of the image */
34a25f0a04SGreg Roach    public $width;
3583cdc021SGreg Roach
36589feda3SGreg Roach    /** @var float X-position (left) of the image */
37a25f0a04SGreg Roach    public $x;
3883cdc021SGreg Roach
39589feda3SGreg Roach    /** @var float Y-position (top) of the image */
40a25f0a04SGreg Roach    public $y;
4183cdc021SGreg Roach
4283cdc021SGreg Roach    /** @var string Placement fo the image. L: left, C:center, R:right (or empty for x/y) */
4383cdc021SGreg Roach    public $align;
4483cdc021SGreg Roach
4583cdc021SGreg Roach    /** @var string T:same line, N:next line */
4683cdc021SGreg Roach    public $line;
47a25f0a04SGreg Roach
48a25f0a04SGreg Roach    /**
49a25f0a04SGreg Roach     * Image class function - Base
50a25f0a04SGreg Roach     *
51a25f0a04SGreg Roach     * @param string $file  Filename of the image
52589feda3SGreg Roach     * @param float  $x     X-position (left) of the image
53589feda3SGreg Roach     * @param float  $y     Y-position (top) of the image
54589feda3SGreg Roach     * @param float  $w     Width of the image
55589feda3SGreg Roach     * @param float  $h     Height of the image
56a25f0a04SGreg Roach     * @param string $align Placement of the image. L: left, C:center, R:right
57a25f0a04SGreg Roach     * @param string $ln    T:same line, N:next line
58a25f0a04SGreg Roach     */
59589feda3SGreg Roach    public function __construct(string $file, float $x, float $y, float $w, float $h, string $align, string $ln)
60c1010edaSGreg Roach    {
61a25f0a04SGreg Roach        $this->file   = $file;
62a25f0a04SGreg Roach        $this->width  = $w;
63a25f0a04SGreg Roach        $this->height = $h;
64a25f0a04SGreg Roach        $this->x      = $x;
65a25f0a04SGreg Roach        $this->y      = $y;
66a25f0a04SGreg Roach        $this->align  = $align;
67a25f0a04SGreg Roach        $this->line   = $ln;
68a25f0a04SGreg Roach    }
69a25f0a04SGreg Roach
70a25f0a04SGreg Roach    /**
7176692c8bSGreg Roach     * Get the height.
7276692c8bSGreg Roach     *
73b6f35a76SGreg Roach     * @param HtmlRenderer|PdfRenderer $renderer
74a25f0a04SGreg Roach     *
75a25f0a04SGreg Roach     * @return float
76a25f0a04SGreg Roach     */
778f53f488SRico Sonntag    public function getHeight($renderer): float
78c1010edaSGreg Roach    {
79a25f0a04SGreg Roach        return $this->height;
80a25f0a04SGreg Roach    }
81a25f0a04SGreg Roach
82a25f0a04SGreg Roach    /**
8376692c8bSGreg Roach     * Get the width.
8476692c8bSGreg Roach     *
85b6f35a76SGreg Roach     * @param HtmlRenderer|PdfRenderer $renderer
86a25f0a04SGreg Roach     *
87*41cfb9e2SGreg Roach     * @return array{0:float,1:int,2:float|int}
88a25f0a04SGreg Roach     */
89*41cfb9e2SGreg Roach    public function getWidth($renderer): array
90c1010edaSGreg Roach    {
91*41cfb9e2SGreg Roach        return [$this->width, 1, $this->height];
92a25f0a04SGreg Roach    }
93a25f0a04SGreg Roach}
94