LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxgraphics.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 39 287 13.6 %
Date: 2015-06-13 12:38:46 Functions: 10 44 22.7 %
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 <cppuhelper/queryinterface.hxx>
      28             : #include <rtl/uuid.h>
      29             : #include <sal/alloca.h>
      30             : 
      31             : #include <vcl/svapp.hxx>
      32             : #include <vcl/outdev.hxx>
      33             : #include <vcl/image.hxx>
      34             : #include <vcl/gradient.hxx>
      35             : #include <tools/debug.hxx>
      36             : 
      37             : using namespace com::sun::star;
      38             : 
      39             : 
      40             : //  class VCLXGraphics
      41             : 
      42             : 
      43             : // uno::XInterface
      44       33056 : uno::Any VCLXGraphics::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
      45             : {
      46             :     uno::Any aRet = ::cppu::queryInterface( rType,
      47             :                                         (static_cast< ::com::sun::star::awt::XGraphics* >(this)),
      48             :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)),
      49       33056 :                                         (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) );
      50       33056 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
      51             : }
      52             : 
      53             : // lang::XUnoTunnel
      54      137347 : IMPL_XUNOTUNNEL( VCLXGraphics )
      55             : 
      56             : // lang::XTypeProvider
      57           0 : IMPL_XTYPEPROVIDER_START( VCLXGraphics )
      58           0 :     cppu::UnoType<awt::XGraphics>::get()
      59           0 : IMPL_XTYPEPROVIDER_END
      60             : 
      61       28505 : VCLXGraphics::VCLXGraphics()
      62             :     : mpOutputDevice(NULL)
      63             :     , meRasterOp(ROP_OVERPAINT)
      64       28505 :     , mpClipRegion(NULL)
      65             : {
      66       28505 : }
      67             : 
      68       85515 : VCLXGraphics::~VCLXGraphics()
      69             : {
      70       28505 :     std::vector< VCLXGraphics* > *pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
      71       28505 :     if ( pLst )
      72             :     {
      73       28478 :         for( std::vector< VCLXGraphics* >::iterator it = pLst->begin(); it != pLst->end(); ++it )
      74             :         {
      75       28478 :             if( *it == this ) {
      76       28478 :                 pLst->erase( it );
      77       28478 :                 break;
      78             :             }
      79             :         }
      80             :     }
      81             : 
      82       28505 :     delete mpClipRegion;
      83       57010 : }
      84             : 
      85          27 : void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
      86             : {
      87          27 :     mpOutputDevice = pOutDev;
      88          27 :     mxDevice = NULL;
      89          27 :     initAttrs();
      90          27 : }
      91             : 
      92       28505 : void VCLXGraphics::Init( OutputDevice* pOutDev )
      93             : {
      94             :     DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init already has pOutDev !" );
      95       28505 :     mpOutputDevice  = pOutDev;
      96             : 
      97       28505 :     initAttrs();
      98       28505 :     mpClipRegion    = NULL;
      99             : 
     100             :     // Register at OutputDevice
     101       28505 :     std::vector< VCLXGraphics* > *pLst = mpOutputDevice->GetUnoGraphicsList();
     102       28505 :     if ( !pLst )
     103         760 :         pLst = mpOutputDevice->CreateUnoGraphicsList();
     104       28505 :     pLst->push_back( this );
     105       28505 : }
     106             : 
     107       28532 : void VCLXGraphics::initAttrs()
     108             : {
     109       28532 :     if ( !mpOutputDevice )
     110       28559 :         return;
     111             : 
     112       28505 :     maFont          = mpOutputDevice->GetFont();
     113       28505 :     maTextColor     = mpOutputDevice->GetTextColor(); /* COL_BLACK */
     114       28505 :     maTextFillColor = mpOutputDevice->GetTextFillColor(); /* COL_TRANSPARENT */
     115       28505 :     maLineColor     = mpOutputDevice->GetLineColor(); /* COL_BLACK */
     116       28505 :     maFillColor     = mpOutputDevice->GetFillColor(); /* COL_WHITE */
     117       28505 :     meRasterOp      = mpOutputDevice->GetRasterOp(); /* ROP_OVERPAINT */
     118             : }
     119             : 
     120           0 : void VCLXGraphics::InitOutputDevice( InitOutDevFlags nFlags )
     121             : {
     122           0 :     if(mpOutputDevice)
     123             :     {
     124           0 :         SolarMutexGuard aVclGuard;
     125             : 
     126           0 :         if ( nFlags & InitOutDevFlags::FONT )
     127             :         {
     128           0 :             mpOutputDevice->SetFont( maFont );
     129           0 :             mpOutputDevice->SetTextColor( maTextColor );
     130           0 :             mpOutputDevice->SetTextFillColor( maTextFillColor );
     131             :         }
     132             : 
     133           0 :         if ( nFlags & InitOutDevFlags::COLORS )
     134             :         {
     135           0 :             mpOutputDevice->SetLineColor( maLineColor );
     136           0 :             mpOutputDevice->SetFillColor( maFillColor );
     137             :         }
     138             : 
     139           0 :         if ( nFlags & InitOutDevFlags::RASTEROP )
     140             :         {
     141           0 :             mpOutputDevice->SetRasterOp( meRasterOp );
     142             :         }
     143             : 
     144           0 :         if ( nFlags & InitOutDevFlags::CLIPREGION )
     145             :         {
     146           0 :             if( mpClipRegion )
     147           0 :                 mpOutputDevice->SetClipRegion( *mpClipRegion );
     148             :             else
     149           0 :                 mpOutputDevice->SetClipRegion();
     150           0 :         }
     151             :     }
     152           0 : }
     153             : 
     154           0 : uno::Reference< awt::XDevice > VCLXGraphics::getDevice() throw(uno::RuntimeException, std::exception)
     155             : {
     156           0 :     SolarMutexGuard aGuard;
     157             : 
     158           0 :     if( !mxDevice.is() && mpOutputDevice )
     159             :     {
     160           0 :         VCLXDevice* pDev = new VCLXDevice;
     161           0 :         pDev->SetOutputDevice( mpOutputDevice );
     162           0 :         mxDevice = pDev;
     163             :     }
     164           0 :     return mxDevice;
     165             : }
     166             : 
     167           0 : awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(uno::RuntimeException, std::exception)
     168             : {
     169           0 :     SolarMutexGuard aGuard;
     170             : 
     171           0 :     awt::SimpleFontMetric aM;
     172           0 :     if( mpOutputDevice )
     173             :     {
     174           0 :         mpOutputDevice->SetFont( maFont );
     175           0 :         aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() );
     176             :     }
     177           0 :     return aM;
     178             : }
     179             : 
     180           0 : void VCLXGraphics::setFont( const uno::Reference< awt::XFont >& rxFont ) throw(uno::RuntimeException, std::exception)
     181             : {
     182           0 :     SolarMutexGuard aGuard;
     183             : 
     184           0 :     maFont = VCLUnoHelper::CreateFont( rxFont );
     185           0 : }
     186             : 
     187           0 : void VCLXGraphics::selectFont( const awt::FontDescriptor& rDescription ) throw(uno::RuntimeException, std::exception)
     188             : {
     189           0 :     SolarMutexGuard aGuard;
     190             : 
     191           0 :     maFont = VCLUnoHelper::CreateFont( rDescription, vcl::Font() );
     192           0 : }
     193             : 
     194           0 : void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     195             : {
     196           0 :     SolarMutexGuard aGuard;
     197             : 
     198           0 :     maTextColor = Color( (sal_uInt32)nColor );
     199           0 : }
     200             : 
     201           0 : void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     202             : {
     203           0 :     SolarMutexGuard aGuard;
     204             : 
     205           0 :     maTextFillColor = Color( (sal_uInt32)nColor );
     206           0 : }
     207             : 
     208           0 : void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     209             : {
     210           0 :     SolarMutexGuard aGuard;
     211             : 
     212           0 :     maLineColor = Color( (sal_uInt32)nColor );
     213           0 : }
     214             : 
     215           0 : void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(uno::RuntimeException, std::exception)
     216             : {
     217           0 :     SolarMutexGuard aGuard;
     218             : 
     219           0 :     maFillColor = Color( (sal_uInt32)nColor );
     220           0 : }
     221             : 
     222           0 : void VCLXGraphics::setRasterOp( awt::RasterOperation eROP ) throw(uno::RuntimeException, std::exception)
     223             : {
     224           0 :     SolarMutexGuard aGuard;
     225             : 
     226           0 :     meRasterOp = (RasterOp)eROP;
     227           0 : }
     228             : 
     229           0 : void VCLXGraphics::setClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException, std::exception)
     230             : {
     231           0 :     SolarMutexGuard aGuard;
     232             : 
     233           0 :     delete mpClipRegion;
     234           0 :     if ( rxRegion.is() )
     235           0 :         mpClipRegion = new vcl::Region( VCLUnoHelper::GetRegion( rxRegion ) );
     236             :     else
     237           0 :         mpClipRegion = NULL;
     238           0 : }
     239             : 
     240           0 : void VCLXGraphics::intersectClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException, std::exception)
     241             : {
     242           0 :     SolarMutexGuard aGuard;
     243             : 
     244           0 :     if ( rxRegion.is() )
     245             :     {
     246           0 :         vcl::Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
     247           0 :         if ( !mpClipRegion )
     248           0 :             mpClipRegion = new vcl::Region( aRegion );
     249             :         else
     250           0 :             mpClipRegion->Intersect( aRegion );
     251           0 :     }
     252           0 : }
     253             : 
     254           0 : void VCLXGraphics::push(  ) throw(uno::RuntimeException, std::exception)
     255             : {
     256           0 :     SolarMutexGuard aGuard;
     257             : 
     258             : 
     259           0 :     if( mpOutputDevice )
     260           0 :         mpOutputDevice->Push();
     261           0 : }
     262             : 
     263           0 : void VCLXGraphics::pop(  ) throw(uno::RuntimeException, std::exception)
     264             : {
     265           0 :     SolarMutexGuard aGuard;
     266             : 
     267             : 
     268           0 :     if( mpOutputDevice )
     269           0 :         mpOutputDevice->Pop();
     270           0 : }
     271             : 
     272           0 : void VCLXGraphics::clear(
     273             :     const awt::Rectangle& aRect )
     274             : throw(uno::RuntimeException, std::exception)
     275             : {
     276           0 :     SolarMutexGuard aGuard;
     277             : 
     278           0 :     if( mpOutputDevice )
     279             :     {
     280           0 :         const ::Rectangle aVCLRect = VCLUnoHelper::ConvertToVCLRect( aRect );
     281           0 :         mpOutputDevice->Erase( aVCLRect );
     282           0 :     }
     283           0 : }
     284             : 
     285           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)
     286             : {
     287           0 :     SolarMutexGuard aGuard;
     288             : 
     289           0 :     if ( mpOutputDevice )
     290             :     {
     291           0 :         VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
     292             :         DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
     293           0 :         if ( pFromDev )
     294             :         {
     295           0 :             InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP );
     296           0 :             mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
     297           0 :                                     Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
     298             :         }
     299           0 :     }
     300           0 : }
     301             : 
     302           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)
     303             : {
     304           0 :     SolarMutexGuard aGuard;
     305             : 
     306           0 :     if( mpOutputDevice )
     307             :     {
     308           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP);
     309           0 :         uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
     310           0 :         BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
     311             : 
     312           0 :         Point aPos(nDestX - nSourceX, nDestY - nSourceY);
     313           0 :           Size aSz = aBmpEx.GetSizePixel();
     314             : 
     315           0 :         if(nDestWidth != nSourceWidth)
     316             :         {
     317           0 :             float zoomX = (float)nDestWidth / (float)nSourceWidth;
     318           0 :             aSz.Width() = (long) ((float)aSz.Width() * zoomX);
     319             :         }
     320             : 
     321           0 :         if(nDestHeight != nSourceHeight)
     322             :         {
     323           0 :             float zoomY = (float)nDestHeight / (float)nSourceHeight;
     324           0 :             aSz.Height() = (long) ((float)aSz.Height() * zoomY);
     325             :         }
     326             : 
     327           0 :         if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
     328           0 :             mpOutputDevice->IntersectClipRegion(vcl::Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
     329             : 
     330           0 :         mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
     331           0 :     }
     332           0 : }
     333             : 
     334           0 : void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(uno::RuntimeException, std::exception)
     335             : {
     336           0 :     SolarMutexGuard aGuard;
     337             : 
     338           0 :     if( mpOutputDevice )
     339             :     {
     340           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     341           0 :         mpOutputDevice->DrawPixel( Point( x, y ) );
     342           0 :     }
     343           0 : }
     344             : 
     345           0 : void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException, std::exception)
     346             : {
     347           0 :     SolarMutexGuard aGuard;
     348             : 
     349           0 :     if( mpOutputDevice )
     350             :     {
     351           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     352           0 :         mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
     353           0 :     }
     354           0 : }
     355             : 
     356           0 : void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException, std::exception)
     357             : {
     358           0 :     SolarMutexGuard aGuard;
     359             : 
     360           0 :     if( mpOutputDevice )
     361             :     {
     362           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     363           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
     364           0 :     }
     365           0 : }
     366             : 
     367           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)
     368             : {
     369           0 :     SolarMutexGuard aGuard;
     370             : 
     371           0 :     if( mpOutputDevice )
     372             :     {
     373           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     374           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
     375           0 :     }
     376           0 : }
     377             : 
     378           0 : void VCLXGraphics::drawPolyLine( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException, std::exception)
     379             : {
     380           0 :     SolarMutexGuard aGuard;
     381             : 
     382           0 :     if( mpOutputDevice )
     383             :     {
     384           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     385           0 :         mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     386           0 :     }
     387           0 : }
     388             : 
     389           0 : void VCLXGraphics::drawPolygon( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException, std::exception)
     390             : {
     391           0 :     SolarMutexGuard aGuard;
     392             : 
     393           0 :     if( mpOutputDevice )
     394             :     {
     395           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     396           0 :         mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     397           0 :     }
     398           0 : }
     399             : 
     400           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)
     401             : {
     402           0 :     SolarMutexGuard aGuard;
     403             : 
     404           0 :     if( mpOutputDevice )
     405             :     {
     406           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     407           0 :         sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
     408           0 :         tools::PolyPolygon aPolyPoly( nPolys );
     409           0 :         for ( sal_uInt16 n = 0; n < nPolys; n++ )
     410           0 :             aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
     411             : 
     412           0 :         mpOutputDevice->DrawPolyPolygon( aPolyPoly );
     413           0 :     }
     414           0 : }
     415             : 
     416           0 : void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException, std::exception)
     417             : {
     418           0 :     SolarMutexGuard aGuard;
     419             : 
     420           0 :     if( mpOutputDevice )
     421             :     {
     422           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     423           0 :         mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
     424           0 :     }
     425           0 : }
     426             : 
     427           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)
     428             : {
     429           0 :     SolarMutexGuard aGuard;
     430             : 
     431           0 :     if( mpOutputDevice )
     432             :     {
     433           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     434           0 :         mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     435           0 :     }
     436           0 : }
     437             : 
     438           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)
     439             : {
     440           0 :     SolarMutexGuard aGuard;
     441             : 
     442           0 :     if( mpOutputDevice )
     443             :     {
     444           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     445           0 :         mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     446           0 :     }
     447           0 : }
     448             : 
     449           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)
     450             : {
     451           0 :     SolarMutexGuard aGuard;
     452             : 
     453           0 :     if( mpOutputDevice )
     454             :     {
     455           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     456           0 :         mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     457           0 :     }
     458           0 : }
     459             : 
     460           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)
     461             : {
     462           0 :     SolarMutexGuard aGuard;
     463             : 
     464           0 :     if( mpOutputDevice )
     465             :     {
     466           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     467           0 :         Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
     468           0 :         aGradient.SetAngle(rGradient.Angle);
     469           0 :         aGradient.SetBorder(rGradient.Border);
     470           0 :         aGradient.SetOfsX(rGradient.XOffset);
     471           0 :         aGradient.SetOfsY(rGradient.YOffset);
     472           0 :         aGradient.SetStartIntensity(rGradient.StartIntensity);
     473           0 :         aGradient.SetEndIntensity(rGradient.EndIntensity);
     474           0 :         aGradient.SetSteps(rGradient.StepCount);
     475           0 :         mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
     476           0 :     }
     477           0 : }
     478             : 
     479           0 : void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) throw(uno::RuntimeException, std::exception)
     480             : {
     481           0 :     SolarMutexGuard aGuard;
     482             : 
     483           0 :     if( mpOutputDevice )
     484             :     {
     485           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS |InitOutDevFlags::FONT);
     486           0 :         mpOutputDevice->DrawText( Point( x, y ), rText );
     487           0 :     }
     488           0 : }
     489             : 
     490           0 : void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rText, const uno::Sequence< sal_Int32 >& rLongs ) throw(uno::RuntimeException, std::exception)
     491             : {
     492           0 :     SolarMutexGuard aGuard;
     493             : 
     494           0 :     if( mpOutputDevice )
     495             :     {
     496           0 :         InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS|InitOutDevFlags::FONT );
     497           0 :         long* pDXA = static_cast<long*>(alloca(rText.getLength() * sizeof(long)));
     498           0 :         for(int i = 0; i < rText.getLength(); i++)
     499             :         {
     500           0 :             pDXA[i] = rLongs[i];
     501             :         }
     502           0 :         mpOutputDevice->DrawTextArray( Point( x, y ), rText, pDXA );
     503           0 :     }
     504           0 : }
     505             : 
     506             : 
     507           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)
     508             : {
     509           0 :     SolarMutexGuard aGuard;
     510             : 
     511           0 :     if( mpOutputDevice && xGraphic.is() )
     512             :     {
     513           0 :         Image aImage( xGraphic );
     514           0 :         if ( !!aImage )
     515             :         {
     516           0 :             InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS );
     517           0 :             mpOutputDevice->DrawImage( Point( x, y ), Size( width, height ), aImage, static_cast<DrawImageFlags>(nStyle) );
     518           0 :         }
     519           0 :     }
     520           0 : }
     521             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11