18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #ifndef SPLASHSCREEN_IMPL_H 27 #define SPLASHSCREEN_IMPL_H 28 29 #include "splashscreen_config.h" 30 #include "splashscreen_gfx.h" 31 32 SPLASHEXPORT int SplashLoadMemory(void *pdata, int size); /* requires preloading the file */ 33 SPLASHEXPORT int SplashLoadFile(const char *filename); // FIXME: range checking for SplashLoadMemory 34 35 SPLASHEXPORT void SplashInit(void); 36 SPLASHEXPORT void SplashClose(void); 37 38 SPLASHEXPORT void 39 SplashSetFileJarName(const char* fileName, const char* jarName); 40 41 typedef struct SplashImage 42 { 43 rgbquad_t *bitmapBits; 44 int delay; /* before next image display, in msec */ 45 #if defined(WITH_WIN32) 46 HRGN hRgn; 47 #elif defined(WITH_X11) 48 XRectangle *rects; 49 int numRects; 50 #endif 51 } SplashImage; 52 53 #define SPLASH_COLOR_MAP_SIZE 0x100 54 55 typedef struct Splash 56 { 57 ImageFormat screenFormat; /* must be preset before image decoding */ 62 int maskRequired; /* must be preset before image decoding */ 63 int width; /* in pixels */ 64 int height; /* in pixels */ 65 int frameCount; 66 SplashImage *frames; /* dynamically allocated array of frame descriptors */ 67 unsigned time; /* in msec, origin is not important */ 68 rgbquad_t *overlayData; /* overlay image data, always rgbquads */ 69 ImageRect overlayRect; 70 ImageFormat overlayFormat; 71 void *screenData; 72 int screenStride; /* stored scanline length in bytes */ 73 int currentFrame; // currentFrame==-1 means image is not loaded 74 int loopCount; 75 int x, y; 76 rgbquad_t colorIndex[SPLASH_COLOR_MAP_SIZE]; 77 int isVisible; 78 char* fileName; /* stored in 16-bit unicode (jchars) */ 79 int fileNameLen; 80 char* jarName; /* stored in 16-bit unicode (jchars) */ 81 int jarNameLen; 82 #if defined(WITH_WIN32) 83 BOOL isLayered; 84 HWND hWnd; 85 HPALETTE hPalette; 86 CRITICAL_SECTION lock; 87 #elif defined(WITH_X11) 88 int controlpipe[2]; 89 Display *display; 90 Window window; 91 Screen *screen; 92 Visual *visual; 93 Colormap cmap; 94 pthread_mutex_t lock; 95 Cursor cursor; 96 XWMHints* wmHints; 97 #elif defined(WITH_MACOSX) 98 pthread_mutex_t lock; 99 int controlpipe[2]; 100 NSWindow * window; 101 #endif 102 } Splash; 103 104 /* various shared and/or platform dependent splash screen functions */ 105 106 /*************** Platform-specific ******************/ 107 108 /* To be implemented in the platform-specific native code. */ 109 110 111 void SplashInitPlatform(Splash * splash); 112 void SplashCreateThread(Splash * splash); 113 void SplashCleanupPlatform(Splash * splash); 114 void SplashDonePlatform(Splash * splash); 115 116 unsigned SplashTime(); 117 char* SplashConvertStringAlloc(const char* in, int *size); 118 119 void SplashLock(Splash * splash); 120 void SplashUnlock(Splash * splash); 121 122 void SplashInitFrameShape(Splash * splash, int imageIndex); 123 124 void SplashUpdate(Splash * splash); 125 void SplashReconfigure(Splash * splash); 126 void SplashClosePlatform(Splash * splash); 127 128 129 130 /********************* Shared **********************/ 131 Splash *SplashGetInstance(); 132 133 int SplashIsStillLooping(Splash * splash); 134 void SplashNextFrame(Splash * splash); 135 void SplashStart(Splash * splash); 136 void SplashDone(Splash * splash); 137 138 void SplashUpdateScreenData(Splash * splash); 139 140 void SplashCleanup(Splash * splash); 141 142 143 typedef struct SplashStream { 144 int (*read)(void* pStream, void* pData, int nBytes); 145 int (*peek)(void* pStream); 146 void (*close)(void* pStream); 147 union { 148 struct { 149 FILE* f; 150 } stdio; 151 struct { 152 unsigned char* pData; 153 unsigned char* pDataEnd; 154 } mem; 155 } arg; 156 } SplashStream; 157 158 int SplashStreamInitFile(SplashStream * stream, const char* filename); 159 int SplashStreamInitMemory(SplashStream * stream, void * pData, int size); 160 | 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #ifndef SPLASHSCREEN_IMPL_H 27 #define SPLASHSCREEN_IMPL_H 28 29 #include "splashscreen_config.h" 30 #include "splashscreen_gfx.h" 31 32 SPLASHEXPORT int SplashLoadMemory(void *pdata, int size); /* requires preloading the file */ 33 SPLASHEXPORT int SplashLoadFile(const char *filename); // FIXME: range checking for SplashLoadMemory 34 35 SPLASHEXPORT void SplashInit(void); 36 SPLASHEXPORT void SplashClose(void); 37 38 SPLASHEXPORT void SplashSetScaleFactor(float); 39 SPLASHEXPORT char* SplashGetScaledImageName(const char*, const char*, float*); 40 41 SPLASHEXPORT void 42 SplashSetFileJarName(const char* fileName, const char* jarName); 43 44 typedef struct SplashImage 45 { 46 rgbquad_t *bitmapBits; 47 int delay; /* before next image display, in msec */ 48 #if defined(WITH_WIN32) 49 HRGN hRgn; 50 #elif defined(WITH_X11) 51 XRectangle *rects; 52 int numRects; 53 #endif 54 } SplashImage; 55 56 #define SPLASH_COLOR_MAP_SIZE 0x100 57 58 typedef struct Splash 59 { 60 ImageFormat screenFormat; /* must be preset before image decoding */ 65 int maskRequired; /* must be preset before image decoding */ 66 int width; /* in pixels */ 67 int height; /* in pixels */ 68 int frameCount; 69 SplashImage *frames; /* dynamically allocated array of frame descriptors */ 70 unsigned time; /* in msec, origin is not important */ 71 rgbquad_t *overlayData; /* overlay image data, always rgbquads */ 72 ImageRect overlayRect; 73 ImageFormat overlayFormat; 74 void *screenData; 75 int screenStride; /* stored scanline length in bytes */ 76 int currentFrame; // currentFrame==-1 means image is not loaded 77 int loopCount; 78 int x, y; 79 rgbquad_t colorIndex[SPLASH_COLOR_MAP_SIZE]; 80 int isVisible; 81 char* fileName; /* stored in 16-bit unicode (jchars) */ 82 int fileNameLen; 83 char* jarName; /* stored in 16-bit unicode (jchars) */ 84 int jarNameLen; 85 float scaleFactor; 86 #if defined(WITH_WIN32) 87 BOOL isLayered; 88 HWND hWnd; 89 HPALETTE hPalette; 90 CRITICAL_SECTION lock; 91 #elif defined(WITH_X11) 92 int controlpipe[2]; 93 Display *display; 94 Window window; 95 Screen *screen; 96 Visual *visual; 97 Colormap cmap; 98 pthread_mutex_t lock; 99 Cursor cursor; 100 XWMHints* wmHints; 101 #elif defined(WITH_MACOSX) 102 pthread_mutex_t lock; 103 int controlpipe[2]; 104 NSWindow * window; 105 #endif 106 } Splash; 107 108 /* various shared and/or platform dependent splash screen functions */ 109 110 /*************** Platform-specific ******************/ 111 112 /* To be implemented in the platform-specific native code. */ 113 114 115 void SplashInitPlatform(Splash * splash); 116 void SplashCreateThread(Splash * splash); 117 void SplashCleanupPlatform(Splash * splash); 118 void SplashDonePlatform(Splash * splash); 119 120 unsigned SplashTime(); 121 char* SplashConvertStringAlloc(const char* in, int *size); 122 char* SplashGetScaledImageName(const char* jarName, 123 const char* fileName, float *scaleFactor); 124 125 void SplashLock(Splash * splash); 126 void SplashUnlock(Splash * splash); 127 128 void SplashInitFrameShape(Splash * splash, int imageIndex); 129 130 void SplashUpdate(Splash * splash); 131 void SplashReconfigure(Splash * splash); 132 void SplashClosePlatform(Splash * splash); 133 134 135 136 /********************* Shared **********************/ 137 Splash *SplashGetInstance(); 138 139 int SplashIsStillLooping(Splash * splash); 140 void SplashNextFrame(Splash * splash); 141 void SplashStart(Splash * splash); 142 void SplashDone(Splash * splash); 143 144 void SplashUpdateScreenData(Splash * splash); 145 146 void SplashCleanup(Splash * splash); 147 void SplashSetScaleFactor(float scaleFactor); 148 149 150 typedef struct SplashStream { 151 int (*read)(void* pStream, void* pData, int nBytes); 152 int (*peek)(void* pStream); 153 void (*close)(void* pStream); 154 union { 155 struct { 156 FILE* f; 157 } stdio; 158 struct { 159 unsigned char* pData; 160 unsigned char* pDataEnd; 161 } mem; 162 } arg; 163 } SplashStream; 164 165 int SplashStreamInitFile(SplashStream * stream, const char* filename); 166 int SplashStreamInitMemory(SplashStream * stream, void * pData, int size); 167 |