1/* 2 * Copyright (c) 1997, 2003, 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 27#ifndef __MLIB_IMAGE_GET_H 28#define __MLIB_IMAGE_GET_H 29 30#ifdef __cplusplus 31extern "C" { 32#endif /* __cplusplus */ 33 34 35static mlib_type mlib_ImageGetType(const mlib_image *img) 36{ 37 return img->type; 38} 39 40static mlib_s32 mlib_ImageGetChannels(const mlib_image *img) 41{ 42 return img->channels; 43} 44 45static mlib_s32 mlib_ImageGetWidth(const mlib_image *img) 46{ 47 return img->width; 48} 49 50static mlib_s32 mlib_ImageGetHeight(const mlib_image *img) 51{ 52 return img->height; 53} 54 55static mlib_s32 mlib_ImageGetStride(const mlib_image *img) 56{ 57 return img->stride; 58} 59 60static void *mlib_ImageGetData(const mlib_image *img) 61{ 62 return img->data; 63} 64 65static mlib_s32 mlib_ImageGetFlags(const mlib_image *img) 66{ 67 return img->flags; 68} 69 70static mlib_u8 *mlib_ImageGetPaddings(const mlib_image *img) 71{ 72 return (mlib_u8 *)img->paddings; 73} 74 75static mlib_s32 mlib_ImageGetBitOffset(const mlib_image *img) 76{ 77 return img->bitoffset; 78} 79 80static mlib_format mlib_ImageGetFormat(const mlib_image *img) 81{ 82 return img->format; 83} 84 85/* returns 0 if all conditions are satisfied, non-zero otherwise */ 86static int mlib_ImageTestFlags(const mlib_image *img, mlib_s32 flags) 87{ 88 return (img->flags & flags); 89} 90 91/* returns 0 if 64 byte aligned and non-zero if not aligned */ 92static int mlib_ImageIsNotAligned64(const mlib_image *img) 93{ 94 return (img->flags & MLIB_IMAGE_ALIGNED64); 95} 96 97/* returns 0 if 8 byte aligned and non-zero if not aligned */ 98static int mlib_ImageIsNotAligned8(const mlib_image *img) 99{ 100 return (img->flags & MLIB_IMAGE_ALIGNED8); 101} 102 103/* returns 0 if 4 byte aligned and non-zero if not aligned */ 104static int mlib_ImageIsNotAligned4(const mlib_image *img) 105{ 106 return (img->flags & MLIB_IMAGE_ALIGNED4); 107} 108 109/* returns 0 if 2 byte aligned and non-zero if not aligned */ 110static int mlib_ImageIsNotAligned2(const mlib_image *img) 111{ 112 return (img->flags & MLIB_IMAGE_ALIGNED2); 113} 114 115/* returns 0 if width is a multiple of 8, non-zero otherwise */ 116static int mlib_ImageIsNotWidth8X(const mlib_image *img) 117{ 118 return (img->flags & MLIB_IMAGE_WIDTH8X); 119} 120 121/* returns 0 if width is a multiple of 4, non-zero otherwise */ 122static int mlib_ImageIsNotWidth4X(const mlib_image *img) 123{ 124 return (img->flags & MLIB_IMAGE_WIDTH4X); 125} 126 127/* returns 0 if width is a multiple of 2, non-zero otherwise */ 128static int mlib_ImageIsNotWidth2X(const mlib_image *img) 129{ 130 return (img->flags & MLIB_IMAGE_WIDTH2X); 131} 132 133/* returns 0 if height is a multiple of 8, non-zero otherwise */ 134static int mlib_ImageIsNotHeight8X(const mlib_image *img) 135{ 136 return (img->flags & MLIB_IMAGE_HEIGHT8X); 137} 138 139/* returns 0 if height is a multiple of 4, non-zero otherwise */ 140static int mlib_ImageIsNotHeight4X(const mlib_image *img) 141{ 142 return (img->flags & MLIB_IMAGE_HEIGHT4X); 143} 144 145/* returns 0 if height is a multiple of 2, non-zero otherwise */ 146static int mlib_ImageIsNotHeight2X(const mlib_image *img) 147{ 148 return (img->flags & MLIB_IMAGE_HEIGHT2X); 149} 150 151/* returns 0 if stride is a multiple of 8, non-zero otherwise */ 152static int mlib_ImageIsNotStride8X(const mlib_image *img) 153{ 154 return (img->flags & MLIB_IMAGE_STRIDE8X); 155} 156 157/* returns 0 if it can be treated as a 1-D vector, non-zero otherwise */ 158static int mlib_ImageIsNotOneDvector(const mlib_image *img) 159{ 160 return (img->flags & MLIB_IMAGE_ONEDVECTOR); 161} 162 163/* returns non-zero if data buffer is user allocated, 0 otherwise */ 164static int mlib_ImageIsUserAllocated(const mlib_image *img) 165{ 166 return (img->flags & MLIB_IMAGE_USERALLOCATED); 167} 168 169#ifdef __cplusplus 170} 171#endif /* __cplusplus */ 172#endif /* __MLIB_IMAGE_GET_H */ 173