Visual Computing Library
Loading...
Searching...
No Matches
image.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_CONCEPTS_SPACE_IMAGE_H
24#define VCL_CONCEPTS_SPACE_IMAGE_H
25
26#include "color.h"
27
28#include <vclib/types.h>
29
30#include <string>
31
32namespace vcl {
33
34template<typename T>
35concept ImageConcept = requires (T&& obj, const void* dataPtr, uint n) {
36 // constructors
37 RemoveRef<T>();
38 RemoveRef<T>(std::string());
39 RemoveRef<T>(dataPtr, n, n);
40 RemoveRef<T>(dataPtr, n, n, bool());
41
42 { obj.isNull() } -> std::same_as<bool>;
43 { obj.height() } -> std::same_as<int>;
44 { obj.width() } -> std::same_as<int>;
45
46 { obj.sizeInBytes() } -> std::same_as<std::size_t>;
47
48 { obj.pixel(uint(), uint()) } -> ColorConcept;
49
50 { obj.data() } -> std::same_as<const unsigned char*>;
51
52 { obj.save(std::string()) } -> std::same_as<void>;
53 { obj.save(std::string(), uint()) } -> std::same_as<void>;
54
55 // non const requirements
56 requires IsConst<T> || requires {
57 { obj.load(std::string()) } -> std::same_as<bool>;
58
59 { obj.mirror() } -> std::same_as<void>;
60 { obj.mirror(bool()) } -> std::same_as<void>;
61 { obj.mirror(bool(), bool()) } -> std::same_as<void>;
62 };
63};
64
65} // namespace vcl
66
67#endif // VCL_CONCEPTS_SPACE_IMAGE_H
ColorConcept is satisfied only if a class provides the member functions specified in this concept....
Definition color.h:41
Definition image.h:35
The IsConst concept is satisfied if T satisfies one of the following conditions:
Definition const_correctness.h:43