Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Image / Image_Image.cxx
CommitLineData
7fd59977 1#include <Image_Image.ixx>
2
3#ifdef TRACE
4static int ImageCount = 0 ;
5#endif
6
7Image_Image::Image_Image ( const Handle(Standard_Type)& aPixelType )
8{
9#ifdef TRACE
10 cout << "\tCreate a new Image ( Count : " << ++ImageCount << " )" << endl
11 << flush ;
12#endif
13
14 myPixelType = aPixelType ;
15}
16
17Standard_Integer Image_Image::Size() const {
18
19 return ( Width() * Height() ) ;
20
21}
22
23void Image_Image::InternalDup( const Handle(Image_Image)& aImage )
24{ // myPixelType is set in Image_Image Constructor
25}
26
27Handle(Standard_Type) Image_Image::PixelType() const { return myPixelType ; }
28
29void Image_Image::Destroy ()
30{
31#ifdef TRACE
32 cout << "\tDelete an Image ( Count : " << --ImageCount << " )" << endl
33 << flush ;
34#endif
35}
36
37void Image_Image::RowColor( const Standard_Integer Y,
38 Quantity_Array1OfColor& PR) const {
39
40 Standard_Integer TheLength = Min (PR.Length(), Width() );
41 Standard_Integer L = PR.Lower() ;
42 Standard_Integer X = LowerX() ;
43
44 for (Standard_Integer i=0; i< TheLength; i++) {
45 PR(L+i) = PixelColor(X+i,Y);
46 }
47
48}
49
50Handle(Quantity_HArray1OfColor) Image_Image::RowColor(
51 const Standard_Integer Y ) const {
52
53 Standard_Integer TheLength = Width() ;
54 Standard_Integer X = LowerX() ;
55 Handle(Quantity_HArray1OfColor) PR =
56 new Quantity_HArray1OfColor( 0, TheLength-1) ;
57
58 for (Standard_Integer i=0; i< TheLength; i++) {
59 PR->SetValue(i,PixelColor(X+i,Y));
60 }
61
62 return PR ;
63}
64