summaryrefslogtreecommitdiff
path: root/vcl/source/control/imgctrl.cxx
diff options
context:
space:
mode:
authorStephan Schäfer <ssa@openoffice.org>2002-04-18 07:11:17 +0000
committerStephan Schäfer <ssa@openoffice.org>2002-04-18 07:11:17 +0000
commit624dea361a30487a8d545db9713b99abf0e749d9 (patch)
tree993e686388284c71c37de9d7e62c0459948b7f52 /vcl/source/control/imgctrl.cxx
parentea059454e3f26a97ae87b54735295e8d5e64c086 (diff)
#98762# support HC bitmaps
Diffstat (limited to 'vcl/source/control/imgctrl.cxx')
-rw-r--r--vcl/source/control/imgctrl.cxx76
1 files changed, 63 insertions, 13 deletions
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index 1e4e36457123..0c4975f10f09 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imgctrl.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: ssa $ $Date: 2002-03-05 09:19:35 $
+ * last change: $Author: ssa $ $Date: 2002-04-18 08:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,19 +105,53 @@ void ImageControl::Resize()
void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
{
- if ( mnDummy1_mbScaleImage )
+ USHORT nStyle = 0;
+ BitmapEx* pBitmap = &maBmp;
+ Color aCol;
+ if( !!maBmpHC && ImplGetCurrentBackgroundColor( aCol ) )
{
- maBmp.Draw( rUDEvt.GetDevice(),
- rUDEvt.GetRect().TopLeft(),
- rUDEvt.GetRect().GetSize() );
+ if( aCol.IsDark() )
+ pBitmap = &maBmpHC;
+ if( aCol.IsBright() )
+ nStyle |= IMAGE_DRAW_COLORTRANSFORM;
+ }
+
+ if( nStyle & IMAGE_DRAW_COLORTRANSFORM )
+ {
+ // only images support IMAGE_DRAW_COLORTRANSFORM
+ Image aImage( maBmp );
+ if ( !!aImage )
+ {
+ if ( mnDummy1_mbScaleImage )
+ rUDEvt.GetDevice()->DrawImage( rUDEvt.GetRect().TopLeft(),
+ rUDEvt.GetRect().GetSize(),
+ aImage, nStyle );
+ else
+ {
+ // Center...
+ Point aPos( rUDEvt.GetRect().TopLeft() );
+ aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2;
+ aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2;
+ rUDEvt.GetDevice()->DrawImage( aPos, aImage, nStyle );
+ }
+ }
}
else
{
- // Center...
- Point aPos( rUDEvt.GetRect().TopLeft() );
- aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2;
- aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2;
- maBmp.Draw( rUDEvt.GetDevice(), aPos );
+ if ( mnDummy1_mbScaleImage )
+ {
+ maBmp.Draw( rUDEvt.GetDevice(),
+ rUDEvt.GetRect().TopLeft(),
+ rUDEvt.GetRect().GetSize() );
+ }
+ else
+ {
+ // Center...
+ Point aPos( rUDEvt.GetRect().TopLeft() );
+ aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2;
+ aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2;
+ maBmp.Draw( rUDEvt.GetDevice(), aPos );
+ }
}
}
@@ -129,12 +163,28 @@ void ImageControl::SetBitmap( const BitmapEx& rBmp )
StateChanged( STATE_CHANGE_DATA );
}
+// -----------------------------------------------------------------------
+
BOOL ImageControl::SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode )
{
- return FALSE;
+ if( eMode == BMP_COLOR_NORMAL )
+ SetBitmap( rBitmap );
+ else if( eMode == BMP_COLOR_HIGHCONTRAST )
+ {
+ maBmpHC = rBitmap;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+ else
+ return FALSE;
+ return TRUE;
}
+// -----------------------------------------------------------------------
+
const BitmapEx& ImageControl::GetModeBitmap( BmpColorMode eMode ) const
{
- return maBmp;
+ if( eMode == BMP_COLOR_HIGHCONTRAST )
+ return maBmpHC;
+ else
+ return maBmp;
}