NeXTWorkstation.st
changeset 5015 481783839f19
parent 1711 9758281e72fd
child 6065 75ff98ae918d
equal deleted inserted replaced
5014:ca6d2f117ee8 5015:481783839f19
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 DeviceWorkstation subclass:#NeXTWorkstation
    13 DeviceWorkstation subclass:#NeXTWorkstation
    14        instanceVariableNames:'screen
    14        instanceVariableNames:'
    15 			      buffered
    15 			      buffered
    16 			      knownDrawableIds'
    16 			      knownDrawableIds'
    17        classVariableNames:   ''
    17        classVariableNames:   ''
    18        poolDictionaries:''
    18        poolDictionaries:''
    19        category:'Interface-Graphics'
    19        category:'Interface-Graphics'
    28 objc-code here (due to define conflicts with Class, nil ...) we call
    28 objc-code here (due to define conflicts with Class, nil ...) we call
    29 helper functions to do the job; the helpers are in ../librun/NXsupport.c
    29 helper functions to do the job; the helpers are in ../librun/NXsupport.c
    30 
    30 
    31 All non-monochrome stuff is untested (I only have a monochroome station)
    31 All non-monochrome stuff is untested (I only have a monochroome station)
    32 
    32 
    33 $Header: /cvs/stx/stx/libview/NeXTWorkstation.st,v 1.20 1997-05-06 12:49:50 cg Exp $
    33 $Header: /cvs/stx/stx/libview/NeXTWorkstation.st,v 1.21 2008-07-23 12:12:54 cg Exp $
    34 written spring 92 by claus
    34 written spring 92 by claus
    35 '!
    35 '!
    36 
    36 
    37 !NeXTWorkstation primitiveDefinitions!
    37 !NeXTWorkstation primitiveDefinitions!
    38 
    38 
   291      ^ self shouldNotImplement
   291      ^ self shouldNotImplement
   292 !
   292 !
   293 
   293 
   294 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
   294 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
   295 
   295 
   296     |ext minWidth minHeight maxWidth maxHeight 
   296     |ext minWidth minHeight maxWidth maxHeight
   297      bWidth bColor viewBg viewBgId wsuperView wsuperViewId 
   297      bWidth bColor viewBg viewBgId wsuperView wsuperViewId
   298      wlabel wcursor wcursorId wicon wiconId windowId
   298      wlabel wcursor wcursorId wicon wiconId windowId
   299      wiconView wiconViewId
   299      wiconView wiconViewId
   300      drawableId|
   300      drawableId|
   301 
   301 
   302     wsuperView := aView superView.
   302     wsuperView := aView superView.
   473 !
   473 !
   474 
   474 
   475 freeColor:colorIndex
   475 freeColor:colorIndex
   476     "colors are never freed"
   476     "colors are never freed"
   477 
   477 
   478     ^ self 
   478     ^ self
   479 !
   479 !
   480 
   480 
   481 colorRed:redVal green:greenVal blue:blueVal
   481 colorRed:redVal green:greenVal blue:blueVal
   482     "allocate a color with rgb values - return index"
   482     "allocate a color with rgb values - return index"
   483 
   483 
   508 
   508 
   509 setColor:index red:redVal green:greenVal blue:blueVal
   509 setColor:index red:redVal green:greenVal blue:blueVal
   510     "change color in map at:index.
   510     "change color in map at:index.
   511      Since NeXTs are either StaticGrey or StaticColor, do nothing here."
   511      Since NeXTs are either StaticGrey or StaticColor, do nothing here."
   512 
   512 
   513     ^ self 
   513     ^ self
   514 !
   514 !
   515 
   515 
   516 getRedFrom:index
   516 getRedFrom:index
   517     "get red part of color in map at:index"
   517     "get red part of color in map at:index"
   518 
   518 
   552     float r, g, b;
   552     float r, g, b;
   553     NXColor clr;
   553     NXColor clr;
   554 
   554 
   555     if (__isSmallInteger(aColorId)) {
   555     if (__isSmallInteger(aColorId)) {
   556 	id = _intVal(aColorId);
   556 	id = _intVal(aColorId);
   557 	ir = (id >> 16) & 0xFF; 
   557 	ir = (id >> 16) & 0xFF;
   558 	ig = (id >> 8) & 0xFF; 
   558 	ig = (id >> 8) & 0xFF;
   559 	ib = id & 0xFF; 
   559 	ib = id & 0xFF;
   560 	/* scale from 0 .. 255 to 0.0 .. 1.0 */
   560 	/* scale from 0 .. 255 to 0.0 .. 1.0 */
   561 	r = (float)ir / 255.0;
   561 	r = (float)ir / 255.0;
   562 	g = (float)ig / 255.0;
   562 	g = (float)ig / 255.0;
   563 	b = (float)ib / 255.0;
   563 	b = (float)ib / 255.0;
   564 	clr = NXConvertRGBToColor(r, g, b);
   564 	clr = NXConvertRGBToColor(r, g, b);
   758 ! !
   758 ! !
   759 
   759 
   760 !NeXTWorkstation methodsFor:'drawing'!
   760 !NeXTWorkstation methodsFor:'drawing'!
   761 
   761 
   762 displayString:aString x:x y:y in:aDrawableId with:aGCId
   762 displayString:aString x:x y:y in:aDrawableId with:aGCId
   763     "draw a string - draw foreground only" 
   763     "draw a string - draw foreground only"
   764 
   764 
   765 %{
   765 %{
   766     float fx, fy;
   766     float fx, fy;
   767 
   767 
   768     do {
   768     do {
   787 .
   787 .
   788     self primitiveFailed
   788     self primitiveFailed
   789 !
   789 !
   790 
   790 
   791 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
   791 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
   792     "draw part of a string - draw foreground only" 
   792     "draw part of a string - draw foreground only"
   793 
   793 
   794     ^ self primitiveFailed
   794     ^ self primitiveFailed
   795 !
   795 !
   796 
   796 
   797 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId
   797 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId
   798     "draw a string - draw both foreground and background" 
   798     "draw a string - draw both foreground and background"
   799 
   799 
   800     ^ self primitiveFailed
   800     ^ self primitiveFailed
   801 !
   801 !
   802 
   802 
   803 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
   803 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
   804     "draw part of a string - draw both foreground and background" 
   804     "draw part of a string - draw both foreground and background"
   805 
   805 
   806     ^ self primitiveFailed
   806     ^ self primitiveFailed
   807 !
   807 !
   808 
   808 
   809 displayPointX:x y:y in:aDrawableId with:aGCId
   809 displayPointX:x y:y in:aDrawableId with:aGCId
   810     "draw a point" 
   810     "draw a point"
   811 
   811 
   812     ^ self primitiveFailed
   812     ^ self primitiveFailed
   813 !
   813 !
   814 
   814 
   815 displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
   815 displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
   816     "draw a line" 
   816     "draw a line"
   817 
   817 
   818 %{
   818 %{
   819     float fx0, fy0, fx1, fy1;
   819     float fx0, fy0, fx1, fy1;
   820 
   820 
   821     do {
   821     do {
   855 .
   855 .
   856     ^ self primitiveFailed
   856     ^ self primitiveFailed
   857 !
   857 !
   858 
   858 
   859 drawRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
   859 drawRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
   860     "draw a rectangle" 
   860     "draw a rectangle"
   861 
   861 
   862     ^ self primitiveFailed
   862     ^ self primitiveFailed
   863 !
   863 !
   864 
   864 
   865 drawPolygon:aPolygon in:aDrawableId with:aGCId
   865 drawPolygon:aPolygon in:aDrawableId with:aGCId
   866     "draw a polygon" 
   866     "draw a polygon"
   867 
   867 
   868     ^ self primitiveFailed
   868     ^ self primitiveFailed
   869 !
   869 !
   870 
   870 
   871 copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
   871 copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
   943     "fill a polygon"
   943     "fill a polygon"
   944 
   944 
   945     ^ self primitiveFailed
   945     ^ self primitiveFailed
   946 !
   946 !
   947 
   947 
   948 drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight 
   948 drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight
   949 		       x:srcx y:srcy
   949 		       x:srcx y:srcy
   950 		    into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId
   950 		    into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId
   951     "draw a bitimage which has depth id, width iw and height ih into
   951     "draw a bitimage which has depth id, width iw and height ih into
   952      the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
   952      the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
   953      It has to be checked elsewhere, that server can do it with the given
   953      It has to be checked elsewhere, that server can do it with the given