aboutsummaryrefslogtreecommitdiff
path: root/ImageManipulation.hpp
blob: 784e3262b9fd3fc4b844b27a4f3fd15870cd4714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef IMAGEMANIPULATION_H
#define IMAGEMANIPULATION_H 1

/* *************** */
// required for CImg.h
#include <cstdio>
#include <jerror.h>
#include <jpeglib.h>
/* *************** */

#include "CImg.h"

#include <string>
#include <vector>

enum ImageFormat { IF_UNSUPPORTED, IF_JPEG, IF_PNG };

class ImageManipulation {
public:
  ImageManipulation();
  ~ImageManipulation();

  bool SetImageFromBuffer(std::vector<unsigned char> &image_buffer);
  void SaveToFile(std::string filename);
  void Ukrainify(float opacity = 0.5f);

private:
  cimg_library::CImg<unsigned char> image;

  enum ImageFormat GetImageFormat(std::vector<unsigned char> &image_buffer);
};

#endif