1 /* 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 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 PLATFORM_UTIL_H 27 #define PLATFORM_UTIL_H 28 29 #include <jni.h> 30 31 #define NATIVE_LENS_PORT_VERSION 1 32 #define NATIVE_PRISM_PORT_VERSION 1 33 34 #define LENSPORT_LIBRARY_NAME "liblens_porting.so" 35 36 typedef void Platform_Logger(int level, 37 const char *func, 38 const char *file, 39 int line, 40 const char *format, ...); 41 42 typedef struct _lens_native_port { 43 int version; 44 char *platformName; 45 void (*setLogger)(Platform_Logger *logger, int level); 46 // Cursor Specific Entries 47 void (*createCursor)(jbyte *cursorImage, int width, int height, int bpp); 48 void (*setNativeCursor)(jlong nativeCursorPointer); 49 void (*cursorInitialize)(int screenWidth, int screenHeight, int screenDepth); 50 void (*cursorSetPosition)(int x, int y); 51 void (*cursorClose)(); 52 void (*cursorTerminate)(); 53 jlong (*createNativeCursor)(JNIEnv *env, jint x, jint y, jbyte *srcArray, jint width, jint height); 54 void (*releaseNativeCursor)(jlong nativeCursorPointer); 55 void (*setVisible)(jboolean isVisible); 56 jboolean cursorTranslucency; 57 58 // Robot Specific Entries 59 jboolean (*robotScreenCapture)(jint x, jint y, jint width, jint height, jint *pixels); 60 } LensNativePort; 61 62 typedef struct _prism_native_port { 63 int version; 64 char *platformName; 65 //returns a EGLNativeWindowType 66 void * (*getNativeWindowType)(); 67 //returns a EGLNativeDisplayType 68 void * (*getNativeDisplayType)(); 69 void * (*wr_eglGetDisplay)(void *id); 70 void * (*getLibGLEShandle)(); 71 } PrismNativePort; 72 73 // Called to initialize the lens specific platform functions. 74 // Must be called prior to other utility calls. 75 // return of true on success 76 extern jboolean lens_platform_initialize(LensNativePort *lensPort); 77 78 // Called to initialize the prism specific platform functions. 79 // Must be called prior to other utility calls. 80 // return of true on success 81 extern jboolean prism_platform_initialize(PrismNativePort *prismsPort); 82 83 #endif // PLATFORM_UTIL_H