LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/vcl - canvastools.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 0.0 %
Date: 2012-12-27 Functions: 0 2 0.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             : #ifndef _VCL_CANVASTOOLS_HXX
      21             : #define _VCL_CANVASTOOLS_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <com/sun/star/uno/Sequence.hxx>
      25             : #include <com/sun/star/rendering/XColorSpace.hpp>
      26             : #include <basegfx/numeric/ftools.hxx>
      27             : 
      28             : #include <vcl/dllapi.h>
      29             : 
      30             : class Point;
      31             : class Size;
      32             : class Rectangle;
      33             : class Polygon;
      34             : class PolyPolygon;
      35             : class Bitmap;
      36             : class BitmapEx;
      37             : class Color;
      38             : 
      39             : namespace basegfx
      40             : {
      41             :     class B2DVector;
      42             :     class B2DPoint;
      43             :     class B2DRange;
      44             :     class B2IVector;
      45             :     class B2IPoint;
      46             :     class B2IRange;
      47             :     class B2DPolygon;
      48             :     class B2DPolyPolygon;
      49             : }
      50             : 
      51             : namespace com { namespace sun { namespace star { namespace geometry
      52             : {
      53             :     struct RealPoint2D;
      54             :     struct RealSize2D;
      55             :     struct RealRectangle2D;
      56             :     struct IntegerPoint2D;
      57             :     struct IntegerSize2D;
      58             :     struct IntegerRectangle2D;
      59             :     struct RealBezierSegment2D;
      60             : } } } }
      61             : 
      62             : namespace com { namespace sun { namespace star { namespace rendering
      63             : {
      64             :     class  XGraphicDevice;
      65             :     class  XBitmap;
      66             :     class  XIntegerBitmap;
      67             :     class  XIntegerReadOnlyBitmap;
      68             :     class  XPolyPolygon2D;
      69             : } } } }
      70             : 
      71             : namespace vcl
      72             : {
      73             :     namespace unotools
      74             :     {
      75             :         // Bitmap conversions
      76             :         // ===================================================================
      77             : 
      78             :         /** Create an XBitmap from VCL BitmapEx
      79             :          */
      80             :         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
      81             :             VCL_DLLPUBLIC xBitmapFromBitmapEx( const ::com::sun::star::uno::Reference<
      82             :                                                      ::com::sun::star::rendering::XGraphicDevice >&     xGraphicDevice,
      83             :                                                const ::BitmapEx&                                        inputBitmap );
      84             : 
      85             :         /** Create a BitmapEx from an XBitmap
      86             :          */
      87             :         ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const ::com::sun::star::uno::Reference<
      88             :                                                             ::com::sun::star::rendering::XIntegerReadOnlyBitmap >& xInputBitmap );
      89             : 
      90             :         // Color conversions (vcl/tools Color <-> canvas standard color space)
      91             :         // ===================================================================
      92             : 
      93             :         /** Convert color to device color sequence
      94             : 
      95             :             @param rColor
      96             :             Color to convert
      97             : 
      98             :             @param xColorSpace
      99             :             Color space to convert into
     100             :          */
     101             :         ::com::sun::star::uno::Sequence< double >
     102             :         VCL_DLLPUBLIC colorToDoubleSequence( const Color&                                      rColor,
     103             :                                              const ::com::sun::star::uno::Reference<
     104             :                                                    ::com::sun::star::rendering::XColorSpace >& xColorSpace );
     105             : 
     106             :         /** Convert from standard device color space to VCL/Tools color
     107             : 
     108             :             Note that this method assumes a color space equivalent to
     109             :             the one returned from createStandardColorSpace()
     110             :          */
     111             :         Color VCL_DLLPUBLIC stdColorSpaceSequenceToColor(
     112             :             const ::com::sun::star::uno::Sequence< double >& rColor );
     113             : 
     114             :         /** Convert color to device color sequence
     115             : 
     116             :             @param rColor
     117             :             Color sequence to convert from
     118             : 
     119             :             @param xColorSpace
     120             :             Color space to convert from
     121             :          */
     122             :         Color VCL_DLLPUBLIC doubleSequenceToColor( const ::com::sun::star::uno::Sequence< double >   rColor,
     123             :                                                    const ::com::sun::star::uno::Reference<
     124             :                                                          ::com::sun::star::rendering::XColorSpace >& xColorSpace );
     125             : 
     126             :         /// Convert [0,1] double value to [0,255] int
     127           0 :         inline sal_Int8 toByteColor( double val )
     128             :         {
     129             :             return sal::static_int_cast<sal_Int8>(
     130           0 :                 basegfx::fround(val*255.0));
     131             :         }
     132             : 
     133             :         /// Convert [0,255] int value to [0,1] double value
     134           0 :         inline double toDoubleColor( sal_uInt8 val )
     135             :         {
     136           0 :             return val / 255.0;
     137             :         }
     138             : 
     139             :         /// Create a standard color space suitable for VCL RGB color
     140             :         ::com::sun::star::uno::Reference<
     141             :             ::com::sun::star::rendering::XColorSpace> VCL_DLLPUBLIC createStandardColorSpace();
     142             : 
     143             :         // Geometry conversions (vcl/tools <-> x)
     144             :         // ===================================================================
     145             : 
     146             :         // geometry::Real
     147             :         ::com::sun::star::geometry::RealSize2D          VCL_DLLPUBLIC size2DFromSize( const Size& );
     148             : 
     149             :         Size                                            VCL_DLLPUBLIC sizeFromRealSize2D( const ::com::sun::star::geometry::RealSize2D& );
     150             : 
     151             :         // geometry::Integer
     152             :         ::com::sun::star::geometry::IntegerSize2D       VCL_DLLPUBLIC integerSize2DFromSize( const Size& );
     153             : 
     154             :         Size                                            VCL_DLLPUBLIC sizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& );
     155             :         Point                                           VCL_DLLPUBLIC pointFromIntegerPoint2D( const ::com::sun::star::geometry::IntegerPoint2D& );
     156             :         Rectangle                                       VCL_DLLPUBLIC rectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& );
     157             : 
     158             :         // basegfx::B2D
     159             :         Size                        VCL_DLLPUBLIC sizeFromB2DSize( const ::basegfx::B2DVector& );
     160             :         Point                       VCL_DLLPUBLIC pointFromB2DPoint( const ::basegfx::B2DPoint& );
     161             :         Rectangle                   VCL_DLLPUBLIC rectangleFromB2DRectangle( const ::basegfx::B2DRange& );
     162             : 
     163             :         basegfx::B2DVector          VCL_DLLPUBLIC b2DSizeFromSize( const Size& );
     164             :         basegfx::B2DPoint           VCL_DLLPUBLIC b2DPointFromPoint( const Point& );
     165             :         basegfx::B2DRange           VCL_DLLPUBLIC b2DRectangleFromRectangle( const Rectangle& );
     166             : 
     167             :         // basegfx::B2I
     168             :         Point                       VCL_DLLPUBLIC pointFromB2IPoint( const ::basegfx::B2IPoint& );
     169             :         Rectangle                   VCL_DLLPUBLIC rectangleFromB2IRectangle( const ::basegfx::B2IRange& );
     170             :     }
     171             : }
     172             : 
     173             : #endif /* _VCL_CANVASTOOLS_HXX */
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10