bump product version to 4.2.0.1
[LibreOffice.git] / include / basebmp / rgb24pixelformats.hxx
blobc4f460cc5e10c1be2cc145206cef97b52f5f5bc3
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 INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
21 #define INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
23 #include <basebmp/color.hxx>
24 #include <basebmp/accessor.hxx>
25 #include <basebmp/pixeliterator.hxx>
26 #include <basebmp/pixelformatadapters.hxx>
28 #include <vigra/rgbvalue.hxx>
30 #include <functional>
32 namespace basebmp
35 template< typename PixelType, typename ColorType > struct RGBValueGetter :
36 public std::unary_function<PixelType, ColorType>
38 ColorType operator()( PixelType const& c ) const
40 return ColorType(c.red(),c.green(),c.blue());
44 template< typename PixelType, typename ColorType > struct RGBValueSetter :
45 public std::unary_function<ColorType, PixelType>
47 PixelType operator()( ColorType const& c ) const
49 PixelType res;
50 res.setRed(c.getRed());
51 res.setGreen(c.getGreen());
52 res.setBlue(c.getBlue());
53 return res;
57 //-----------------------------------------------------------------------------
59 template< typename PixelType > struct PixelFormatTraitsTemplate_RGBValue
61 typedef PixelType pixel_type;
63 typedef RGBValueGetter<pixel_type,
64 Color> getter_type;
65 typedef RGBValueSetter<pixel_type,
66 Color> setter_type;
68 typedef PixelIterator<pixel_type> iterator_type;
69 typedef StandardAccessor<pixel_type> raw_accessor_type;
70 typedef AccessorSelector<
71 getter_type, setter_type> accessor_selector;
74 //-----------------------------------------------------------------------------
76 // 24bpp RGB
77 typedef PixelFormatTraitsTemplate_RGBValue<
78 vigra::RGBValue<sal_uInt8> > PixelFormatTraits_RGB24;
79 BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB24::getter_type,
80 PixelFormatTraits_RGB24::setter_type);
82 // 24bpp BGR
83 typedef PixelFormatTraitsTemplate_RGBValue<
84 vigra::RGBValue<sal_uInt8,2,1,0> > PixelFormatTraits_BGR24;
85 BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGR24::getter_type,
86 PixelFormatTraits_BGR24::setter_type);
88 } // namespace basebmp
90 #endif /* INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX */
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */