LCOV - code coverage report
Current view: top level - libreoffice/basebmp/inc/basebmp - rgb24pixelformats.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 8 100.0 %
Date: 2012-12-27 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_BASEBMP_RGB24PIXELFORMATS_HXX
      21             : #define INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
      22             : 
      23             : #include <basebmp/color.hxx>
      24             : #include <basebmp/accessor.hxx>
      25             : #include <basebmp/pixeliterator.hxx>
      26             : #include <basebmp/pixelformatadapters.hxx>
      27             : 
      28             : #include <vigra/rgbvalue.hxx>
      29             : 
      30             : #include <functional>
      31             : 
      32             : namespace basebmp
      33             : {
      34             : 
      35             : template< typename PixelType, typename ColorType > struct RGBValueGetter :
      36             :         public std::unary_function<PixelType, ColorType>
      37             : {
      38     1178410 :     ColorType operator()( PixelType const& c ) const
      39             :     {
      40     1178410 :         return ColorType(c.red(),c.green(),c.blue());
      41             :     }
      42             : };
      43             : 
      44             : template< typename PixelType, typename ColorType > struct RGBValueSetter :
      45             :     public std::unary_function<ColorType, PixelType>
      46             : {
      47     1256409 :     PixelType operator()( ColorType const& c ) const
      48             :     {
      49     1256409 :         PixelType res;
      50     1256409 :         res.setRed(c.getRed());
      51     1256409 :         res.setGreen(c.getGreen());
      52     1256409 :         res.setBlue(c.getBlue());
      53     1256409 :         return res;
      54             :     }
      55             : };
      56             : 
      57             : //-----------------------------------------------------------------------------
      58             : 
      59             : template< typename PixelType > struct PixelFormatTraitsTemplate_RGBValue
      60             : {
      61             :     typedef PixelType                     pixel_type;
      62             : 
      63             :     typedef RGBValueGetter<pixel_type,
      64             :                            Color>         getter_type;
      65             :     typedef RGBValueSetter<pixel_type,
      66             :                            Color>         setter_type;
      67             : 
      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;
      72             : };
      73             : 
      74             : //-----------------------------------------------------------------------------
      75             : 
      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);
      81             : 
      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);
      87             : 
      88             : } // namespace basebmp
      89             : 
      90             : #endif /* INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX */
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10