1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_CANVASBITMAP_HXX
21 #define INCLUDED_VCL_INC_CANVASBITMAP_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
25 #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
26 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
27 #include <com/sun/star/rendering/XBitmapPalette.hpp>
29 #include <vcl/bitmapex.hxx>
30 #include <vcl/bitmapaccess.hxx>
36 class VCL_DLLPUBLIC VclCanvasBitmap
:
37 public cppu::WeakImplHelper
< css::rendering::XIntegerReadOnlyBitmap
,
38 css::rendering::XBitmapPalette
,
39 css::rendering::XIntegerBitmapColorSpace
>
45 Bitmap::ScopedReadAccess m_pBmpAcc
;
46 Bitmap::ScopedReadAccess m_pAlphaAcc
;
47 css::uno::Sequence
<sal_Int8
> m_aComponentTags
;
48 css::uno::Sequence
<sal_Int32
> m_aComponentBitCounts
;
49 css::rendering::IntegerBitmapLayout m_aLayout
;
50 sal_Int32 m_nBitsPerInputPixel
;
51 sal_Int32 m_nBitsPerOutputPixel
;
52 sal_Int32 m_nRedIndex
;
53 sal_Int32 m_nGreenIndex
;
54 sal_Int32 m_nBlueIndex
;
55 sal_Int32 m_nAlphaIndex
;
56 sal_Int32 m_nIndexIndex
;
57 sal_Int8 m_nEndianness
;
60 SAL_DLLPRIVATE
void setComponentInfo( sal_uInt32 redShift
, sal_uInt32 greenShift
, sal_uInt32 blueShift
);
62 virtual ~VclCanvasBitmap() override
;
66 virtual css::geometry::IntegerSize2D SAL_CALL
getSize() override
;
67 virtual sal_Bool SAL_CALL
hasAlpha( ) override
;
68 virtual css::uno::Reference
< css::rendering::XBitmap
> SAL_CALL
getScaledBitmap( const css::geometry::RealSize2D
& newSize
, sal_Bool beFast
) override
;
70 // XIntegerReadOnlyBitmap
71 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
getData( css::rendering::IntegerBitmapLayout
& bitmapLayout
, const css::geometry::IntegerRectangle2D
& rect
) override
;
72 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
getPixel( css::rendering::IntegerBitmapLayout
& bitmapLayout
, const css::geometry::IntegerPoint2D
& pos
) override
;
73 /// @throws css::uno::RuntimeException
74 css::uno::Reference
< css::rendering::XBitmapPalette
> SAL_CALL
getPalette( );
75 virtual css::rendering::IntegerBitmapLayout SAL_CALL
getMemoryLayout( ) override
;
78 virtual sal_Int32 SAL_CALL
getNumberOfEntries() override
;
79 virtual sal_Bool SAL_CALL
getIndex( css::uno::Sequence
< double >& entry
, ::sal_Int32 nIndex
) override
;
80 virtual sal_Bool SAL_CALL
setIndex( const css::uno::Sequence
< double >& color
, sal_Bool transparency
, ::sal_Int32 nIndex
) override
;
81 virtual css::uno::Reference
< css::rendering::XColorSpace
> SAL_CALL
getColorSpace( ) override
;
83 // XIntegerBitmapColorSpace
84 virtual ::sal_Int8 SAL_CALL
getType( ) override
;
85 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getComponentTags( ) override
;
86 virtual ::sal_Int8 SAL_CALL
getRenderingIntent( ) override
;
87 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getProperties( ) override
;
88 virtual css::uno::Sequence
< double > SAL_CALL
convertColorSpace( const css::uno::Sequence
< double >& deviceColor
, const css::uno::Reference
< css::rendering::XColorSpace
>& targetColorSpace
) override
;
89 virtual css::uno::Sequence
< css::rendering::RGBColor
> SAL_CALL
convertToRGB( const css::uno::Sequence
< double >& deviceColor
) override
;
90 virtual css::uno::Sequence
< css::rendering::ARGBColor
> SAL_CALL
convertToARGB( const css::uno::Sequence
< double >& deviceColor
) override
;
91 virtual css::uno::Sequence
< css::rendering::ARGBColor
> SAL_CALL
convertToPARGB( const css::uno::Sequence
< double >& deviceColor
) override
;
92 virtual css::uno::Sequence
< double > SAL_CALL
convertFromRGB( const css::uno::Sequence
< css::rendering::RGBColor
>& rgbColor
) override
;
93 virtual css::uno::Sequence
< double > SAL_CALL
convertFromARGB( const css::uno::Sequence
< css::rendering::ARGBColor
>& rgbColor
) override
;
94 virtual css::uno::Sequence
< double > SAL_CALL
convertFromPARGB( const css::uno::Sequence
< css::rendering::ARGBColor
>& rgbColor
) override
;
95 virtual ::sal_Int32 SAL_CALL
getBitsPerPixel( ) override
;
96 virtual css::uno::Sequence
< ::sal_Int32
> SAL_CALL
getComponentBitCounts( ) override
;
97 virtual ::sal_Int8 SAL_CALL
getEndianness( ) override
;
98 virtual css::uno::Sequence
<double> SAL_CALL
convertFromIntegerColorSpace( const css::uno::Sequence
< ::sal_Int8
>& deviceColor
, const css::uno::Reference
< css::rendering::XColorSpace
>& targetColorSpace
) override
;
99 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
convertToIntegerColorSpace( const css::uno::Sequence
< ::sal_Int8
>& deviceColor
, const css::uno::Reference
< css::rendering::XIntegerBitmapColorSpace
>& targetColorSpace
) override
;
100 virtual css::uno::Sequence
< css::rendering::RGBColor
> SAL_CALL
convertIntegerToRGB( const css::uno::Sequence
< ::sal_Int8
>& deviceColor
) override
;
101 virtual css::uno::Sequence
< css::rendering::ARGBColor
> SAL_CALL
convertIntegerToARGB( const css::uno::Sequence
< ::sal_Int8
>& deviceColor
) override
;
102 virtual css::uno::Sequence
< css::rendering::ARGBColor
> SAL_CALL
convertIntegerToPARGB( const css::uno::Sequence
< ::sal_Int8
>& deviceColor
) override
;
103 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
convertIntegerFromRGB( const css::uno::Sequence
< css::rendering::RGBColor
>& rgbColor
) override
;
104 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
convertIntegerFromARGB( const css::uno::Sequence
< css::rendering::ARGBColor
>& rgbColor
) override
;
105 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
convertIntegerFromPARGB( const css::uno::Sequence
< css::rendering::ARGBColor
>& rgbColor
) override
;
107 /** Create API wrapper for given BitmapEx
110 Bitmap to wrap. As usual, changes to the original bitmap
111 are not reflected in this object (copy on write).
113 explicit VclCanvasBitmap( const BitmapEx
& rBitmap
);
115 /// Retrieve contained bitmap. Call me with locked Solar mutex!
116 const BitmapEx
& getBitmapEx() const { return m_aBmpEx
; }
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */