update credits
[LibreOffice.git] / include / vcl / image.hxx
blob0d28bc030abd99dd165c6793bd114feb18d3c00f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _SV_IMAGE_HXX
21 #define _SV_IMAGE_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/gen.hxx>
25 #include <tools/resid.hxx>
26 #include <tools/solar.h>
27 #include <vcl/bitmapex.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
30 #include <vector>
32 struct ImplImage;
33 struct ImplImageList;
34 namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } }
36 #define IMAGE_STDBTN_COLOR Color( 0xC0, 0xC0, 0xC0 )
37 #define IMAGELIST_IMAGE_NOTFOUND ((sal_uInt16)0xFFFF)
39 enum ImageColorTransform
41 IMAGECOLORTRANSFORM_NONE = 0,
42 IMAGECOLORTRANSFORM_HIGHCONTRAST = 1,
43 IMAGECOLORTRANSFORM_MONOCHROME_BLACK = 2,
44 IMAGECOLORTRANSFORM_MONOCHROME_WHITE = 3
47 class VCL_DLLPUBLIC Image
49 friend class ImageList;
50 friend class OutputDevice;
52 public:
53 Image();
54 Image( const ResId& rResId );
55 Image( const Image& rImage );
56 Image( const BitmapEx& rBitmapEx );
57 Image( const Bitmap& rBitmap );
58 Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap );
59 Image( const Bitmap& rBitmap, const Color& rColor );
60 Image( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic );
61 ~Image();
63 Size GetSizePixel() const;
65 BitmapEx GetBitmapEx() const;
66 ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const;
68 Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const;
70 sal_Bool operator!() const { return( !mpImplData ? true : false ); }
71 Image& operator=( const Image& rImage );
72 sal_Bool operator==( const Image& rImage ) const;
73 sal_Bool operator!=( const Image& rImage ) const { return !(Image::operator==( rImage )); }
75 private:
77 ImplImage* mpImplData;
79 SAL_DLLPRIVATE void ImplInit( const BitmapEx& rBmpEx );
82 class VCL_DLLPUBLIC ImageList
84 public:
85 ImageList( sal_uInt16 nInit = 8, sal_uInt16 nGrow = 4 );
86 ImageList( const ResId& rResId );
87 ImageList( const ::std::vector< OUString >& rNameVector,
88 const OUString& rPrefix,
89 const Color* pMaskColor = NULL );
90 ImageList( const ImageList& rImageList );
91 ~ImageList();
93 void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
94 const std::vector< OUString > &rNameVector );
95 void InsertFromHorizontalBitmap( const ResId& rResId,
96 sal_uInt16 nCount,
97 const Color *pNonAlphaMaskColor,
98 const Color *pSearchColors = NULL,
99 const Color *pReplaceColors = NULL,
100 sal_uLong nColorCount = 0);
101 BitmapEx GetAsHorizontalStrip() const;
102 sal_uInt16 GetImageCount() const;
103 Size GetImageSize() const;
105 void AddImage( const OUString& rImageName, const Image& rImage );
106 void AddImage( sal_uInt16 nNewId, const Image& rImage );
108 void ReplaceImage( const OUString& rImageName, const Image& rImage );
110 void RemoveImage( sal_uInt16 nId );
112 Image GetImage( sal_uInt16 nId ) const;
113 Image GetImage( const OUString& rImageName ) const;
115 sal_uInt16 GetImagePos( sal_uInt16 nId ) const;
116 bool HasImageAtPos( sal_uInt16 nId ) const;
117 sal_uInt16 GetImagePos( const OUString& rImageName ) const;
119 sal_uInt16 GetImageId( sal_uInt16 nPos ) const;
121 OUString GetImageName( sal_uInt16 nPos ) const;
122 void GetImageNames( ::std::vector< OUString >& rNames ) const;
124 ImageList& operator=( const ImageList& rImageList );
125 sal_Bool operator==( const ImageList& rImageList ) const;
126 sal_Bool operator!=( const ImageList& rImageList ) const { return !(ImageList::operator==( rImageList )); }
128 private:
130 ImplImageList* mpImplData;
131 sal_uInt16 mnInitSize;
132 sal_uInt16 mnGrowSize;
134 SAL_DLLPRIVATE void ImplInitBitmapEx( const OUString& rUserImageName,
135 const ::std::vector< OUString >& rImageNames,
136 const OUString& rSymbolsStyle,
137 BitmapEx& rBmpEx,
138 const Color* pMaskColor ) const;
139 SAL_DLLPRIVATE void ImplInit( sal_uInt16 nItems, const Size &rSize );
140 SAL_DLLPRIVATE sal_uInt16 ImplGetImageId( const OUString& rImageName ) const;
143 #endif // _SV_IMAGE_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */