📄 shortindex.h
字号:
//
// ShortIndex.h
// Interface for indexing 16-bit images using [row][col].
//
// Copyright (C) 2003, 2006 by Jon A. Webb (Contact via GMail; username is jonawebb)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef ShortIndex_h
#define ShortIndex_h
#include <e32cons.h>
namespace Core
{
class IShortIndex
{
// Lifecycle
public:
IShortIndex(const CImage& image) :
inRowShorts(0),
ipData(NULL)
{
_LIT(LRShortErr, "IShortIndex: Not a short image");
__ASSERT_ALWAYS(image.iBitmap.DisplayMode() == EColor64K, User::Panic(LRShortErr, KErrGeneral));
ipData = (unsigned char*) image.iBitmap.DataAddress();
inRowShorts = CFbsBitmap::ScanLineLength(image.iBitmap.SizeInPixels().iWidth, EColor64K) / 2;
}
IShortIndex() :
inRowShorts(0),
ipData(NULL)
{}
inline ~IShortIndex(void)
{
};
IShortIndex(const IShortIndex& other)
{
ipData = other.ipData;
inRowShorts = other.inRowShorts;
}
// Operators
public:
IShortIndex& operator=(const IShortIndex& other)
{
if (this != &other) {
ipData = other.ipData;
inRowShorts = other.inRowShorts;
}
return *this;
}
inline const unsigned short* operator[](unsigned int nRow) const {
return ipData + nRow*inRowShorts;
}
inline unsigned short* operator[](unsigned int nRow) {
return ipData + nRow*inRowShorts;
}
private:
// Attributes
unsigned char* ipData;
unsigned int inRowShorts;
};
};
#endif // ShortIndex_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -