< prev index next >

src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c

Print this page




1377 }
1378 
1379 #endif /* !HEADLESS */
1380 
1381 /*
1382  * Class:     sun_java2d_x11_X11SurfaceData
1383  * Method:    XCreateGC
1384  * Signature: (I)J
1385  */
1386 JNIEXPORT jlong JNICALL
1387 Java_sun_java2d_x11_XSurfaceData_XCreateGC
1388     (JNIEnv *env, jclass xsd, jlong pXSData)
1389 {
1390     jlong ret;
1391 
1392 #ifndef HEADLESS
1393     X11SDOps *xsdo;
1394 
1395     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XCreateGC");
1396 
1397     xsdo = (X11SDOps *) pXSData;
1398     if (xsdo == NULL) {
1399         return 0L;
1400     }
1401 
1402     xsdo->javaGC = XCreateGC(awt_display, xsdo->drawable, 0, NULL);
1403     ret = (jlong) xsdo->javaGC;
1404 #else /* !HEADLESS */
1405     ret = 0L;
1406 #endif /* !HEADLESS */
1407 
1408     return ret;
1409 }
1410 
1411 /*
1412  * Class:     sun_java2d_x11_X11SurfaceData
1413  * Method:    XResetClip
1414  * Signature: (JIIIILsun/java2d/pipe/Region;)V
1415  */
1416 JNIEXPORT void JNICALL
1417 Java_sun_java2d_x11_XSurfaceData_XResetClip
1418     (JNIEnv *env, jclass xsd, jlong xgc)
1419 {
1420 #ifndef HEADLESS
1421     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XResetClip");
1422     XSetClipMask(awt_display, (GC) xgc, None);
1423 #endif /* !HEADLESS */
1424 }
1425 
1426 /*
1427  * Class:     sun_java2d_x11_X11SurfaceData
1428  * Method:    XSetClip
1429  * Signature: (JIIIILsun/java2d/pipe/Region;)V
1430  */
1431 JNIEXPORT void JNICALL
1432 Java_sun_java2d_x11_XSurfaceData_XSetClip
1433     (JNIEnv *env, jclass xsd, jlong xgc,
1434      jint x1, jint y1, jint x2, jint y2,
1435      jobject complexclip)
1436 {
1437 #ifndef HEADLESS
1438     int numrects;
1439     XRectangle rects[256];
1440     XRectangle *pRect = rects;
1441 
1442     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetClip");
1443 
1444     numrects = RegionToYXBandedRectangles(env,
1445             x1, y1, x2, y2, complexclip,
1446             &pRect, 256);
1447 
1448     XSetClipRectangles(awt_display, (GC) xgc, 0, 0, pRect, numrects, YXBanded);
1449 
1450     if (pRect != rects) {
1451         free(pRect);
1452     }
1453 #endif /* !HEADLESS */
1454 }
1455 
1456 /*
1457  * Class:     sun_java2d_x11_X11SurfaceData
1458  * Method:    XSetCopyMode
1459  * Signature: (J)V
1460  */
1461 JNIEXPORT void JNICALL
1462 Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode
1463     (JNIEnv *env, jclass xsd, jlong xgc)
1464 {
1465 #ifndef HEADLESS
1466     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetCopyMode");
1467     XSetFunction(awt_display, (GC) xgc, GXcopy);
1468 #endif /* !HEADLESS */
1469 }
1470 
1471 /*
1472  * Class:     sun_java2d_x11_X11SurfaceData
1473  * Method:    XSetXorMode
1474  * Signature: (J)V
1475  */
1476 JNIEXPORT void JNICALL
1477 Java_sun_java2d_x11_X11SurfaceData_XSetXorMode
1478     (JNIEnv *env, jclass xr, jlong xgc)
1479 {
1480 #ifndef HEADLESS
1481     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetXorMode");
1482     XSetFunction(awt_display, (GC) xgc, GXxor);
1483 #endif /* !HEADLESS */
1484 }
1485 
1486 /*
1487  * Class:     sun_java2d_x11_X11SurfaceData
1488  * Method:    XSetForeground
1489  * Signature: (JI)V
1490  */
1491 JNIEXPORT void JNICALL
1492 Java_sun_java2d_x11_X11SurfaceData_XSetForeground
1493     (JNIEnv *env, jclass xsd, jlong xgc, jint pixel)
1494 {
1495 #ifndef HEADLESS
1496     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetForeground");
1497     XSetForeground(awt_display, (GC) xgc, pixel);
1498 #endif /* !HEADLESS */
1499 }
1500 
1501 /*
1502  * Class:     sun_java2d_x11_X11SurfaceData
1503  * Method:    XSetGraphicsExposures
1504  * Signature: (JZ)V
1505  */
1506 JNIEXPORT void JNICALL
1507 Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures
1508     (JNIEnv *env, jclass xsd, jlong xgc, jboolean needExposures)
1509 {
1510 #ifndef HEADLESS
1511     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetGraphicsExposures");
1512     XSetGraphicsExposures(awt_display, (GC) xgc, needExposures ? True : False);
1513 #endif /* !HEADLESS */
1514 }


1377 }
1378 
1379 #endif /* !HEADLESS */
1380 
1381 /*
1382  * Class:     sun_java2d_x11_X11SurfaceData
1383  * Method:    XCreateGC
1384  * Signature: (I)J
1385  */
1386 JNIEXPORT jlong JNICALL
1387 Java_sun_java2d_x11_XSurfaceData_XCreateGC
1388     (JNIEnv *env, jclass xsd, jlong pXSData)
1389 {
1390     jlong ret;
1391 
1392 #ifndef HEADLESS
1393     X11SDOps *xsdo;
1394 
1395     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XCreateGC");
1396 
1397     xsdo = (X11SDOps *) jlong_to_ptr(pXSData);
1398     if (xsdo == NULL) {
1399         return 0L;
1400     }
1401 
1402     xsdo->javaGC = XCreateGC(awt_display, xsdo->drawable, 0, NULL);
1403     ret = ptr_to_jlong(xsdo->javaGC);
1404 #else /* !HEADLESS */
1405     ret = 0L;
1406 #endif /* !HEADLESS */
1407 
1408     return ret;
1409 }
1410 
1411 /*
1412  * Class:     sun_java2d_x11_X11SurfaceData
1413  * Method:    XResetClip
1414  * Signature: (JIIIILsun/java2d/pipe/Region;)V
1415  */
1416 JNIEXPORT void JNICALL
1417 Java_sun_java2d_x11_XSurfaceData_XResetClip
1418     (JNIEnv *env, jclass xsd, jlong xgc)
1419 {
1420 #ifndef HEADLESS
1421     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XResetClip");
1422     XSetClipMask(awt_display, (GC) jlong_to_ptr(xgc), None);
1423 #endif /* !HEADLESS */
1424 }
1425 
1426 /*
1427  * Class:     sun_java2d_x11_X11SurfaceData
1428  * Method:    XSetClip
1429  * Signature: (JIIIILsun/java2d/pipe/Region;)V
1430  */
1431 JNIEXPORT void JNICALL
1432 Java_sun_java2d_x11_XSurfaceData_XSetClip
1433     (JNIEnv *env, jclass xsd, jlong xgc,
1434      jint x1, jint y1, jint x2, jint y2,
1435      jobject complexclip)
1436 {
1437 #ifndef HEADLESS
1438     int numrects;
1439     XRectangle rects[256];
1440     XRectangle *pRect = rects;
1441 
1442     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetClip");
1443 
1444     numrects = RegionToYXBandedRectangles(env,
1445             x1, y1, x2, y2, complexclip,
1446             &pRect, 256);
1447 
1448     XSetClipRectangles(awt_display, (GC) jlong_to_ptr(xgc), 0, 0, pRect, numrects, YXBanded);
1449 
1450     if (pRect != rects) {
1451         free(pRect);
1452     }
1453 #endif /* !HEADLESS */
1454 }
1455 
1456 /*
1457  * Class:     sun_java2d_x11_X11SurfaceData
1458  * Method:    XSetCopyMode
1459  * Signature: (J)V
1460  */
1461 JNIEXPORT void JNICALL
1462 Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode
1463     (JNIEnv *env, jclass xsd, jlong xgc)
1464 {
1465 #ifndef HEADLESS
1466     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetCopyMode");
1467     XSetFunction(awt_display, (GC) jlong_to_ptr(xgc), GXcopy);
1468 #endif /* !HEADLESS */
1469 }
1470 
1471 /*
1472  * Class:     sun_java2d_x11_X11SurfaceData
1473  * Method:    XSetXorMode
1474  * Signature: (J)V
1475  */
1476 JNIEXPORT void JNICALL
1477 Java_sun_java2d_x11_X11SurfaceData_XSetXorMode
1478     (JNIEnv *env, jclass xr, jlong xgc)
1479 {
1480 #ifndef HEADLESS
1481     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetXorMode");
1482     XSetFunction(awt_display, (GC) jlong_to_ptr(xgc), GXxor);
1483 #endif /* !HEADLESS */
1484 }
1485 
1486 /*
1487  * Class:     sun_java2d_x11_X11SurfaceData
1488  * Method:    XSetForeground
1489  * Signature: (JI)V
1490  */
1491 JNIEXPORT void JNICALL
1492 Java_sun_java2d_x11_X11SurfaceData_XSetForeground
1493     (JNIEnv *env, jclass xsd, jlong xgc, jint pixel)
1494 {
1495 #ifndef HEADLESS
1496     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetForeground");
1497     XSetForeground(awt_display, (GC) jlong_to_ptr(xgc), pixel);
1498 #endif /* !HEADLESS */
1499 }
1500 
1501 /*
1502  * Class:     sun_java2d_x11_X11SurfaceData
1503  * Method:    XSetGraphicsExposures
1504  * Signature: (JZ)V
1505  */
1506 JNIEXPORT void JNICALL
1507 Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures
1508     (JNIEnv *env, jclass xsd, jlong xgc, jboolean needExposures)
1509 {
1510 #ifndef HEADLESS
1511     J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetGraphicsExposures");
1512     XSetGraphicsExposures(awt_display, (GC) jlong_to_ptr(xgc), needExposures ? True : False);
1513 #endif /* !HEADLESS */
1514 }
< prev index next >