| 1 | /* |
| 2 | * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Oracle designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Oracle in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | * or visit www.oracle.com if you need additional information or have any |
| 23 | * questions. |
| 24 | */ |
| 25 | |
| 26 | #ifndef IntDcm_h_Included |
| 27 | #define IntDcm_h_Included |
| 28 | |
| 29 | typedef jint IntDcmPixelType; |
| 30 | typedef jint IntDcmElemType; |
| 31 | |
| 32 | #define SwapIntDcmComponentsX123ToX321(pixel) \ |
| 33 | (((pixel) << 16) | \ |
| 34 | ((pixel) & 0xff00) | \ |
| 35 | (((pixel) >> 16) & 0xff)) |
| 36 | |
| 37 | #define SwapIntDcmComponentsX123ToC321(pixel) \ |
| 38 | (((pixel & 0xff) << 16) | \ |
| 39 | ((pixel) & 0xff00) | \ |
| 40 | (((pixel) >> 16) & 0xff)) |
| 41 | |
| 42 | #define SwapIntDcmComponentsX123ToS321(pixel) \ |
| 43 | (0xff000000 | \ |
| 44 | ((pixel) << 16) | \ |
| 45 | ((pixel) & 0xff00) | \ |
| 46 | (((pixel) >> 16) & 0xff)) |
| 47 | |
| 48 | #define SwapIntDcmComponents4123To4321(pixel) \ |
| 49 | ((((pixel) & 0xff) << 16) | \ |
| 50 | ((pixel) & 0xff00ff00) | \ |
| 51 | (((pixel) >> 16) & 0xff)) |
| 52 | |
| 53 | #define (pixel, c1, c2, c3) \ |
| 54 | do { \ |
| 55 | (c3) = (pixel) & 0xff; \ |
| 56 | (c2) = ((pixel) >> 8) & 0xff; \ |
| 57 | (c1) = ((pixel) >> 16) & 0xff; \ |
| 58 | } while (0) |
| 59 | |
| 60 | #define (pixel, c1, c2, c3) \ |
| 61 | do { \ |
| 62 | (c3) = ((pixel) >> 8) & 0xff; \ |
| 63 | (c2) = ((pixel) >> 16) & 0xff; \ |
| 64 | (c1) = ((pixel) >> 24) & 0xff; \ |
| 65 | } while (0) |
| 66 | |
| 67 | #define (pixel, c1, c2, c3, c4) \ |
| 68 | do { \ |
| 69 | (c4) = (pixel) & 0xff; \ |
| 70 | (c3) = ((pixel) >> 8) & 0xff; \ |
| 71 | (c2) = ((pixel) >> 16) & 0xff; \ |
| 72 | (c1) = ((pixel) >> 24) & 0xff; \ |
| 73 | } while (0) |
| 74 | |
| 75 | #define ComposeIntDcmComponentsX123(c1, c2, c3) \ |
| 76 | (((((c1) << 8) | (c2)) << 8) | (c3)) |
| 77 | |
| 78 | #define ComposeIntDcmComponents123X(c1, c2, c3) \ |
| 79 | ((((((c1) << 8) | (c2)) << 8) | (c3)) << 8) |
| 80 | |
| 81 | #define ComposeIntDcmComponents1234(c1, c2, c3, c4) \ |
| 82 | (((((((c1) << 8) | (c2)) << 8) | (c3)) << 8) | (c4)) |
| 83 | |
| 84 | #endif /* IntDcm_h_Included */ |
| 85 | |