📄 _ocr_example_image_view_8cpp-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>OcrExampleImageView.cpp Source File</title><link href="style.css" rel="stylesheet" type="text/css"></head><table border="0" width="100%" height="8" bgcolor="#eeeeee"><tr> <td width="100%" height="1"><b><font size="2" color="#000000" face="Arial, Helvetica, sans-serif"><strong><a name=Top></a>S60 5th Edition SDK v0.9 </strong></font></b><br><i>Example Applications Guide</i></td></tr> </table><!-- Generated by Doxygen 1.4.5 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> </ul></div><h1>OcrExampleImageView.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span><a name="l00002"></a>00002 <span class="comment">* ==============================================================================</span><a name="l00003"></a>00003 <span class="comment">* Name : OcrExampleImageView.cpp</span><a name="l00004"></a>00004 <span class="comment">* Part of : OcrExampleImageView</span><a name="l00005"></a>00005 <span class="comment">* Interface :</span><a name="l00006"></a>00006 <span class="comment">* Description :</span><a name="l00007"></a>00007 <span class="comment">* Version :</span><a name="l00008"></a>00008 <span class="comment">*</span><a name="l00009"></a>00009 <span class="comment">* Copyright (c) 2006 Nokia Corporation.</span><a name="l00010"></a>00010 <span class="comment">* This material, including documentation and any related</span><a name="l00011"></a>00011 <span class="comment">* computer programs, is protected by copyright controlled by</span><a name="l00012"></a>00012 <span class="comment">* Nokia Corporation.</span><a name="l00013"></a>00013 <span class="comment">* ==============================================================================</span><a name="l00014"></a>00014 <span class="comment">*/</span><a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="comment">// INCLUDE FILES</span><a name="l00017"></a>00017 <span class="preprocessor">#include <aknutils.h></span><a name="l00018"></a>00018 <span class="preprocessor">#include <f32file.h></span><a name="l00019"></a>00019 <span class="preprocessor">#include <s32file.h></span><a name="l00020"></a>00020 <span class="preprocessor">#include <aknnotewrappers.h></span><a name="l00021"></a>00021 <span class="preprocessor">#include <akncommondialogs.h></span><a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#include "OcrExampleAppUi.h"</span><a name="l00024"></a>00024 <span class="preprocessor">#include <OcrExample.rsg></span><a name="l00025"></a>00025 <span class="preprocessor">#include "OcrExample.hrh"</span><a name="l00026"></a>00026 <span class="preprocessor">#include "OcrExampleUids.h"</span><a name="l00027"></a>00027 <span class="preprocessor">#include "OcrExampleImageContainer.h"</span><a name="l00028"></a>00028 <span class="preprocessor">#include "OcrExampleSettingsData.h"</span><a name="l00029"></a>00029 <span class="preprocessor">#include "OcrExampleImageView.h"</span><a name="l00030"></a>00030 <span class="preprocessor">#include "LayoutForm.h"</span><a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="comment">// ========================= MEMBER FUNCTIONS ================================</span><a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00035"></a>00035 <span class="comment">// COcrExampleImageView::COcrExampleImageView</span><a name="l00036"></a>00036 <span class="comment">// C++ constructor</span><a name="l00037"></a>00037 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00038"></a>00038 <span class="comment">//</span><a name="l00039"></a><a class="code" href="class_c_ocr_example_image_view.html#7cfaacbb7bdeefcb6bb02114fea43f70">00039</a> <a class="code" href="class_c_ocr_example_image_view.html#7cfaacbb7bdeefcb6bb02114fea43f70">COcrExampleImageView::COcrExampleImageView</a>(<a class="code" href="class_t_ocr_example_settings_data.html">TOcrExampleSettingsData</a>& aSettings)<a name="l00040"></a>00040 : iContainer(0)<a name="l00041"></a>00041 , iBitMap(0)<a name="l00042"></a>00042 , iHandler(0)<a name="l00043"></a>00043 , iEngine(0)<a name="l00044"></a>00044 , iSettings(aSettings)<a name="l00045"></a>00045 , iState(EInit)<a name="l00046"></a>00046 , iCrosshairEnabled(EFalse)<a name="l00047"></a>00047 , iBackgroundTaskDone(EFalse)<a name="l00048"></a>00048 {<a name="l00049"></a>00049 }<a name="l00050"></a>00050 <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00053"></a>00053 <span class="comment">// COcrExampleImageView.::NewLC</span><a name="l00054"></a>00054 <span class="comment">// Symbian OS two-phased constructor.</span><a name="l00055"></a>00055 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00056"></a>00056 <span class="comment">//</span><a name="l00057"></a><a class="code" href="class_c_ocr_example_image_view.html#301a5b741381c9ed497a7d8f7f10f782">00057</a> <a class="code" href="class_c_ocr_example_image_view.html">COcrExampleImageView</a>* <a class="code" href="class_c_ocr_example_image_view.html#301a5b741381c9ed497a7d8f7f10f782">COcrExampleImageView::NewL</a>(<a class="code" href="class_t_ocr_example_settings_data.html">TOcrExampleSettingsData</a>& aSettings)<a name="l00058"></a>00058 {<a name="l00059"></a>00059 <a class="code" href="class_c_ocr_example_image_view.html">COcrExampleImageView</a>* <span class="keyword">self</span> = <span class="keyword">new</span> (ELeave) <a class="code" href="class_c_ocr_example_image_view.html#7cfaacbb7bdeefcb6bb02114fea43f70">COcrExampleImageView</a>(aSettings);<a name="l00060"></a>00060 <span class="keyword">self</span>->ConstructL();<a name="l00061"></a>00061 <span class="keywordflow">return</span> <span class="keyword">self</span>;<a name="l00062"></a>00062 }<a name="l00063"></a>00063 <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00066"></a>00066 <span class="comment">// COcrExampleImageView::ConstructL</span><a name="l00067"></a>00067 <span class="comment">// Symbian OS 2nd phase constructor</span><a name="l00068"></a>00068 <span class="comment">// ---------------------------------------------------------------------------</span><a name="l00069"></a>00069 <span class="comment">//</span><a name="l00070"></a><a class="code" href="class_c_ocr_example_image_view.html#9ce34ba0b947863222da3c63d0481044">00070</a> <span class="keywordtype">void</span> <a class="code" href="class_c_ocr_example_image_view.html#9ce34ba0b947863222da3c63d0481044">COcrExampleImageView::ConstructL</a>()<a name="l00071"></a>00071 {<a name="l00072"></a>00072 BaseConstructL(R_OCR_EXAMPLE_IMAGE_VIEW);<a name="l00073"></a>00073 <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a> = <a class="code" href="class_c_ocr_example_image_container.html#8a8ff0f1fb84e569111f037935ee6813">COcrExampleImageContainer::NewL</a>(ClientRect(), <a class="code" href="class_c_ocr_example_image_view.html#59c39b7488b211d41b665791026c2f7f">iSettings</a>, <a class="code" href="class_c_ocr_example_image_view.html#e72899bf23845a10c6b7559c2e896baa">iData</a>);<a name="l00074"></a>00074 <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a>->SetMopParent( <span class="keyword">this</span> );<a name="l00075"></a>00075 <a name="l00076"></a>00076 AppUi()->AddToStackL( *<span class="keyword">this</span>, <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a> );<a name="l00077"></a>00077 <a name="l00078"></a>00078 <span class="comment">// create a new log-file</span><a name="l00079"></a>00079 User::LeaveIfError(<a class="code" href="class_c_ocr_example_image_view.html#7b548225db36c87401243f1080bbd0e8">iFs</a>.Connect());<a name="l00080"></a>00080 RFile file;<a name="l00081"></a>00081 User::LeaveIfError(file.Replace(<a class="code" href="class_c_ocr_example_image_view.html#7b548225db36c87401243f1080bbd0e8">iFs</a>, KLogFile, EFileWrite|EFileShareAny ));<a name="l00082"></a>00082 file.Close();<a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="comment">// bitmap for the original image</span><a name="l00085"></a>00085 <a class="code" href="class_c_ocr_example_image_view.html#9eb6fa3188758350a81b83400892e787">iBitMap</a> = <span class="keyword">new</span> (ELeave) CFbsBitmap;<a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="comment">// bitmap for the image fitted to the screen</span><a name="l00088"></a>00088 <a class="code" href="class_c_ocr_example_image_view.html#e72899bf23845a10c6b7559c2e896baa">iData</a>.<a class="code" href="class_t_screen_update_data.html#ea6eefa2a3b0315b12fbb5ab0532a849">iScaledBitMap</a> = new (ELeave) CFbsBitmap;<a name="l00089"></a>00089 <a name="l00090"></a>00090 <span class="comment">// create handler to deal with asynchronous image loading and scaling</span><a name="l00091"></a>00091 <a class="code" href="class_c_ocr_example_image_view.html#56132cb68e64726ad0658571e44e9644">iHandler</a> = <a class="code" href="class_n_o_c_r_utils_1_1_c_image_handler.html#2313eabc359b0dee4c27ae32dec4dec4">NOCRUtils::CImageHandler::NewL</a>( <a class="code" href="class_c_ocr_example_image_view.html#9eb6fa3188758350a81b83400892e787">iBitMap</a>,<a name="l00092"></a>00092 <a class="code" href="class_c_ocr_example_image_view.html#e72899bf23845a10c6b7559c2e896baa">iData</a>.<a class="code" href="class_t_screen_update_data.html#ea6eefa2a3b0315b12fbb5ab0532a849">iScaledBitMap</a>,<a name="l00093"></a>00093 iFs,<a name="l00094"></a>00094 *<span class="keyword">this</span> );<a name="l00095"></a>00095 <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a>->ActivateL();<a name="l00096"></a>00096 }<a name="l00097"></a>00097 <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="comment">// Destructor</span><a name="l00100"></a><a class="code" href="class_c_ocr_example_image_view.html#7d81a8b96f59b43df326cbfa61435b3a">00100</a> <a class="code" href="class_c_ocr_example_image_view.html#7d81a8b96f59b43df326cbfa61435b3a">COcrExampleImageView::~COcrExampleImageView</a>()<a name="l00101"></a>00101 {<a name="l00102"></a>00102 <span class="keywordflow">if</span> (<a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a>)<a name="l00103"></a>00103 {<a name="l00104"></a>00104 AppUi()->RemoveFromStack(<a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a>);<a name="l00105"></a>00105 <span class="keyword">delete</span> <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a>;<a name="l00106"></a>00106 <a class="code" href="class_c_ocr_example_image_view.html#6dc94c8cd7c107bc61701348814020e6">iContainer</a> = NULL;<a name="l00107"></a>00107 }<a name="l00108"></a>00108 <span class="keywordflow">if</span> (<a class="code" href="class_c_ocr_example_image_view.html#c22846eecaea51cfb97699603e4227b3">iEngine</a>)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -