--- a/XWorkstat.st Tue Jun 04 22:17:55 1996 +0200
+++ b/XWorkstat.st Wed Jun 05 16:01:41 1996 +0200
@@ -6808,7 +6808,8 @@
!
getPixelX:x y:y from:aDrawableId
- "return the pixel value at x/y; coordinates start at 0/0 for the upper left."
+ "return the pixel value at x/y; coordinates start at 0/0 for the upper left.
+ Nil is returned for invalid coordinates or if any other problem arises."
%{ /* UNLIMITEDSTACK NOCONTEXT */
@@ -6818,16 +6819,18 @@
int xpos, ypos;
if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
- win = _WindowVal(aDrawableId);
- xpos = __intVal(x);
- ypos = __intVal(y);
- if ((xpos < 0) || (ypos < 0)) {
- RETURN ( __MKSMALLINT(0) );
- }
- img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
- ret = XGetPixel(img, 0, 0);
- XDestroyImage(img);
- RETURN ( __MKSMALLINT(ret) );
+ win = _WindowVal(aDrawableId);
+ xpos = __intVal(x);
+ ypos = __intVal(y);
+ if ((xpos < 0) || (ypos < 0)) {
+ RETURN ( __MKSMALLINT(0) );
+ }
+ img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
+ if (img != 0) {
+ ret = XGetPixel(img, 0, 0);
+ XDestroyImage(img);
+ RETURN ( __MKSMALLINT(ret) );
+ }
}
%}.
^ nil
@@ -7966,6 +7969,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.134 1996-06-04 17:07:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.135 1996-06-05 14:01:41 cg Exp $'
! !
XWorkstation initialize!
--- a/XWorkstation.st Tue Jun 04 22:17:55 1996 +0200
+++ b/XWorkstation.st Wed Jun 05 16:01:41 1996 +0200
@@ -6808,7 +6808,8 @@
!
getPixelX:x y:y from:aDrawableId
- "return the pixel value at x/y; coordinates start at 0/0 for the upper left."
+ "return the pixel value at x/y; coordinates start at 0/0 for the upper left.
+ Nil is returned for invalid coordinates or if any other problem arises."
%{ /* UNLIMITEDSTACK NOCONTEXT */
@@ -6818,16 +6819,18 @@
int xpos, ypos;
if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
- win = _WindowVal(aDrawableId);
- xpos = __intVal(x);
- ypos = __intVal(y);
- if ((xpos < 0) || (ypos < 0)) {
- RETURN ( __MKSMALLINT(0) );
- }
- img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
- ret = XGetPixel(img, 0, 0);
- XDestroyImage(img);
- RETURN ( __MKSMALLINT(ret) );
+ win = _WindowVal(aDrawableId);
+ xpos = __intVal(x);
+ ypos = __intVal(y);
+ if ((xpos < 0) || (ypos < 0)) {
+ RETURN ( __MKSMALLINT(0) );
+ }
+ img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
+ if (img != 0) {
+ ret = XGetPixel(img, 0, 0);
+ XDestroyImage(img);
+ RETURN ( __MKSMALLINT(ret) );
+ }
}
%}.
^ nil
@@ -7966,6 +7969,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.134 1996-06-04 17:07:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.135 1996-06-05 14:01:41 cg Exp $'
! !
XWorkstation initialize!