libopenraw
grayscale.cpp
1/*
2 * libopenraw - render/grayscale.h
3 *
4 * Copyright (C) 2012-2016 Hubert Figuiere
5 *
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21#include <libopenraw/consts.h>
22
23#include "render/grayscale.hpp"
24
25or_error
26grayscale_to_rgb (uint16_t *src, uint32_t src_x, uint32_t src_y,
27 uint16_t *dst)
28{
29 uint32_t x,y;
30 uint32_t offset, doffset;
31
32 offset = 0;
33 doffset = 0;
34 for(y = 0 ; y < src_y; y++)
35 {
36 for (x = 0 ; x < src_x; x++)
37 {
38 // change this. we currently clip.
39 dst [doffset*3+0] = src[offset];
40 dst [doffset*3+1] = src[offset];
41 dst [doffset*3+2] = src[offset];
42
43 offset++;
44 doffset++;
45 }
46 }
47
48 return OR_ERROR_NONE;
49}
50
51/*
52 Local Variables:
53 mode:c++
54 c-file-style:"stroustrup"
55 c-file-offsets:((innamespace . 0))
56 tab-width:2
57 c-basic-offset:2
58 indent-tabs-mode:nil
59 fill-column:80
60 End:
61*/