LibreOffice Module vcl (master)  1
canvastools.hxx
Go to the documentation of this file.
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 INCLUDED_VCL_CANVASTOOLS_HXX
21 #define INCLUDED_VCL_CANVASTOOLS_HXX
22 
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
27 
28 #include <vcl/dllapi.h>
29 
30 class Point;
31 class Size;
32 namespace tools { class Rectangle; }
33 class BitmapEx;
34 class Color;
35 
36 namespace basegfx
37 {
38  class B2DVector;
39  class B2DPoint;
40  class B2DRange;
41  class B2IPoint;
42  class B2IRange;
43 }
44 
45 namespace com { namespace sun { namespace star { namespace geometry
46 {
47  struct RealSize2D;
48  struct IntegerPoint2D;
49  struct IntegerSize2D;
50  struct IntegerRectangle2D;
51 } } } }
52 
53 namespace com { namespace sun { namespace star { namespace rendering
54 {
55  class XBitmap;
56  class XIntegerReadOnlyBitmap;
57 } } } }
58 
59 namespace com { namespace sun { namespace star { namespace rendering { class XColorSpace; } } } }
60 
61 namespace vcl
62 {
63  namespace unotools
64  {
65  // Bitmap conversions
66 
67 
70  css::uno::Reference< css::rendering::XBitmap >
71  VCL_DLLPUBLIC xBitmapFromBitmapEx( const ::BitmapEx& inputBitmap );
72 
75  ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const css::uno::Reference< css::rendering::XIntegerReadOnlyBitmap >& xInputBitmap );
76 
77  // Color conversions (vcl/tools Color <-> canvas standard color space)
78 
79 
85  css::uno::Sequence< double >
87 
96  css::uno::Sequence< double >
98  const css::uno::Reference< css::rendering::XColorSpace >& xColorSpace );
99 
106  const css::uno::Sequence< double >& rColor );
107 
116  Color VCL_DLLPUBLIC doubleSequenceToColor( const css::uno::Sequence< double >& rColor,
117  const css::uno::Reference< css::rendering::XColorSpace >& xColorSpace );
118 
120  inline sal_Int8 toByteColor( double val )
121  {
122  return sal::static_int_cast<sal_Int8>(
123  basegfx::fround(val*255.0));
124  }
125 
127  inline double toDoubleColor( sal_uInt8 val )
128  {
129  return val / 255.0;
130  }
131 
133  css::uno::Reference< css::rendering::XColorSpace> VCL_DLLPUBLIC createStandardColorSpace();
134 
135  // Geometry conversions (vcl/tools <-> x)
136 
137 
138  // geometry::Real
139  css::geometry::RealSize2D VCL_DLLPUBLIC size2DFromSize( const Size& );
140 
141  Size VCL_DLLPUBLIC sizeFromRealSize2D( const css::geometry::RealSize2D& );
142 
143  // geometry::Integer
144  css::geometry::IntegerSize2D VCL_DLLPUBLIC integerSize2DFromSize( const Size& );
145 
146  Size VCL_DLLPUBLIC sizeFromIntegerSize2D( const css::geometry::IntegerSize2D& );
147  Point VCL_DLLPUBLIC pointFromIntegerPoint2D( const css::geometry::IntegerPoint2D& );
148  tools::Rectangle VCL_DLLPUBLIC rectangleFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& );
149 
150  // basegfx::B2D
154 
158 
159  // basegfx::B2I
164  }
165 }
166 
167 #endif // INCLUDED_VCL_CANVASTOOLS_HXX
168 
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Rectangle rectangleFromB2IRectangle(const basegfx::B2IRange &rRect)
basegfx::B2DVector b2DSizeFromSize(const ::Size &rSize)
::tools::Rectangle rectangleFromB2DRectangle(const basegfx::B2DRange &rRect)
signed char sal_Int8
uno::Sequence< double > colorToDoubleSequence(const Color &rColor, const uno::Reference< rendering::XColorSpace > &xColorSpace)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
uno::Reference< rendering::XBitmap > xBitmapFromBitmapEx(const ::BitmapEx &inputBitmap)
Create an XBitmap from VCL BitmapEx.
Definition: canvastools.cxx:53
Point pointFromIntegerPoint2D(const geometry::IntegerPoint2D &rPoint)
Color stdColorSpaceSequenceToColor(const uno::Sequence< double > &rColor)
::Point pointFromB2DPoint(const basegfx::B2DPoint &rPoint)
::BitmapEx bitmapExFromXBitmap(const uno::Reference< rendering::XIntegerReadOnlyBitmap > &xInputBitmap)
Size sizeFromIntegerSize2D(const geometry::IntegerSize2D &rSize)
geometry::IntegerSize2D integerSize2DFromSize(const Size &rSize)
basegfx::B2IPoint b2IPointFromPoint(Point const &rPoint)
B2IRange fround(const B2DRange &rRange)
sal_Int8 toByteColor(double val)
Convert [0,1] double value to [0,255] int.
geometry::RealSize2D size2DFromSize(const Size &rSize)
Color doubleSequenceToColor(const uno::Sequence< double > &rColor, const uno::Reference< rendering::XColorSpace > &xColorSpace)
basegfx::B2IRectangle b2IRectangleFromRectangle(tools::Rectangle const &rRect)
::Size sizeFromB2DSize(const basegfx::B2DVector &rVec)
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
Size sizeFromRealSize2D(const geometry::RealSize2D &rSize)
uno::Sequence< double > colorToStdColorSpaceSequence(const Color &rColor)
Create a device-specific color sequence from VCL/Tools color.
double toDoubleColor(sal_uInt8 val)
Convert [0,255] int value to [0,1] double value.
uno::Reference< rendering::XColorSpace > createStandardColorSpace()
Create a standard color space suitable for VCL RGB color.
tools::Rectangle rectangleFromIntegerRectangle2D(const geometry::IntegerRectangle2D &rRectangle)
unsigned char sal_uInt8
Point pointFromB2IPoint(const basegfx::B2IPoint &rPoint)
basegfx::B2DPoint b2DPointFromPoint(const ::Point &rPoint)