⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 replicate.cpp

📁 barcode readers [ from Image]
💻 CPP
字号:
// Image.cpp
//
// Code for making copies of images.
//
// 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
//

#include "ImageSize.h"
#include "Replicate.h"

namespace Core 
{
	IReplicate::IReplicate(const CImage& image) 
	{
		iImage = image;
	}

	IReplicate::~IReplicate()
	{
	}

	 void IReplicate::CastL(CImage& toImage) 
		{
			IImageSize rSize(iImage);
			IImageSize rSizeNew(toImage);
			if (rSize != rSizeNew) {
				toImage = CImage::NewL(
					iImage.iBitmap.SizeInPixels(),
					iImage.iBitmap.DisplayMode());
			}
		}

	 void IReplicate::CastL(CImage& toImage, const TDisplayMode& toDisplayMode) 
		{
			IImageSize rSize(iImage);
			IImageSize rSizeNew(toImage);
			if (rSize != rSizeNew || toDisplayMode != toImage.iBitmap.DisplayMode()) {
				toImage = CImage::NewL(iImage.iBitmap.SizeInPixels(), toDisplayMode);
			}
		}

		void IReplicate::CopyL(CImage& toImage) 
		{
			// First make a new image the same size and type as ourselves.
			CastL(toImage);
			// Now get pointers to the underlying bitmaps so we can get to the data address and size
			IImageSize rSize(iImage);
			// calculate the scan line length using CFbsBitmap's function...
			TInt nSLBytes = CFbsBitmap::ScanLineLength(
				rSize.Width(), 
				iImage.iBitmap.DisplayMode());
			// Finally do the copy
			Mem::Copy(toImage.iBitmap.DataAddress(), iImage.iBitmap.DataAddress(), rSize.Height() * nSLBytes);
		}

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -