0023486: Remove obsolete image manipulation classes
[occt.git] / src / Image / Image_PixelInterpolation.cxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 //
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
8 //
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 //
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
18
19 #include <Image_PixelInterpolation.ixx>
20
21 Image_PixelInterpolation::Image_PixelInterpolation() {}
22
23 Standard_Boolean Image_PixelInterpolation::DoInterpolate( 
24         const Handle(Image_Image)& aImage,
25         const Standard_Real X, const Standard_Real Y,
26         const Standard_Integer LowX,
27         const Standard_Integer LowY,
28         const Standard_Integer UpX,
29         const Standard_Integer UpY,
30         Aspect_Pixel& aPixel ) const
31
32 { Standard_Integer NX ; 
33   Standard_Integer NY ; 
34
35   if ( X < 0. ) NX = Standard_Integer(X-0.5) ;
36   else          NX = Standard_Integer(X+0.5) ;
37
38   if ( Y < 0. ) NY = Standard_Integer(Y-0.5) ;
39   else          NY = Standard_Integer(Y+0.5) ;
40
41   if ( NX < LowX || NX > UpX ||
42        NY < LowY || NY > UpY ) {
43         return Standard_False ;
44   }
45   else {
46         aImage->Pixel( NX, NY, aPixel );
47         return Standard_True ;
48   }
49 }
50
51 Standard_Boolean Image_PixelInterpolation::Interpolate( 
52         const Handle(Image_Image)& aImage,
53         const Standard_Real FX, const Standard_Real FY,
54         const Standard_Integer LowX,
55         const Standard_Integer LowY,
56         const Standard_Integer UpX,
57         const Standard_Integer UpY,
58         Aspect_Pixel& aPixel ) const
59
60 { return DoInterpolate( aImage, FX, FY, LowX, LowY, UpX, UpY, aPixel ) ; }
61
62 Standard_Boolean Image_PixelInterpolation::Interpolate( 
63         const Handle(Image_DColorImage)& aImage,
64         const Standard_Real FX, const Standard_Real FY,
65         const Standard_Integer LowX,
66         const Standard_Integer LowY,
67         const Standard_Integer UpX,
68         const Standard_Integer UpY,
69         Aspect_ColorPixel& aPixel ) const
70
71 { return DoInterpolate( aImage, FX, FY, LowX, LowY, UpX, UpY, aPixel ) ; }
72
73 Standard_Boolean Image_PixelInterpolation::Interpolate( 
74         const Handle(Image_DIndexedImage)& aImage,
75         const Standard_Real FX, const Standard_Real FY,
76         const Standard_Integer LowX,
77         const Standard_Integer LowY,
78         const Standard_Integer UpX,
79         const Standard_Integer UpY,
80         Aspect_IndexPixel& aPixel ) const
81
82 { return DoInterpolate( aImage, FX, FY, LowX, LowY, UpX, UpY, aPixel ) ; }
83