1 /*
2 * Copyright (c) 2001, 2008, 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
48 void ReleaseDC(HDC hDC);
49 jobject GetColorModel(JNIEnv *env,
50 jboolean useDeviceSettings);
51 void Initialize();
52 void UpdateDynamicColorModel();
53 BOOL UpdateSystemPalette();
54 unsigned int *GetSystemPaletteEntries();
55 unsigned char *GetSystemInverseLUT();
56 void SetJavaDevice(JNIEnv *env, jobject objPtr);
57 HPALETTE SelectPalette(HDC hDC);
58 void RealizePalette(HDC hDC);
59 HPALETTE GetPalette();
60 ColorData *GetColorData() { return cData; }
61 int GetBitDepth() { return colorData->bitsperpixel; }
62 HMONITOR GetMonitor() { return monitor; }
63 LPMONITORINFO GetMonitorInfo() { return pMonitorInfo; }
64 jobject GetJavaDevice() { return javaDevice; }
65 int GetDeviceIndex() { return screen; }
66 void Release();
67 void DisableOffscreenAcceleration();
68 void Invalidate(JNIEnv *env);
69 void InitDesktopScales();
70 void SetScale(float scaleX, float scaleY);
71 float GetScaleX();
72 float GetScaleY();
73 int ScaleUpX(int x);
74 int ScaleUpY(int y);
75 int ScaleDownX(int x);
76 int ScaleDownY(int y);
77
78 static int DeviceIndexForWindow(HWND hWnd);
79 static jobject GetColorModel(JNIEnv *env, jboolean dynamic,
80 int deviceIndex);
81 static HPALETTE SelectPalette(HDC hDC, int deviceIndex);
82 static void RealizePalette(HDC hDC, int deviceIndex);
83 static ColorData *GetColorData(int deviceIndex);
84 static int GetGrayness(int deviceIndex);
85 static void UpdateDynamicColorModel(int deviceIndex);
86 static BOOL UpdateSystemPalette(int deviceIndex);
87 static HPALETTE GetPalette(int deviceIndex);
88 static HMONITOR GetMonitor(int deviceIndex);
89 static LPMONITORINFO GetMonitorInfo(int deviceIndex);
90 static void ResetAllMonitorInfo();
91 static BOOL IsPrimaryPalettized() { return primaryPalettized; }
92 static int GetDefaultDeviceIndex() { return primaryIndex; }
93 static void DisableOffscreenAccelerationForDevice(HMONITOR hMonitor);
94 static HDC GetDCFromScreen(int screen);
95 static int GetScreenFromHMONITOR(HMONITOR mon);
96
97 static int primaryIndex;
98 static BOOL primaryPalettized;
99 static jclass indexCMClass;
100 static jclass wToolkitClass;
101 static jfieldID dynamicColorModelID;
102 static jfieldID indexCMrgbID;
103 static jfieldID indexCMcacheID;
104 static jmethodID paletteChangedMID;
105
106 private:
107 static BOOL AreSameMonitors(HMONITOR mon1, HMONITOR mon2);
108 ImgColorData *colorData;
109 AwtPalette *palette;
110 ColorData *cData; // Could be static, but may sometime
111 // have per-device info in this structure
112 BITMAPINFO *gpBitmapInfo;
113 int screen;
114 HMONITOR monitor;
115 LPMONITORINFO pMonitorInfo;
116 jobject javaDevice;
117 Devices *devicesArray;
118 float scaleX;
119 float scaleY;
120
121 static HDC MakeDCFromMonitor(HMONITOR);
122 static int ClipRound(double value);
123 };
124
125 #endif AWT_WIN32GRAPHICSDEVICE_H
|
1 /*
2 * Copyright (c) 2001, 2020, 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
48 void ReleaseDC(HDC hDC);
49 jobject GetColorModel(JNIEnv *env,
50 jboolean useDeviceSettings);
51 void Initialize();
52 void UpdateDynamicColorModel();
53 BOOL UpdateSystemPalette();
54 unsigned int *GetSystemPaletteEntries();
55 unsigned char *GetSystemInverseLUT();
56 void SetJavaDevice(JNIEnv *env, jobject objPtr);
57 HPALETTE SelectPalette(HDC hDC);
58 void RealizePalette(HDC hDC);
59 HPALETTE GetPalette();
60 ColorData *GetColorData() { return cData; }
61 int GetBitDepth() { return colorData->bitsperpixel; }
62 HMONITOR GetMonitor() { return monitor; }
63 LPMONITORINFO GetMonitorInfo() { return pMonitorInfo; }
64 jobject GetJavaDevice() { return javaDevice; }
65 int GetDeviceIndex() { return screen; }
66 void Release();
67 void DisableOffscreenAcceleration();
68 void DisableScaleAutoRefresh();
69 void Invalidate(JNIEnv *env);
70 void InitDesktopScales();
71 void SetScale(float scaleX, float scaleY);
72 float GetScaleX();
73 float GetScaleY();
74 int ScaleUpX(int x);
75 int ScaleUpAbsX(int x);
76 int ScaleUpY(int y);
77 int ScaleUpAbsY(int x);
78 int ScaleDownX(int x);
79 int ScaleDownAbsX(int x);
80 int ScaleDownY(int y);
81 int ScaleDownAbsY(int y);
82
83 static int DeviceIndexForWindow(HWND hWnd);
84 static jobject GetColorModel(JNIEnv *env, jboolean dynamic,
85 int deviceIndex);
86 static HPALETTE SelectPalette(HDC hDC, int deviceIndex);
87 static void RealizePalette(HDC hDC, int deviceIndex);
88 static ColorData *GetColorData(int deviceIndex);
89 static int GetGrayness(int deviceIndex);
90 static void UpdateDynamicColorModel(int deviceIndex);
91 static BOOL UpdateSystemPalette(int deviceIndex);
92 static HPALETTE GetPalette(int deviceIndex);
93 static HMONITOR GetMonitor(int deviceIndex);
94 static LPMONITORINFO GetMonitorInfo(int deviceIndex);
95 static void ResetAllMonitorInfo();
96 static void ResetAllDesktopScales();
97 static BOOL IsPrimaryPalettized() { return primaryPalettized; }
98 static int GetDefaultDeviceIndex() { return primaryIndex; }
99 static void DisableOffscreenAccelerationForDevice(HMONITOR hMonitor);
100 static HDC GetDCFromScreen(int screen);
101 static int GetScreenFromHMONITOR(HMONITOR mon);
102
103 static int primaryIndex;
104 static BOOL primaryPalettized;
105 static jclass indexCMClass;
106 static jclass wToolkitClass;
107 static jfieldID dynamicColorModelID;
108 static jfieldID indexCMrgbID;
109 static jfieldID indexCMcacheID;
110 static jmethodID paletteChangedMID;
111
112 private:
113 static BOOL AreSameMonitors(HMONITOR mon1, HMONITOR mon2);
114 ImgColorData *colorData;
115 AwtPalette *palette;
116 ColorData *cData; // Could be static, but may sometime
117 // have per-device info in this structure
118 BITMAPINFO *gpBitmapInfo;
119 int screen;
120 HMONITOR monitor;
121 LPMONITORINFO pMonitorInfo;
122 jobject javaDevice;
123 Devices *devicesArray;
124 float scaleX;
125 float scaleY;
126 BOOL disableScaleAutoRefresh;
127
128 static HDC MakeDCFromMonitor(HMONITOR);
129 static int ClipRound(double value);
130 };
131
132 #endif AWT_WIN32GRAPHICSDEVICE_H
|