×
Namespaces

Variants
Actions

显示图片信息

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
hoolee 在 22 Jul 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

CS000864


设备, 软件 版本: S60 3rd Edition, MR

S60 3rd Edition, FP1

S60 3rd Edition, FP2 Beta


Contents

详细描述

下列代码片段将演示如何获取并显示图片的下列信息:

  • 解码器
  • 格式
  • 尺寸
  • 颜色
  • 细节


MMP文件

需要下列链接库

LIBRARY  imageconversion.lib


头文件

/**
* Obtains the image info
* @param aFs a reference to the file server session
* @param aFilename the filename of the image
* @return image info as CFrameInfoStrings*
*/
CFrameInfoStrings* CApp::GetImageInfoL(RFs& aFs, const HBufC& aFilename);


源文件

#include <ImageConversion.h>
 
const TInt KMaxInfoDescriptorLength = 80;// Obtains the image info from the image referenced by the
 
aFilename
CFrameInfoStrings* CApp::GetImageInfoL(RFs& aFs, const HBufC& aFilename)
{
CImageDecoder* decoder = CImageDecoder::FileNewL(aFs, aFilename);
CleanupStack::PushL(decoder);
CFrameInfoStrings* info = decoder->FrameInfoStringsL();
CleanupStack::PopAndDestroy(decoder);
return info;
}// Connect a client process to the fileserver
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL(fsSession);
 
// Obtain the image info
_LIT(KLITFilename, "C:\\Data\\Images\\image.jpg");
const HBufC* KFilename = KLITFilename().Alloc();
CFrameInfoStrings* info = GetImageInfoL(fsSession, *KFilename);
CleanupStack::PushL(info);
 
// Display the info items one by one
for (TInt i = 0; i < info->Count(); i++)
{
TBuf<KMaxInfoDescriptorLength> infoItem;
infoItem.Append(info->String(i));
CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
note->ExecuteLD(infoItem);
}
 
// Clean up
CleanupStack::PopAndDestroy(2); // info, fsSession
fsSession.Close();
This page was last modified on 15 December 2011, at 09:43.
38 page views in the last 30 days.
×