1 /* |
1 /* |
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
333 jio_fprintf(stdout, "can't allocate (%d,%d, %d)\n", r, g, b); |
333 jio_fprintf(stdout, "can't allocate (%d,%d, %d)\n", r, g, b); |
334 #endif |
334 #endif |
335 } |
335 } |
336 |
336 |
337 return awt_color_match(r, g, b, awt_data); |
337 return awt_color_match(r, g, b, awt_data); |
338 } |
|
339 |
|
340 void |
|
341 awt_allocate_systemcolors(XColor *colorsPtr, int num_pixels, AwtGraphicsConfigDataPtr awtData) { |
|
342 int i; |
|
343 int r, g, b, pixel; |
|
344 |
|
345 for (i=0; i < num_pixels; i++) { |
|
346 r = colorsPtr[i].red >> 8; |
|
347 g = colorsPtr[i].green >> 8; |
|
348 b = colorsPtr[i].blue >> 8; |
|
349 pixel = alloc_col(awt_display, awtData->awt_cmap, r, g, b, -1, awtData); |
|
350 } |
|
351 } |
338 } |
352 #endif /* !HEADLESS */ |
339 #endif /* !HEADLESS */ |
353 |
340 |
354 void |
341 void |
355 awt_fill_imgcv(ImgConvertFcn **array, int mask, int value, ImgConvertFcn fcn) |
342 awt_fill_imgcv(ImgConvertFcn **array, int mask, int value, ImgConvertFcn fcn) |
1274 #endif /* !HEADLESS */ |
1261 #endif /* !HEADLESS */ |
1275 |
1262 |
1276 extern jfieldID colorValueID; |
1263 extern jfieldID colorValueID; |
1277 |
1264 |
1278 #ifndef HEADLESS |
1265 #ifndef HEADLESS |
1279 int awtJNI_GetColor(JNIEnv *env,jobject this) |
|
1280 { |
|
1281 /* REMIND: should not be defaultConfig. */ |
|
1282 return awtJNI_GetColorForVis (env, this, getDefaultConfig(DefaultScreen(awt_display))); |
|
1283 } |
|
1284 |
|
1285 int awtJNI_GetColorForVis (JNIEnv *env,jobject this, AwtGraphicsConfigDataPtr awt_data) |
1266 int awtJNI_GetColorForVis (JNIEnv *env,jobject this, AwtGraphicsConfigDataPtr awt_data) |
1286 { |
1267 { |
1287 int col; |
1268 int col; |
1288 jclass SYSCLR_class; |
1269 jclass SYSCLR_class; |
1289 |
1270 |