mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-20 11:54:07 +03:00
89 lines
3.3 KiB
Plaintext
Executable File
89 lines
3.3 KiB
Plaintext
Executable File
// Copyright (c) 1995-1999 Matra Datavision
|
|
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
|
//
|
|
// The content of this file is subject to the Open CASCADE Technology Public
|
|
// License Version 6.5 (the "License"). You may not use the content of this file
|
|
// except in compliance with the License. Please obtain a copy of the License
|
|
// at http://www.opencascade.org and read it completely before using this file.
|
|
//
|
|
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
|
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
|
//
|
|
// The Original Code and all software distributed under the License is
|
|
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
|
// Initial Developer hereby disclaims all such warranties, including without
|
|
// limitation, any warranties of merchantability, fitness for a particular
|
|
// purpose or non-infringement. Please see the License for the specific terms
|
|
// and conditions governing the rights and limitations under the License.
|
|
|
|
#include <Standard_DimensionMismatch.hxx>
|
|
#include <Standard_OutOfRange.hxx>
|
|
#include Item_hxx
|
|
|
|
#include <stdio.h>
|
|
|
|
# ifdef WNT
|
|
# include <InterfaceGraphic_wntio.hxx>
|
|
# endif // WNT
|
|
|
|
//static char *ErrorMessag, LocalMessag[255];
|
|
static char LocalMessag[255];
|
|
|
|
inline Standard_Integer Image_GPixelField::Width() const { return myWidth; }
|
|
inline Standard_Integer Image_GPixelField::Height() const { return myHeight; }
|
|
inline Standard_Integer Image_GPixelField::UpperX() const { return myWidth-1; }
|
|
inline Standard_Integer Image_GPixelField::UpperY() const { return myHeight-1; }
|
|
|
|
//=======================================================================
|
|
//function : SetValue
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
inline void Image_GPixelField::SetValue ( const Standard_Integer X,
|
|
const Standard_Integer Y,
|
|
const Item& Value )
|
|
{
|
|
if (X < 0 || X > (myWidth -1) || Y < 0 || Y > (myHeight -1)) {
|
|
sprintf(LocalMessag,
|
|
"Index out of range in PixelField::SetValue(%d,%d)",X,Y);
|
|
Standard_OutOfRange::Raise (LocalMessag);
|
|
}
|
|
|
|
((Item *)myData)[(Y)*(myWidth)+X] = Value ;
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : Value
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
inline const Item& Image_GPixelField::Value(const Standard_Integer X,
|
|
const Standard_Integer Y) const
|
|
{
|
|
if (X < 0 || X > (myWidth -1) || Y < 0 || Y > (myHeight -1)) {
|
|
sprintf(LocalMessag,
|
|
"Index out of range in PixelField::Value(%d,%d)",X,Y);
|
|
Standard_OutOfRange::Raise (LocalMessag);
|
|
}
|
|
|
|
return ((Item *)myData)[(Y)*(myWidth)+X] ;
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : ChangeValue
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
inline Item& Image_GPixelField::ChangeValue(const Standard_Integer X,
|
|
const Standard_Integer Y)
|
|
{
|
|
if ((X < 0 || X > (myWidth -1) || Y < 0 || Y > (myHeight -1))) {
|
|
sprintf(LocalMessag,
|
|
"Index out of range in PixelField::ChangeValue(%d,%d)",X,Y);
|
|
Standard_OutOfRange::Raise (LocalMessag);
|
|
}
|
|
|
|
return ((Item *)myData)[(Y)*(myWidth)+X] ;
|
|
}
|
|
|