📄 rectscaler.h
字号:
/*
* ==============================================================================
* Name : RectScaler.h
* Part of : OcrExample
* Interface :
* Description :
* Version :
*
* Copyright (c) 2006 Nokia Corporation.
* This material, including documentation and any related
* computer programs, is protected by copyright controlled by
* Nokia Corporation.
* ==============================================================================
*/
#ifndef RECT_SCALER_H
#define RECT_SCALER_H
#include <e32cmn.h>
#include <e32std.h>
/**
* namespace contains various utility classes
*/
namespace NOCRUtils
{
/**
* TRectScaler is a simple utility class to calculate and adjust rectangles
* based on the original and scaled rectangle size.
*
* @note TRectScaler assumes that the scaled rectangle has the same aspect
* ratio as the original image
*/
class TRectScaler
{
public:
/** constructor */
TRectScaler();
/**
* Calculates the factors for height and width from the
* original and scaled rectangle size
* @param aOriginal size of the original rectangle
* @param aScaled size of the resized rectangle
*/
void CalculateFactor( TSize aOriginal, TSize aScaled );
/**
* calculates a scaled up rectangle based on the current
* relational factors. Both the size and position of the returned
* rectangle are scaled.
* @param aScaledRect a rectangle, which is used as a basis for
* the scaled up rectangle
* @return a scaled up rectangle
*/
TRect ScaleUp( const TRect& aScaledRect ) const;
/**
* calculates a scaled down rectangle based on the current
* relational factors. Both the size and position of the returned
* rectangle are scaled.
* @param aOriginalRect a rectangle, which is used as a basis for
* the scaled down rectangle
* @return a scaled down rectangle
*/
TRect ScaleDown( const TRect& aOriginalRect ) const;
private:
/** scale factor */
TReal iFactor;
};
} // namespace NOCRUtils
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -