dust3d/thirdparty/cgal/CGAL-5.1/include/CGAL/ImageIO/convert.h

100 lines
2.5 KiB
C
Raw Normal View History

// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
// All rights reserved.
//
2020-10-13 12:44:25 +00:00
// This file is part of the ImageIO Library, and as been adapted for CGAL (www.cgal.org).
//
2020-10-13 12:44:25 +00:00
// $URL: https://github.com/CGAL/cgal/blob/v5.1/CGAL_ImageIO/include/CGAL/ImageIO/convert.h $
// $Id: convert.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
// SPDX-License-Identifier: LGPL-3.0-or-later
//
//
// Author(s) : ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
/*************************************************************************
* convert.h - conversion between types
*
2020-10-13 12:44:25 +00:00
* $Id: convert.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
*
* Copyright©INRIA 1998
*
* AUTHOR:
* Gregoire Malandain (greg@sophia.inria.fr)
* http://www.inria.fr/epidaure/personnel/malandain/
2020-10-13 12:44:25 +00:00
*
* 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:
*
2020-10-13 12:44:25 +00:00
* 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
2020-10-13 12:44:25 +00:00
* 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 */
2020-10-13 12:44:25 +00:00
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,
2020-10-13 12:44:25 +00:00
s8 *resBuf,
int size );
extern void Convert_r32_to_u8( r32 *theBuf,
2020-10-13 12:44:25 +00:00
u8 *resBuf,
int size );
extern void Convert_r32_to_s16( r32 *theBuf,
2020-10-13 12:44:25 +00:00
s16 *resBuf,
int size );
extern void Convert_r32_to_u16( r32 *theBuf,
2020-10-13 12:44:25 +00:00
u16 *resBuf,
int size );
#ifdef CGAL_HEADER_ONLY
#include <CGAL/ImageIO/convert_impl.h>
#endif // CGAL_HEADER_ONLY
#endif