PageBuffer.h
author František Kučera <franta-hg@frantovo.cz>
Thu, 28 Dec 2023 00:37:59 +0100
branchv_0
changeset 35 dcb2ad86e23c
parent 30 02972f051744
permissions -rw-r--r--
add undocumented option: --dpi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
29
dc3c102e1264 derive OHP3D from ShaderShark
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     2
 * OHP3D
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2023 František Kučera (Frantovo.cz, GlobalCode.info)
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
#pragma once
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
1
fb65455622b9 load textures from PNG, JPEG etc. files using ImageMagick
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    20
#include <string.h>
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
1
fb65455622b9 load textures from PNG, JPEG etc. files using ImageMagick
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    22
#include "AllocatedBuffer.h"
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
30
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    24
class PageBuffer : public AllocatedBuffer {
1
fb65455622b9 load textures from PNG, JPEG etc. files using ImageMagick
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    25
public:
30
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    26
	int width;
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    27
	int height;
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
30
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    29
	PageBuffer(void* buffer, const size_t size,
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    30
			const int width, const int height) :
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    31
			AllocatedBuffer(width * height * 3),
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    32
			width(width), height(height) {
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    33
		if (size == width * height * 3) memcpy(data, buffer, size);
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    34
		else throw std::invalid_argument("invalid image size");
02972f051744 import PDF loading code from the OHP3D private prototype
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    35
	}
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
};