Blue Brain BioExplorer
ImageUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  *
5  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 3.0 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
24 
25 #include <FreeImage.h>
26 
27 namespace core
28 {
29 namespace freeimage
30 {
32 {
33  inline void operator()(FIBITMAP* image)
34  {
35  if (image)
36  FreeImage_Unload(image);
37  }
38 };
39 
41 {
42  inline void operator()(FIMEMORY* memory)
43  {
44  if (memory)
45  FreeImage_CloseMemory(memory);
46  }
47 };
48 
49 using ImagePtr = std::unique_ptr<FIBITMAP, ImageDeleter>;
50 using MemoryPtr = std::unique_ptr<FIMEMORY, MemoryDeleter>;
51 
52 bool SwapRedBlue32(FIBITMAP* freeImage);
53 std::string getBase64Image(ImagePtr image, const std::string& format, const int quality);
54 ImagePtr mergeImages(const std::vector<ImagePtr>& images);
55 } // namespace freeimage
56 } // namespace core
std::unique_ptr< FIBITMAP, ImageDeleter > ImagePtr
Definition: ImageUtils.h:49
bool SwapRedBlue32(FIBITMAP *freeImage)
Definition: ImageUtils.cpp:40
std::string getBase64Image(ImagePtr image, const std::string &format, const int quality)
Definition: ImageUtils.cpp:62
std::unique_ptr< FIMEMORY, MemoryDeleter > MemoryPtr
Definition: ImageUtils.h:50
ImagePtr mergeImages(const std::vector< ImagePtr > &images)
Definition: ImageUtils.cpp:86
void operator()(FIBITMAP *image)
Definition: ImageUtils.h:33
void operator()(FIMEMORY *memory)
Definition: ImageUtils.h:42