i6engine  1.0
Splash.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_UTILS_SPLASH_H__
26 #define __I6ENGINE_UTILS_SPLASH_H__
27 
28 #include <cstdio>
29 #include <stdint.h>
30 #include <string>
31 
33 
34 #if ISIXE_MPLATFORM == ISIXE_MPLATFORM_LINUX
35  #include "jerror.h"
36  #include "jpeglib.h"
37 
38  #include <X11/Xatom.h>
39  #include <X11/Xlib.h>
40  #include <X11/Xutil.h>
41 #elif ISIXE_MPLATFORM == ISIXE_MPLATFORM_WIN32
42  #include <Windows.h>
43 #endif /* WIN32 */
44 
45 #ifndef u_char
46  #define u_char unsigned char
47 #endif
48 
49 namespace i6e {
50 namespace utils {
51 
52  typedef struct {
53  unsigned long flags;
54  unsigned long functions;
55  unsigned long decorations;
56  long inputMode;
57  unsigned long status;
58  } Hints;
59 
67  public:
75  void showSplash(const std::string & file, const std::string & name);
76 
80  void closeSplash();
81 
85  Splash();
86 
87  private:
88 #if ISIXE_MPLATFORM == ISIXE_MPLATFORM_LINUX
89  XImage * _img;
90 
91  int get_byte_order();
92  void jpeg_error_exit(j_common_ptr cinfo);
93  u_char * decode_jpeg(const char * filename, int * widthPtr, int * heightPtr);
94  XImage * create_image_from_buffer(Display * dis, int screen, u_char * buf, int width, int height);
95  Window create_window(Display * dis, int screen, int x, int y, int width, int height, const std::string & name);
96 #elif ISIXE_MPLATFORM == ISIXE_MPLATFORM_WIN32
97  HWND hWnd;
98 #endif
99  };
100 
101 } /* namespace utils */
102 } /* namespace i6e */
103 
104 #endif /* __I6ENGINE_UTILS_SPLASH_H__ */
105 
Opens and displays JPEG (Linux) or BMP (Windows) images as splash screens.
Definition: Splash.h:66
#define u_char
Definition: Splash.h:46
long inputMode
Definition: Splash.h:56
unsigned long functions
Definition: Splash.h:54
unsigned long decorations
Definition: Splash.h:55
void * HWND
unsigned long status
Definition: Splash.h:57
unsigned long flags
Definition: Splash.h:53
#define ISIXE_UTILS_API