1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
// All rights reserved.
//
// This file is part of the ImageIO Library, and as been adapted for CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1.1/CGAL_ImageIO/include/CGAL/ImageIO/convert.h $
// $Id: include/CGAL/ImageIO/convert.h 08b27d3db14 $
// SPDX-License-Identifier: LGPL-3.0-or-later
//
//
// Author(s) : ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
/*************************************************************************
* convert.h - conversion between types
*
* $Id: include/CGAL/ImageIO/convert.h 08b27d3db14 $
*
* Copyright©INRIA 1998
*
* AUTHOR:
* Gregoire Malandain (greg@sophia.inria.fr)
* https://www-sop.inria.fr/members/Gregoire.Malandain/
*
* CREATION DATE:
* June, 9 1998
*
* ADDITIONS, CHANGES
*
*/
#ifndef _convert_h_
#define _convert_h_
#include <stdio.h> /* memcpy */
#include <string.h> /* memcpy */
#include <CGAL/ImageIO/typedefs.h>
/* Converts buffers from one type into another.
*
* DESCRIPTION:
*
* Conversions from types DOUBLE or FLOAT to
* others types are all implemented. I hope
* I do not make mistakes.
*
* - When a real value is converted into an integer
* one, we take the nearest integer, i.e.
* (int)(real value - 0.5) for negative
* numbers, and (int)(real value + 0.5) for
* positive ones.
*
* - Some conversions are not yet implemented.
*
* - When types and pointers are equal, nothing is
* done.
*/
extern void ConvertBuffer( void *bufferIn, /* buffer to be converted */
bufferType typeIn, /* type of this buffer */
void *bufferOut, /* result buffer */
bufferType typeOut, /* type of this buffer */
int bufferLength /* buffers' length */
);
extern void Convert_r32_to_s8( r32 *theBuf,
s8 *resBuf,
int size );
extern void Convert_r32_to_u8( r32 *theBuf,
u8 *resBuf,
int size );
extern void Convert_r32_to_s16( r32 *theBuf,
s16 *resBuf,
int size );
extern void Convert_r32_to_u16( r32 *theBuf,
u16 *resBuf,
int size );
#ifdef CGAL_HEADER_ONLY
#include <CGAL/ImageIO/convert_impl.h>
#endif // CGAL_HEADER_ONLY
#endif
|