LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxgraphics.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 39 307 12.7 %
Date: 2014-04-11 Functions: 10 50 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <toolkit/awt/vclxgraphics.hxx>
      22             : #include <toolkit/awt/vclxdevice.hxx>
      23             : #include <toolkit/awt/vclxfont.hxx>
      24             : #include <toolkit/helper/macros.hxx>
      25             : #include <toolkit/helper/vclunohelper.hxx>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : #include <rtl/uuid.h>
      28             : 
      29             : #include <vcl/svapp.hxx>
      30             : #include <vcl/outdev.hxx>
      31             : #include <vcl/image.hxx>
      32             : #include <vcl/gradient.hxx>
      33             : #include <tools/debug.hxx>
      34             : 
      35             : using namespace com::sun::star;
      36             : 
      37             : 
      38             : //  class VCLXGraphics
      39             : 
      40             : 
      41             : // uno::XInterface
      42       15286 : uno::Any VCLXGraphics::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
      43             : {
      44             :     uno::Any aRet = ::cppu::queryInterface( rType,
      45             :                                         (static_cast< ::com::sun::star::awt::XGraphics* >(this)),
      46             :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)),
      47       15286 :                                         (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) );
      48       15286 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
      49             : }
      50             : 
      51             : // lang::XUnoTunnel
      52       64303 : IMPL_XUNOTUNNEL( VCLXGraphics )
      53             : 
      54             : // lang::XTypeProvider
      55           0 : IMPL_XTYPEPROVIDER_START( VCLXGraphics )
      56           0 :     getCppuType( ( uno::Reference< awt::XGraphics>* ) NULL )
      57           0 : IMPL_XTYPEPROVIDER_END
      58             : 
      59       12524 : VCLXGraphics::VCLXGraphics()
      60             :     : mpOutputDevice(NULL)
      61             :     , meRasterOp(ROP_OVERPAINT)
      62       12524 :     , mpClipRegion(NULL)
      63             : {
      64       12524 : }
      65             : 
      66       37572 : VCLXGraphics::~VCLXGraphics()
      67             : {
      68       12524 :     VCLXGraphicsList_impl* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
      69       12524 :     if ( pLst )
      70             :     {
      71       12506 :         for( VCLXGraphicsList_impl::iterator it = pLst->begin(); it != pLst->end(); ++it )
      72             :         {
      73       12506 :             if( *it == this ) {
      74       12506 :                 pLst->erase( it );
      75       12506 :                 break;
      76             :             }
      77             :         }
      78             :     }
      79             : 
      80       12524 :     delete mpClipRegion;
      81       25048 : }
      82             : 
      83          18 : void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
      84             : {
      85          18 :     mpOutputDevice = pOutDev;
      86          18 :     mxDevice = NULL;
      87          18 :     initAttrs();
      88          18 : }
      89             : 
      90       12524 : void VCLXGraphics::Init( OutputDevice* pOutDev )
      91             : {
      92             :     DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init already has pOutDev !" );
      93       12524 :     mpOutputDevice  = pOutDev;
      94             : 
      95       12524 :     initAttrs();
      96       12524 :     mpClipRegion    = NULL;
      97             : 
      98             :     // Register at OutputDevice
      99       12524 :     VCLXGraphicsList_impl* pLst = mpOutputDevice->GetUnoGraphicsList();
     100       12524 :     if ( !pLst )
     101        1193 :         pLst = mpOutputDevice->CreateUnoGraphicsList();
     102       12524 :     pLst->push_back( this );
     103       12524 : }
     104             : 
     105       12542 : void VCLXGraphics::initAttrs()
     106             : {
     107       12542 :     if ( !mpOutputDevice )
     108       12560 :         return;
     109             : 
     110       12524 :     maFont          = mpOutputDevice->GetFont();
     111       12524 :     maTextColor     = mpOutputDevice->GetTextColor(); /* COL_BLACK */
     112       12524 :     maTextFillColor = mpOutputDevice->GetTextFillColor(); /* COL_TRANSPARENT */
     113       12524 :     maLineColor     = mpOutputDevice->GetLineColor(); /* COL_BLACK */
     114       12524 :     maFillColor     = mpOutputDevice->GetFillColor(); /* COL_WHITE */
     115       12524 :     meRasterOp      = mpOutputDevice->GetRasterOp(); /* ROP_OVERPAINT */
     116             : }
     117             : 
     118           0 : void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
     119             : {
     120           0 :     if(mpOutputDevice)
     121             :     {
     122           0 :         SolarMutexGuard aVclGuard;
     123             : 
     124           0 :         if ( nFlags & INITOUTDEV_FONT )
     125             :         {
     126           0 :             mpOutputDevice->SetFont( maFont );
     127           0 :             mpOutputDevice->SetTextColor( maTextColor );
     128           0 :             mpOutputDevice->SetTextFillColor( maTextFillColor );
     129             :         }
     130             : 
     131           0 :         if ( nFlags & INITOUTDEV_COLORS )
     132             :         {
     133           0 :             mpOutputDevice->SetLineColor( maLineColor );
     134           0 :             mpOutputDevice->SetFillColor( maFillColor );
     135             :         }
     136             : 
     137           0 :         if ( nFlags & INITOUTDEV_RASTEROP )
     138             :         {
     139           0 :             mpOutputDevice->SetRasterOp( meRasterOp );
     140             :         }
     141             : 
     142           0 :         if ( nFlags & INITOUTDEV_CLIPREGION )
     143             :         {
     144           0 :             if( mpClipRegion )
     145           0 :                 mpOutputDevice->SetClipRegion( *mpClipRegion );
     146             :             else
     147           0 :                 mpOutputDevice->SetClipRegion();
     148           0 :         }
     149             :     }
     150           0 : }
     151             : 
     152           0 : uno::Reference< awt::XDevice > VCLXGraphics::getDevice() throw(uno::RuntimeException, std::exception)
     153             : {
     154           0 :     SolarMutexGuard aGuard;
     155             : 
     156           0 :     if( !mxDevice.is() && mpOutputDevice )
     157             :     {
     158           0 :         VCLXDevice* pDev = new VCLXDevice;
     159           0 :         pDev->SetOutputDevice( mpOutputDevice );
     160           0 :         mxDevice = pDev;
     161             :     }
     162           0 :     return mxDevice;
     163             : }
     164             : 
     165           0 : awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(uno::RuntimeException, std::exception)
     166             : {
     167           0 :     SolarMutexGuard aGuard;
     168             : 
     169           0 :     awt::SimpleFontMetric aM;
     170           0 :     if( mpOutputDevice )
     171             :     {
     172           0 :         mpOutputDevice->SetFont( maFont );
     173           0 :         aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() );
     174             :     }
     175           0 :     return aM;
     176             : }
     177             : 
     178           0 : void VCLXGraphics::setFont( const uno::Reference< awt::XFont >& rxFont ) throw(uno::RuntimeException, std::exception)
     179             : {
     180           0 :     SolarMutexGuard aGuard;
     181             : 
     182           0 :     maFont = VCLUnoHelper::CreateFont( rxFont );
     183           0 : }
     184             : 
     185           0 : uno::Reference< awt::XFont > VCLXGraphics::getFont() throw(uno::RuntimeException)
     186             : {
     187           0 :     uno::Reference< awt::XFont > xFont;
     188           0 :     uno::Reference< awt::XDevice > xDevice( getDevice() );
     189             : 
     190           0 :     SolarMutexGuard aGuard;
     191             : 
     192           0 :     if ( xDevice.is() )
     193             :     {
     194           0 :         VCLXFont *pFont = new VCLXFont;
     195           0 :         pFont->Init( *xDevice.get(), maFont );
     196           0 :         xFont.set( static_cast< ::cppu::OWeakObject* >( pFont ), uno::UNO_QUERY );
     197             :     }
     198             : 
     199           0 :     return xFont;
     200             : }
     201             : 
     202           0 : void VCLXGraphics::selectFont( const awt::FontDescriptor& rDescription ) throw(uno::RuntimeException, std::exception)
     203             : {
     204           0 :     SolarMutexGuard aGuard;
     205             : 
     206           0 :     maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
     207           0 : }
     208             : 
     209           0 : void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     210             : {
     211           0 :     SolarMutexGuard aGuard;
     212             : 
     213           0 :     maTextColor = Color( (sal_uInt32)nColor );
     214           0 : }
     215             : 
     216           0 : ::sal_Int32 VCLXGraphics::getTextColor() throw(uno::RuntimeException)
     217             : {
     218           0 :     SolarMutexGuard aGuard;
     219           0 :     return maTextColor.GetColor();
     220             : }
     221             : 
     222           0 : void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     223             : {
     224           0 :     SolarMutexGuard aGuard;
     225             : 
     226           0 :     maTextFillColor = Color( (sal_uInt32)nColor );
     227           0 : }
     228             : 
     229           0 : ::sal_Int32 VCLXGraphics::getTextFillColor() throw(uno::RuntimeException)
     230             : {
     231           0 :     SolarMutexGuard aGuard;
     232           0 :     return maTextFillColor.GetColor();
     233             : }
     234             : 
     235           0 : void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     236             : {
     237           0 :     SolarMutexGuard aGuard;
     238             : 
     239           0 :     maLineColor = Color( (sal_uInt32)nColor );
     240           0 : }
     241             : 
     242           0 : ::sal_Int32 VCLXGraphics::getLineColor() throw(uno::RuntimeException)
     243             : {
     244           0 :     SolarMutexGuard aGuard;
     245           0 :     return maLineColor.GetColor();
     246             : }
     247             : 
     248           0 : void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     249             : {
     250           0 :     SolarMutexGuard aGuard;
     251             : 
     252           0 :     maFillColor = Color( (sal_uInt32)nColor );
     253           0 : }
     254             : 
     255           0 : ::sal_Int32 VCLXGraphics::getFillColor() throw(uno::RuntimeException)
     256             : {
     257           0 :     SolarMutexGuard aGuard;
     258           0 :     return maFillColor.GetColor();
     259             : }
     260             : 
     261           0 : void VCLXGraphics::setRasterOp( awt::RasterOperation eROP ) throw(uno::RuntimeException, std::exception)
     262             : {
     263           0 :     SolarMutexGuard aGuard;
     264             : 
     265           0 :     meRasterOp = (RasterOp)eROP;
     266           0 : }
     267             : 
     268           0 : awt::RasterOperation VCLXGraphics::getRasterOp()
     269             : throw(uno::RuntimeException)
     270             : {
     271           0 :     SolarMutexGuard aGuard;
     272           0 :     return (awt::RasterOperation) meRasterOp;
     273             : }
     274             : 
     275           0 : void VCLXGraphics::setClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException, std::exception)
     276             : {
     277           0 :     SolarMutexGuard aGuard;
     278             : 
     279           0 :     delete mpClipRegion;
     280           0 :     if ( rxRegion.is() )
     281           0 :         mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) );
     282             :     else
     283           0 :         mpClipRegion = NULL;
     284           0 : }
     285             : 
     286           0 : void VCLXGraphics::intersectClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException, std::exception)
     287             : {
     288           0 :     SolarMutexGuard aGuard;
     289             : 
     290           0 :     if ( rxRegion.is() )
     291             :     {
     292           0 :         Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
     293           0 :         if ( !mpClipRegion )
     294           0 :             mpClipRegion = new Region( aRegion );
     295             :         else
     296           0 :             mpClipRegion->Intersect( aRegion );
     297           0 :     }
     298           0 : }
     299             : 
     300           0 : void VCLXGraphics::push(  ) throw(uno::RuntimeException, std::exception)
     301             : {
     302           0 :     SolarMutexGuard aGuard;
     303             : 
     304             : 
     305           0 :     if( mpOutputDevice )
     306           0 :         mpOutputDevice->Push();
     307           0 : }
     308             : 
     309           0 : void VCLXGraphics::pop(  ) throw(uno::RuntimeException, std::exception)
     310             : {
     311           0 :     SolarMutexGuard aGuard;
     312             : 
     313             : 
     314           0 :     if( mpOutputDevice )
     315           0 :         mpOutputDevice->Pop();
     316           0 : }
     317             : 
     318           0 : void VCLXGraphics::clear(
     319             :     const awt::Rectangle& aRect )
     320             : throw(uno::RuntimeException, std::exception)
     321             : {
     322           0 :     SolarMutexGuard aGuard;
     323             : 
     324           0 :     if( mpOutputDevice )
     325             :     {
     326           0 :         const ::Rectangle aVCLRect = VCLUnoHelper::ConvertToVCLRect( aRect );
     327           0 :         mpOutputDevice->Erase( aVCLRect );
     328           0 :     }
     329           0 : }
     330             : 
     331           0 : void VCLXGraphics::copy( const uno::Reference< awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException, std::exception)
     332             : {
     333           0 :     SolarMutexGuard aGuard;
     334             : 
     335           0 :     if ( mpOutputDevice )
     336             :     {
     337           0 :         VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
     338             :         DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
     339           0 :         if ( pFromDev )
     340             :         {
     341           0 :             InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
     342             :             mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
     343           0 :                                     Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
     344             :         }
     345           0 :     }
     346           0 : }
     347             : 
     348           0 : void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException, std::exception)
     349             : {
     350           0 :     SolarMutexGuard aGuard;
     351             : 
     352           0 :     if( mpOutputDevice )
     353             :     {
     354           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
     355           0 :         uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
     356           0 :         BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
     357             : 
     358           0 :         Point aPos(nDestX - nSourceX, nDestY - nSourceY);
     359           0 :           Size aSz = aBmpEx.GetSizePixel();
     360             : 
     361           0 :         if(nDestWidth != nSourceWidth)
     362             :         {
     363           0 :             float zoomX = (float)nDestWidth / (float)nSourceWidth;
     364           0 :             aSz.Width() = (long) ((float)aSz.Width() * zoomX);
     365             :         }
     366             : 
     367           0 :         if(nDestHeight != nSourceHeight)
     368             :         {
     369           0 :             float zoomY = (float)nDestHeight / (float)nSourceHeight;
     370           0 :             aSz.Height() = (long) ((float)aSz.Height() * zoomY);
     371             :         }
     372             : 
     373           0 :         if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
     374           0 :             mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
     375             : 
     376           0 :         mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
     377           0 :     }
     378           0 : }
     379             : 
     380           0 : void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(uno::RuntimeException, std::exception)
     381             : {
     382           0 :     SolarMutexGuard aGuard;
     383             : 
     384           0 :     if( mpOutputDevice )
     385             :     {
     386           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     387           0 :         mpOutputDevice->DrawPixel( Point( x, y ) );
     388           0 :     }
     389           0 : }
     390             : 
     391           0 : void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException, std::exception)
     392             : {
     393           0 :     SolarMutexGuard aGuard;
     394             : 
     395           0 :     if( mpOutputDevice )
     396             :     {
     397           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     398           0 :         mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
     399           0 :     }
     400           0 : }
     401             : 
     402           0 : void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException, std::exception)
     403             : {
     404           0 :     SolarMutexGuard aGuard;
     405             : 
     406           0 :     if( mpOutputDevice )
     407             :     {
     408           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     409           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
     410           0 :     }
     411           0 : }
     412             : 
     413           0 : void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(uno::RuntimeException, std::exception)
     414             : {
     415           0 :     SolarMutexGuard aGuard;
     416             : 
     417           0 :     if( mpOutputDevice )
     418             :     {
     419           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     420           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
     421           0 :     }
     422           0 : }
     423             : 
     424           0 : void VCLXGraphics::drawPolyLine( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException, std::exception)
     425             : {
     426           0 :     SolarMutexGuard aGuard;
     427             : 
     428           0 :     if( mpOutputDevice )
     429             :     {
     430           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     431           0 :         mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     432           0 :     }
     433           0 : }
     434             : 
     435           0 : void VCLXGraphics::drawPolygon( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException, std::exception)
     436             : {
     437           0 :     SolarMutexGuard aGuard;
     438             : 
     439           0 :     if( mpOutputDevice )
     440             :     {
     441           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     442           0 :         mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     443           0 :     }
     444           0 : }
     445             : 
     446           0 : void VCLXGraphics::drawPolyPolygon( const uno::Sequence< uno::Sequence< sal_Int32 > >& DataX, const uno::Sequence< uno::Sequence< sal_Int32 > >& DataY ) throw(uno::RuntimeException, std::exception)
     447             : {
     448           0 :     SolarMutexGuard aGuard;
     449             : 
     450           0 :     if( mpOutputDevice )
     451             :     {
     452           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     453           0 :         sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
     454           0 :         PolyPolygon aPolyPoly( nPolys );
     455           0 :         for ( sal_uInt16 n = 0; n < nPolys; n++ )
     456           0 :             aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
     457             : 
     458           0 :         mpOutputDevice->DrawPolyPolygon( aPolyPoly );
     459           0 :     }
     460           0 : }
     461             : 
     462           0 : void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException, std::exception)
     463             : {
     464           0 :     SolarMutexGuard aGuard;
     465             : 
     466           0 :     if( mpOutputDevice )
     467             :     {
     468           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     469           0 :         mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
     470           0 :     }
     471           0 : }
     472             : 
     473           0 : void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException, std::exception)
     474             : {
     475           0 :     SolarMutexGuard aGuard;
     476             : 
     477           0 :     if( mpOutputDevice )
     478             :     {
     479           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     480           0 :         mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     481           0 :     }
     482           0 : }
     483             : 
     484           0 : void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException, std::exception)
     485             : {
     486           0 :     SolarMutexGuard aGuard;
     487             : 
     488           0 :     if( mpOutputDevice )
     489             :     {
     490           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     491           0 :         mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     492           0 :     }
     493           0 : }
     494             : 
     495           0 : void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException, std::exception)
     496             : {
     497           0 :     SolarMutexGuard aGuard;
     498             : 
     499           0 :     if( mpOutputDevice )
     500             :     {
     501           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     502           0 :         mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     503           0 :     }
     504           0 : }
     505             : 
     506           0 : void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const awt::Gradient& rGradient ) throw(uno::RuntimeException, std::exception)
     507             : {
     508           0 :     SolarMutexGuard aGuard;
     509             : 
     510           0 :     if( mpOutputDevice )
     511             :     {
     512           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     513           0 :         Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
     514           0 :         aGradient.SetAngle(rGradient.Angle);
     515           0 :         aGradient.SetBorder(rGradient.Border);
     516           0 :         aGradient.SetOfsX(rGradient.XOffset);
     517           0 :         aGradient.SetOfsY(rGradient.YOffset);
     518           0 :         aGradient.SetStartIntensity(rGradient.StartIntensity);
     519           0 :         aGradient.SetEndIntensity(rGradient.EndIntensity);
     520           0 :         aGradient.SetSteps(rGradient.StepCount);
     521           0 :         mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
     522           0 :     }
     523           0 : }
     524             : 
     525           0 : void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) throw(uno::RuntimeException, std::exception)
     526             : {
     527           0 :     SolarMutexGuard aGuard;
     528             : 
     529           0 :     if( mpOutputDevice )
     530             :     {
     531           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
     532           0 :         mpOutputDevice->DrawText( Point( x, y ), rText );
     533           0 :     }
     534           0 : }
     535             : 
     536           0 : void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rText, const uno::Sequence< sal_Int32 >& rLongs ) throw(uno::RuntimeException, std::exception)
     537             : {
     538           0 :     SolarMutexGuard aGuard;
     539             : 
     540           0 :     if( mpOutputDevice )
     541             :     {
     542           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
     543           0 :         mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() );
     544           0 :     }
     545           0 : }
     546             : 
     547             : 
     548           0 : void VCLXGraphics::drawImage( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int16 nStyle, const uno::Reference< graphic::XGraphic >& xGraphic ) throw(uno::RuntimeException, std::exception)
     549             : {
     550           0 :     SolarMutexGuard aGuard;
     551             : 
     552           0 :     if( mpOutputDevice && xGraphic.is() )
     553             :     {
     554           0 :         Image aImage( xGraphic );
     555           0 :         if ( !!aImage )
     556             :         {
     557           0 :             InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     558           0 :             mpOutputDevice->DrawImage( Point( x, y ), Size( width, height ), aImage, nStyle );
     559           0 :         }
     560           0 :     }
     561           0 : }
     562             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10