1 /*
2 (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
3 (c) Copyright 2000-2004 Convergence (integrated media) GmbH
4
5 All rights reserved.
6
7 Written by Denis Oliver Kropp <dok@directfb.org>,
8 Andreas Hundt <andi@fischlustig.de>,
9 Sven Neumann <neo@directfb.org>,
10 Ville Syrjälä <syrjala@sci.fi> and
11 Claudio Ciccani <klan@users.sf.net>.
12
13 This file is subject to the terms and conditions of the MIT License:
14
15 Permission is hereby granted, free of charge, to any person
16 obtaining a copy of this software and associated documentation
17 files (the "Software"), to deal in the Software without restriction,
18 including without limitation the rights to use, copy, modify, merge,
19 publish, distribute, sublicense, and/or sell copies of the Software,
20 and to permit persons to whom the Software is furnished to do so,
21 subject to the following conditions:
22
23 The above copyright notice and this permission notice shall be
24 included in all copies or substantial portions of the Software.
25
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 */
34
35 #include <config.h>
36
37 #include <unistd.h>
38 #include <stdio.h>
39
40 #include "dfb_types.h"
41
main(void)42 int main( void )
43 {
44 u8 byt;
45 u32 pixel32;
46
47 do {
48 fread (&pixel32, 4, 1, stdin);
49
50 #ifdef WORDS_BIGENDIAN
51 pixel32 = (pixel32 << 16) | (pixel32 >> 16);
52 #endif
53
54 byt = (pixel32 & 0xff0000) >> 16;
55 fwrite (&byt, 1, 1, stdout);
56 byt = (pixel32 & 0x00ff00) >> 8;
57 fwrite (&byt, 1, 1, stdout);
58 byt = (pixel32 & 0x0000ff);
59 fwrite (&byt, 1, 1, stdout);
60 } while (!feof (stdin));
61
62 return 0;
63 }
64