2 ===================================================================
3 RCS file: /cvs/gsl/vcl/inc/image.h,v
4 retrieving revision 1.3
5 diff -u -p -u -r1.3 image.h
6 --- vcl/inc/image.h 22 Aug 2002 13:54:19 -0000 1.3
7 +++ vcl/inc/image.h 15 Sep 2003 13:52:49 -0000
8 @@ -85,6 +85,7 @@ class ImplImageBmp
16 Index: vcl/source/gdi/impimage.cxx
17 ===================================================================
18 RCS file: /cvs/gsl/vcl/source/gdi/impimage.cxx,v
19 retrieving revision 1.10
20 diff -u -p -u -r1.10 impimage.cxx
21 --- vcl/source/gdi/impimage.cxx 22 Aug 2002 13:57:18 -0000 1.10
22 +++ vcl/source/gdi/impimage.cxx 25 Sep 2003 08:48:08 -0000
23 @@ -193,8 +193,10 @@ void ImplImageBmp::Expand( USHORT nGrowS
24 aBmp.Expand( nDX, 0UL );
25 aMask.Expand( nDX, 0UL );
29 aDisa.Expand( nDX, 0UL );
30 + aDisaMask.Expand( nDX, 0UL );
33 memset( pNewAry, 0, nSize );
34 memcpy( pNewAry, pInfoAry, nOldSize );
35 @@ -218,8 +220,10 @@ void ImplImageBmp::Replace( USHORT nPos,
37 aMask.CopyPixel( aDstRect, aSrcRect );
41 aDisa.CopyPixel( aDstRect, aSrcRect );
42 + aDisaMask.CopyPixel( aDstRect, aSrcRect );
46 pInfoAry[ nPos ] = pInfoAry[ nSrcPos ];
47 @@ -241,8 +245,10 @@ void ImplImageBmp::Replace( USHORT nPos,
49 aMask.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aMask );
53 aDisa.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aDisa );
54 + aDisaMask.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aDisa );
58 pInfoAry[ nPos ] = rImageBmp.pInfoAry[ nSrcPos ];
59 @@ -299,7 +305,10 @@ void ImplImageBmp::ReplaceColors( const
62 if( !aDisa.IsEmpty() )
65 + aDisaMask.SetEmpty();
68 aBmp.Replace( pSrcColors, pDstColors, nColorCount );
70 @@ -395,7 +404,9 @@ BOOL ImplImageBmp::HasMaskBitmap() const
72 Bitmap ImplImageBmp::GetMaskBitmap( USHORT nPosCount, USHORT* pPosAry ) const
74 - Bitmap aNewMask( Size( nPosCount * aSize.Width(), aSize.Height() ), aMask.GetBitCount() );
75 + Bitmap aNewMask( Size( nPosCount * aSize.Width(), aSize.Height() ),
76 + aMask.GetBitCount(),
77 + aMask.GetBitCount() > 1 ? &Bitmap::GetGreyPalette( 256 ) : NULL );
79 for( USHORT i = 0; i < nPosCount; i++ )
81 @@ -482,7 +493,11 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
85 - aDisa = Bitmap( aBmpEx.GetSizePixel(), 1 );
86 + aDisa = Bitmap( aBmpEx.GetSizePixel(), aBmpEx.GetBitCount() );
87 + if( aBmpEx.GetMask().GetBitCount() == 1 )
88 + aDisaMask = Bitmap( aBmpEx.GetSizePixel(), 1 );
90 + aDisaMask = Bitmap( aBmpEx.GetSizePixel(), 8, &Bitmap::GetGreyPalette( 256 ) );
91 ImplUpdateDisaBmp( DISA_ALL );
92 #ifndef REMOTE_APPSERVER
93 aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
94 @@ -494,10 +509,18 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
95 if( !aDisaDisp && !!aDisa )
96 aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
98 - pOutDev->DrawMask( aOutPos1, aOutSize, aPos, aSize,
99 - aDisaDisp, rSettings.GetLightColor() );
100 - pOutDev->DrawMask( aOutPos, aOutSize, aPos, aSize,
101 - aDisaDisp, rSettings.GetShadowColor() );
102 + if (aDisaDisp.GetBitCount() == 1)
104 + pOutDev->DrawMask( aOutPos1, aOutSize, aPos, aSize,
105 + aDisaDisp, rSettings.GetLightColor() );
106 + pOutDev->DrawMask( aOutPos, aOutSize, aPos, aSize,
107 + aDisaDisp, rSettings.GetShadowColor() );
111 + BitmapEx tBmpEx( aDisa, aDisaMask );
112 + pOutDev->DrawBitmapEx( aOutPos, aOutSize, aPos, aSize, tBmpEx );
117 @@ -505,9 +528,10 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
119 if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) )
122 Bitmap aTmpBmp( aBmp ), aTmpMsk( aMask );
123 const Rectangle aCropRect( aPos, aSize );
126 aTmpBmp.Crop( aCropRect );
127 aTmpMsk.Crop( aCropRect );
129 @@ -607,11 +631,8 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
130 aTmpMsk.Convert( BMP_CONVERSION_8BIT_GREYS );
131 aTmpMsk.Adjust( 50 );
134 - aTmpBmpEx = BitmapEx( aTmpBmp, AlphaMask( aTmpMsk ) );
137 - aTmpBmpEx = BitmapEx( aTmpBmp, aTmpMsk );
138 + aTmpBmpEx = BitmapEx( aTmpBmp, aTmpMsk );
140 pOutDev->DrawBitmapEx( aOutPos, aTmpBmpEx );
142 @@ -651,6 +672,7 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
143 BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
144 BitmapReadAccess* pMsk = aMask.AcquireReadAccess();
145 BitmapWriteAccess* pDis = aDisa.AcquireWriteAccess();
146 + BitmapWriteAccess* pDisMask = aDisaMask.AcquireWriteAccess();
148 if( pAcc && pMsk && pDis )
150 @@ -741,22 +763,52 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
156 + else if (pAcc->GetBitCount() == 32)
158 + for( long nX = nCurLeft; nX < nCurRight; nX++ )
160 for( long nY = nTop; nY < nBottom; nY++ )
162 - for( long nX = nCurLeft; nX < nCurRight; nX++ )
164 - if( ( aMskWhite == pMsk->GetPixel( nY, nX ) ) ||
165 - ( aAccWhite == pAcc->GetPixel( nY, nX ) ) )
166 + BitmapColor col = pAcc->GetPixel( nY, nX );
168 + if ((nY + nX) % 2 == 0)
170 - pDis->SetPixel( nY, nX, aDisWhite );
172 + i = ( col.GetRed() * 0.3 + // magic numbers from gdk-pixbuf
173 + col.GetGreen() * 0.59 +
174 + col.GetBlue () * 0.11 );
176 + col.SetRed (i / 2 + 127);
177 + col.SetGreen (i / 2 + 127);
178 + col.SetBlue (i / 2 + 127);
182 - pDis->SetPixel( nY, nX, aDisBlack );
184 +#define GT_ZERO(c) (((c) >= 0) ? c : 0)
185 + col.SetRed (GT_ZERO (( col.GetRed ()) * 0.7));
186 + col.SetGreen (GT_ZERO (( col.GetGreen ()) * 0.7));
187 + col.SetBlue (GT_ZERO (( col.GetBlue ()) * 0.7));
190 + pDis->SetPixel( nY, nX, col );
191 + // The way the mask is polarised is most strange
192 + BYTE nAlpha = 255 - (BYTE)pMsk->GetPixel( nY, nX );
193 + pDisMask->SetPixel( nY, nX, BitmapColor( 255 - (nAlpha / 2) ) );
196 + nBlackCount = nBlackThreshold;
200 + for( long nY = nTop; nY < nBottom; nY++ )
202 + for( long nX = nCurLeft; nX < nCurRight; nX++ )
204 + if( ( aMskWhite == pMsk->GetPixel( nY, nX ) ) &&
205 + ( aAccWhite != pAcc->GetPixel( nY, nX ) ) )
206 + pDis->SetPixel( nY, nX, aDisBlack );
208 + pDis->SetPixel( nY, nX, aDisWhite );
212 @@ -784,6 +836,7 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
213 aBmp.ReleaseAccess( pAcc );
214 aMask.ReleaseAccess( pMsk );
215 aDisa.ReleaseAccess( pDis );
216 + aDisa.ReleaseAccess( pDisMask );
219 // -----------------------------------------------------------------------