suwako / UnixWallpaper アーカイブ

このリポジトリはアーカイブされています。読むだけで、プッシュやイシューの変更は出来ません。

master
ブランチ master
UnixWallpaper / src / uw / image.hh
1 KB、55行 生 Blame 履歴
1#pragma once
2
3#include <X11/Xlib.h>
4
5#include <string>
6#include <vector>
7
8#include "screen.hh"
9
10namespace uw {
11 typedef unsigned char uchar;
12 typedef unsigned long ulong;
13
14 typedef struct Extent3D {
15 int width;
16 int height;
17 int depth;
18 } Extent3D;
19
20 class Image {
21 public:
22 Image(Screen &screen, const std::string imgPath);
23 ~Image();
24
25 Visual *getVisual() { return v; }
26 XImage *getImage() { return image; }
27 GC getGC() { return gc; }
28 Pixmap getPixmap() { return pm; }
29 Extent3D getExtent() { return imageExtent; }
30 uchar *getImageData() { return data; }
31 std::string getImagePath() { return imagePath; }
32
33 private:
34 void createDepth();
35 void createPixmap();
36 void createImage();
37 void createGC();
38
39 Visual *v;
40 XImage *image;
41 GC gc;
42 Pixmap pm;
43
44 uchar *data = nullptr;
45 std::vector<uchar> cdata;
46 Extent3D imageExtent;
47 int chan;
48 int width;
49 int height;
50 int depth;
51 std::string imagePath;
52
53 Screen &uwScreen;
54 };
55}