xref: /webtrees/app/Report/ReportBaseImage.php (revision d11be7027e34e3121be11cc025421873364403f9)
1a25f0a04SGreg Roach<?php
23976b470SGreg Roach
3a25f0a04SGreg Roach/**
4a25f0a04SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 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{
2777bab461SGreg Roach    // Filename of the image
2877bab461SGreg Roach    public string $file;
2983cdc021SGreg Roach
3077bab461SGreg Roach    // Height of the image
3177bab461SGreg Roach    public float $height;
3283cdc021SGreg Roach
3377bab461SGreg Roach    // Width of the image
3477bab461SGreg Roach    public float $width;
3583cdc021SGreg Roach
3677bab461SGreg Roach    // X-position (left) of the image
3777bab461SGreg Roach    public float $x;
3883cdc021SGreg Roach
3977bab461SGreg Roach    // Y-position (top) of the image
4077bab461SGreg Roach    public float $y;
4183cdc021SGreg Roach
4277bab461SGreg Roach    // Placement of the image. L: left, C:center, R:right (or empty for x/y)
4377bab461SGreg Roach    public string $align;
4483cdc021SGreg Roach
4577bab461SGreg Roach    // T:same line, N:next line
4677bab461SGreg Roach    public string $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     *
8777bab461SGreg Roach     * @return array{0:float,1:int,2:float}
88a25f0a04SGreg Roach     */
8941cfb9e2SGreg Roach    public function getWidth($renderer): array
90c1010edaSGreg Roach    {
9141cfb9e2SGreg Roach        return [$this->width, 1, $this->height];
92a25f0a04SGreg Roach    }
93a25f0a04SGreg Roach}
94