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