Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 08 Mar 2016 07:59:36 +0000
branchjv
changeset 7202 fc488e2907c8
parent 7201 b88ebe046079 (current diff)
parent 7200 a12560d93bdb (diff)
child 7204 bdf57a9327dc
Merge
FixedPalette.st
Image.st
Make.proto
Make.spec
abbrev.stc
bc.mak
libInit.cc
libview.rc
stx_libview.st
--- a/Depth16Image.st	Tue Mar 08 07:56:04 2016 +0000
+++ b/Depth16Image.st	Tue Mar 08 07:59:36 2016 +0000
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 Image subclass:#Depth16Image
 	instanceVariableNames:''
 	classVariableNames:''
@@ -83,7 +85,6 @@
 
     lineIndex := (width * 2 * y) + 1.
 
-    "left pixel in high bits"
     ^ bytes wordAt:(lineIndex + (x * 2)) MSB:true.
 
     "Created: 24.4.1997 / 16:06:19 / cg"
@@ -109,16 +110,20 @@
      Notice: row coordinate starts at 0."
 
     |dstIdx "{ Class: SmallInteger }"
+     srcIdx "{ Class: SmallInteger }"
      pixel
      bytes|
 
     bytes := self bits.
     dstIdx := (width * 2 * y) + 1.
+    srcIdx := startIndex.
     1 to:width do:[:col |
-	pixel := pixelArray at:(startIndex + col - 1).
-	bytes at:dstIdx put:((pixel bitShift:-8) bitAnd:16rFF).
-	bytes at:dstIdx+1 put:(pixel bitAnd:16rFF).
-	dstIdx := dstIdx + 2.
+        pixel := pixelArray at:srcIdx.
+        "/ msbFirst
+        bytes at:dstIdx put:((pixel bitShift:-8) bitAnd:16rFF).
+        bytes at:dstIdx+1 put:(pixel bitAnd:16rFF).
+        dstIdx := dstIdx + 2.
+        srcIdx := srcIdx + 1.
     ].
     ^ pixelArray
 
@@ -199,10 +204,10 @@
 !Depth16Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.17 2014-03-02 14:39:22 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.17 2014-03-02 14:39:22 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/Depth4Image.st	Tue Mar 08 07:56:04 2016 +0000
+++ b/Depth4Image.st	Tue Mar 08 07:59:36 2016 +0000
@@ -42,13 +42,15 @@
     Most images coming from the windows world are represented as Depth4Images.
     It mainly consists of methods already implemented in Image,
     reimplemented here for more performance.
-
+    Pixels for even x coordinates are stored in the left (high) nibble.
+    Odd x pixels are in the right (low) nibble.
+    
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 
     [see also:]
-	Depth1Image Depth2Image Depth8Image Depth16Image Depth24Image
-	ImageReader
+        Depth1Image Depth2Image Depth8Image Depth16Image Depth24Image
+        ImageReader
 "
 ! !
 
--- a/FixedPalette.st	Tue Mar 08 07:56:04 2016 +0000
+++ b/FixedPalette.st	Tue Mar 08 07:59:36 2016 +0000
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 ColorPalette subclass:#FixedPalette
 	instanceVariableNames:'redShift redMask greenShift greenMask blueShift blueMask'
 	classVariableNames:''
@@ -82,19 +84,34 @@
     self storeOn:aStream
 !
 
-storeOn:aStream
-    aStream nextPutAll:'(' , self class name. 
+storeInstVarsOn:aStream
     aStream nextPutAll:' redShift:'. redShift storeOn:aStream.
     aStream nextPutAll:' redMask:'. redMask storeOn:aStream.
     aStream nextPutAll:' greenShift:'. greenShift storeOn:aStream.
     aStream nextPutAll:' greenMask:'. greenMask storeOn:aStream.
     aStream nextPutAll:' blueShift:'. blueShift storeOn:aStream.
     aStream nextPutAll:' blueMask:'. blueMask storeOn:aStream.
+!
+
+storeOn:aStream
+    aStream nextPutAll:'(' , self class name. 
+    self storeInstVarsOn:aStream.
     aStream nextPutAll:')'.
 ! !
 
 !FixedPalette methodsFor:'queries'!
 
+alphaByteAt:index
+    "return the (simulated) alphaByte at index.
+     Notice that index is 1.."
+
+    ^ 0
+!
+
+bitsAlpha
+    ^ 0
+!
+
 bitsBlue
     ^ blueMask highBit
 !
@@ -113,6 +130,8 @@
 
     |b bb|
 
+    blueMask == 0 ifTrue:[^ 0]. "/ no blue component
+    
     b := ((index-1 bitShift:blueShift negated) bitAnd:blueMask).
     bb := (b * 255.0 / (blueMask)) rounded.
     ^ bb
@@ -133,6 +152,8 @@
 
     |g gb|
 
+    greenMask == 0 ifTrue:[^ 0]. "/ no green component
+
     g := ((index-1 bitShift:greenShift negated) bitAnd:greenMask).
     gb := (g * 255.0 / (greenMask)) rounded.
     ^ gb
@@ -157,6 +178,8 @@
 
     |r rb|
 
+    redMask == 0 ifTrue:[^ 0]. "/ no red component
+
     r := ((index-1 bitShift:redShift negated) bitAnd:redMask).
     rb := (r * 255.0 / (redMask)) rounded.
     ^ rb
@@ -188,6 +211,6 @@
 !FixedPalette class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/FixedPalette.st,v 1.3 2004-06-07 09:21:45 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FixedPaletteWithAlpha.st	Tue Mar 08 07:59:36 2016 +0000
@@ -0,0 +1,100 @@
+"
+ COPYRIGHT (c) 2016 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libview' }"
+
+"{ NameSpace: Smalltalk }"
+
+FixedPalette subclass:#FixedPaletteWithAlpha
+	instanceVariableNames:'alphaShift alphaMask'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Graphics-Images-Support'
+!
+
+!FixedPaletteWithAlpha class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2016 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!FixedPaletteWithAlpha methodsFor:'accessing'!
+
+alphaShift:alphaShiftArg alphaMask:alphaMaskArg 
+    alphaShift := alphaShiftArg.
+    alphaMask := alphaMaskArg.
+! !
+
+!FixedPaletteWithAlpha methodsFor:'printing & storing'!
+
+size
+    "return the number of (simulated) colors in this colormap"
+
+    ^ ((alphaMask bitShift:alphaShift)
+        + (redMask bitShift:redShift)
+        + (greenMask bitShift:greenShift)
+        + (blueMask bitShift:blueShift)) + 1 
+!
+
+storeInstVarsOn:aStream
+    super storeInstVarsOn:aStream.
+    aStream nextPutAll:' alphaShift:'. alphaShift storeOn:aStream.
+    aStream nextPutAll:' alphaMask:'. alphaMask storeOn:aStream.
+! !
+
+!FixedPaletteWithAlpha methodsFor:'queries'!
+
+alphaByteAt:index
+    "return the (simulated) alphaByte at index.
+     Notice that index is 1.."
+
+    |a aa|
+
+    alphaMask == 0 ifTrue:[^ 0]. "/ no alpha component
+    
+    a := ((index-1 bitShift:alphaShift negated) bitAnd:alphaMask).
+    aa := (a * 255.0 / (alphaMask)) rounded.
+    ^ aa
+
+    "
+     (FixedPalette redShift:16 redMask:16rFF greenShift:8 greenMask:16rFF blueShift:0 blueMask:16rFF) blueByteAt:16rFFFFFF+1  
+     (FixedPalette redShift:10 redMask:16r1F greenShift:5 greenMask:16r1F blueShift:0 blueMask:16r1F) blueByteAt:16r7FFF+1  
+     (FixedPalette redShift:11 redMask:16r1F greenShift:5 greenMask:16r3F blueShift:0 blueMask:16r1F) blueByteAt:16rFFFF+1  
+
+     (FixedPalette redShift:11 redMask:16r1F greenShift:5 greenMask:16r3F blueShift:0 blueMask:16r1F) blueByteAt:0+1  
+     (FixedPalette redShift:11 redMask:16r1F greenShift:5 greenMask:16r3F blueShift:0 blueMask:16r1F) blueByteAt:16r7FFF+1  
+    "
+!
+
+bitsAlpha
+    ^ alphaMask highBit
+! !
+
+!FixedPaletteWithAlpha class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
+! !
+
--- a/Image.st	Tue Mar 08 07:56:04 2016 +0000
+++ b/Image.st	Tue Mar 08 07:59:36 2016 +0000
@@ -13367,7 +13367,7 @@
         colorMap notNil ifTrue:[
             p := #palette
         ] ifFalse:[
-"/            'Image [warning]: no photometric - assume greyscale' infoPrintCR
+            "/ 'Image [warning]: no photometric - assume greyscale' infoPrintCR
             p := #blackIs0
         ]
     ].
--- a/Make.proto	Tue Mar 08 07:56:04 2016 +0000
+++ b/Make.proto	Tue Mar 08 07:59:36 2016 +0000
@@ -343,6 +343,7 @@
 $(OUTDIR)WidgetEvent.$(O) WidgetEvent.$(H): WidgetEvent.st $(INCLUDE_TOP)/stx/libbasic/Message.$(H) $(INCLUDE_TOP)/stx/libbasic/MessageSend.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/Event.$(H) $(INCLUDE_TOP)/stx/libview/WindowEvent.$(H) $(STCHDR)
 $(OUTDIR)WindowingTransformation.$(O) WindowingTransformation.$(H): WindowingTransformation.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplayTransform.$(H) $(INCLUDE_TOP)/stx/libview/ScaleTransform.$(H) $(STCHDR)
 $(OUTDIR)XGraphicsContext.$(O) XGraphicsContext.$(H): XGraphicsContext.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)FixedPaletteWithAlpha.$(O) FixedPaletteWithAlpha.$(H): FixedPaletteWithAlpha.st $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libview/ColorPalette.$(H) $(INCLUDE_TOP)/stx/libview/Colormap.$(H) $(INCLUDE_TOP)/stx/libview/FixedPalette.$(H) $(STCHDR)
 $(OUTDIR)MonoMappedPalette.$(O) MonoMappedPalette.$(H): MonoMappedPalette.st $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libview/ColorPalette.$(H) $(INCLUDE_TOP)/stx/libview/Colormap.$(H) $(INCLUDE_TOP)/stx/libview/MappedPalette.$(H) $(STCHDR)
 $(OUTDIR)ShadowView.$(O) ShadowView.$(H): ShadowView.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(STCHDR)
 $(OUTDIR)View.$(O) View.$(H): View.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(STCHDR)
--- a/Make.spec	Tue Mar 08 07:56:04 2016 +0000
+++ b/Make.spec	Tue Mar 08 07:59:36 2016 +0000
@@ -122,6 +122,8 @@
 	WidgetEvent \
 	WindowingTransformation \
 	XGraphicsContext \
+	FixedPalette \
+        FixedPaletteWithAlpha \
 	MonoMappedPalette \
 	ShadowView \
 	View \
@@ -205,6 +207,8 @@
     $(OUTDIR_SLASH)WidgetEvent.$(O) \
     $(OUTDIR_SLASH)WindowingTransformation.$(O) \
     $(OUTDIR_SLASH)XGraphicsContext.$(O) \
+    $(OUTDIR_SLASH)FixedPalette.$(O) \
+    $(OUTDIR_SLASH)FixedPaletteWithAlpha.$(O) \
     $(OUTDIR_SLASH)MonoMappedPalette.$(O) \
     $(OUTDIR_SLASH)ShadowView.$(O) \
     $(OUTDIR_SLASH)View.$(O) \
--- a/abbrev.stc	Tue Mar 08 07:56:04 2016 +0000
+++ b/abbrev.stc	Tue Mar 08 07:59:36 2016 +0000
@@ -70,6 +70,7 @@
 WidgetEvent WidgetEvent stx:libview 'Interface-Support-UI' 0
 WindowingTransformation WindowingTransformation stx:libview 'Graphics-Transformations' 0
 XGraphicsContext XGraphicsContext stx:libview 'Interface-Graphics' 0
+FixedPaletteWithAlpha FixedPaletteWithAlpha stx:libview 'Graphics-Images-Support' 0
 MonoMappedPalette MonoMappedPalette stx:libview 'Graphics-Images-Support' 0
 NeXTWorkstation NeXTWorkstation stx:libview 'Interface-Graphics' 0
 ShadowView ShadowView stx:libview 'Views-Special' 2
--- a/bc.mak	Tue Mar 08 07:56:04 2016 +0000
+++ b/bc.mak	Tue Mar 08 07:59:36 2016 +0000
@@ -154,6 +154,7 @@
 $(OUTDIR)WidgetEvent.$(O) WidgetEvent.$(H): WidgetEvent.st $(INCLUDE_TOP)\stx\libbasic\Message.$(H) $(INCLUDE_TOP)\stx\libbasic\MessageSend.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\Event.$(H) $(INCLUDE_TOP)\stx\libview\WindowEvent.$(H) $(STCHDR)
 $(OUTDIR)WindowingTransformation.$(O) WindowingTransformation.$(H): WindowingTransformation.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplayTransform.$(H) $(INCLUDE_TOP)\stx\libview\ScaleTransform.$(H) $(STCHDR)
 $(OUTDIR)XGraphicsContext.$(O) XGraphicsContext.$(H): XGraphicsContext.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
+$(OUTDIR)FixedPaletteWithAlpha.$(O) FixedPaletteWithAlpha.$(H): FixedPaletteWithAlpha.st $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libview\ColorPalette.$(H) $(INCLUDE_TOP)\stx\libview\Colormap.$(H) $(INCLUDE_TOP)\stx\libview\FixedPalette.$(H) $(STCHDR)
 $(OUTDIR)MonoMappedPalette.$(O) MonoMappedPalette.$(H): MonoMappedPalette.st $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libview\ColorPalette.$(H) $(INCLUDE_TOP)\stx\libview\Colormap.$(H) $(INCLUDE_TOP)\stx\libview\MappedPalette.$(H) $(STCHDR)
 $(OUTDIR)ShadowView.$(O) ShadowView.$(H): ShadowView.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(STCHDR)
 $(OUTDIR)View.$(O) View.$(H): View.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(STCHDR)
--- a/libInit.cc	Tue Mar 08 07:56:04 2016 +0000
+++ b/libInit.cc	Tue Mar 08 07:59:36 2016 +0000
@@ -87,6 +87,8 @@
 _WidgetEvent_Init(pass,__pRT__,snd);
 _WindowingTransformation_Init(pass,__pRT__,snd);
 _XGraphicsContext_Init(pass,__pRT__,snd);
+_FixedPalette_Init(pass,__pRT__,snd);
+_FixedPaletteWithAlpha_Init(pass,__pRT__,snd);
 _MonoMappedPalette_Init(pass,__pRT__,snd);
 _ShadowView_Init(pass,__pRT__,snd);
 _View_Init(pass,__pRT__,snd);
--- a/libview.rc	Tue Mar 08 07:56:04 2016 +0000
+++ b/libview.rc	Tue Mar 08 07:59:36 2016 +0000
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libview.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,1,87
+  FILEVERSION     6,2,1,89
   PRODUCTVERSION  6,2,5,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG\0"
       VALUE "FileDescription", "Smalltalk/X Low Level Graphic Interfacing (LIB)\0"
-      VALUE "FileVersion", "6.2.1.87\0"
+      VALUE "FileVersion", "6.2.1.89\0"
       VALUE "InternalName", "stx:libview\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2012\nCopyright eXept Software AG 2012\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.5.0\0"
-      VALUE "ProductDate", "Wed, 28 Oct 2015 10:30:47 GMT\0"
+      VALUE "ProductDate", "Sun, 06 Mar 2016 23:43:34 GMT\0"
     END
 
   END
--- a/stx_libview.st	Tue Mar 08 07:56:04 2016 +0000
+++ b/stx_libview.st	Tue Mar 08 07:59:36 2016 +0000
@@ -457,7 +457,7 @@
         (AlphaMask autoload)
         DeviceWorkstation
         DisplayRootView
-        (FixedPalette autoload)
+        FixedPalette
         ImageMask
         MacFlatButtonBorder
         MappedPalette
@@ -466,6 +466,7 @@
         WidgetEvent
         WindowingTransformation
         XGraphicsContext
+        FixedPaletteWithAlpha
         MonoMappedPalette
         (NeXTWorkstation autoload)
         ShadowView