XWorkstation.st
changeset 160 f7d9126b3c0b
parent 158 34bade266dec
child 162 0f14db5e47c1
equal deleted inserted replaced
159:4c8ff071c8de 160:f7d9126b3c0b
    33 
    33 
    34 XWorkstation comment:'
    34 XWorkstation comment:'
    35 COPYRIGHT (c) 1989 by Claus Gittinger
    35 COPYRIGHT (c) 1989 by Claus Gittinger
    36 	      All Rights Reserved
    36 	      All Rights Reserved
    37 
    37 
    38 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.51 1995-07-27 23:54:05 claus Exp $
    38 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.52 1995-08-03 01:33:27 claus Exp $
    39 '!
    39 '!
    40 
    40 
    41 !XWorkstation class methodsFor:'documentation'!
    41 !XWorkstation class methodsFor:'documentation'!
    42 
    42 
    43 copyright
    43 copyright
    54 "
    54 "
    55 !
    55 !
    56 
    56 
    57 version
    57 version
    58 "
    58 "
    59 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.51 1995-07-27 23:54:05 claus Exp $
    59 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.52 1995-08-03 01:33:27 claus Exp $
    60 "
    60 "
    61 !
    61 !
    62 
    62 
    63 documentation
    63 documentation
    64 "
    64 "
  4876 !XWorkstation methodsFor:'retrieving pixels'!
  4876 !XWorkstation methodsFor:'retrieving pixels'!
  4877 
  4877 
  4878 getPixelX:x y:y from:aDrawableId
  4878 getPixelX:x y:y from:aDrawableId
  4879     "return the pixel value at x/y; coordinates start at 0/0 for the upper left."
  4879     "return the pixel value at x/y; coordinates start at 0/0 for the upper left."
  4880 
  4880 
  4881 %{  /* NOCONTEXT */
  4881 %{  /* UNLIMITEDSTACK NOCONTEXT */
  4882 
  4882 
  4883     Window win = _WindowVal(aDrawableId);
  4883     Window win = _WindowVal(aDrawableId);
  4884     XImage *img;
  4884     XImage *img;
  4885     int ret;
  4885     int ret;
  4886     int xpos, ypos;
  4886     int xpos, ypos;
  4894 	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
  4894 	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
  4895 	ret = XGetPixel(img, 0, 0);
  4895 	ret = XGetPixel(img, 0, 0);
  4896 	XDestroyImage(img);
  4896 	XDestroyImage(img);
  4897 	RETURN (  _MKSMALLINT(ret) );
  4897 	RETURN (  _MKSMALLINT(ret) );
  4898     }
  4898     }
  4899 %}
  4899 %}.
  4900 .
       
  4901     self primitiveFailed.
       
  4902     ^ nil
  4900     ^ nil
  4903 !
  4901 !
  4904 
  4902 
  4905 getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits
  4903 getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits
  4906     "get bits from a drawable into the imageBits. The storage for the bits
  4904     "get bits from a drawable into the imageBits. The storage for the bits
  4918 
  4916 
  4919     info := Array with:nil "depth"
  4917     info := Array with:nil "depth"
  4920 		  with:nil "bit order"
  4918 		  with:nil "bit order"
  4921 		  with:nil "bytes_per_line"
  4919 		  with:nil "bytes_per_line"
  4922 		  with:nil "byte_order".
  4920 		  with:nil "byte_order".
       
  4921 
       
  4922     "/ had to extract the getPixel call into a separate method, to specify
       
  4923     "/ unlimitedStack (some implementations use alloca and require huge amounts
       
  4924     "/ of temporary stack space
  4923 
  4925 
  4924     (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInfo:info) ifTrue:[
  4926     (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInfo:info) ifTrue:[
  4925 	^ info
  4927 	^ info
  4926     ].
  4928     ].
  4927     "
  4929     "