Click here to Skip to main content
15,891,375 members
Articles / Desktop Programming / MFC

ImageStone - A Powerful C++ Class Library for Image Manipulation

Rate me:
Please Sign up or sign in to vote.
4.81/5 (250 votes)
6 Dec 2011Zlib3 min read 119.7K   51.5K   405  
An article on a library for image manipulation
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ImageStone: Interface_ImageHandle.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a></div>
<h1>Interface_ImageHandle.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> *   Copyright (C) =USTC= Fu Li</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> *   Author   :  Fu Li</span>
00005 <span class="comment"> *   Create   :  2004-4-2</span>
00006 <span class="comment"> *   Home     :  http://www.crazy-bit.com/</span>
00007 <span class="comment"> *   Mail     :  crazybit@263.net</span>
00008 <span class="comment"> *   History  :  </span>
00009 <span class="comment"> */</span>
00010 <span class="preprocessor">#ifndef __PCL_INTERFACE_IMAGEHANDLE__2005_04_02__H__</span>
00011 <span class="preprocessor"></span><span class="preprocessor">#define __PCL_INTERFACE_IMAGEHANDLE__2005_04_02__H__</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#include "../StdDefine.h"</span>
00013 <span class="keyword">class </span><a class="code" href="class_f_c_obj_image.html">FCObjImage</a> ; <span class="comment">// external class</span>
00014 
00015 <span class="keyword">class </span><a class="code" href="class_f_c_image_handle_base.html">FCImageHandleBase</a> ;
00016 
00017 <span class="comment">//=============================================================================</span>
<a name="l00022"></a><a class="code" href="class_f_c_image_handle_base.html">00022</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_f_c_image_handle_base.html">FCImageHandleBase</a>
00023 {
00024 <span class="keyword">public</span>:
00029     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_f_c_image_handle_base.html#a0">LoadImageFile</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* szFileName) ;
00030 
<a name="l00032"></a><a class="code" href="class_f_c_image_handle_base.html#a1">00032</a>     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_f_c_image_handle_base.html#a1">LoadImageMemory</a> (<span class="keyword">const</span> BYTE* pStart, <span class="keywordtype">int</span> nFileSize) {<span class="keywordflow">return</span> <span class="keyword">false</span>;}
00033 
<a name="l00036"></a><a class="code" href="class_f_c_image_handle_base.html#a2">00036</a>     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_f_c_image_handle_base.html#a2">SaveImage</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* szFileName, <span class="keywordtype">int</span> nFlag = -1) {<span class="keywordflow">return</span> <span class="keyword">false</span>;}
00037 
00040     <span class="keyword">virtual</span> std::deque&lt;FCObjImage*&gt; <a class="code" href="class_f_c_image_handle_base.html#a3">GetLoadImage</a> (<span class="keywordtype">bool</span> bWantBeOwnner) =0 ;
00041 
<a name="l00043"></a><a class="code" href="class_f_c_image_handle_base.html#a4">00043</a>     <span class="keywordtype">void</span> <a class="code" href="class_f_c_image_handle_base.html#a4">PushSaveList</a> (<span class="keyword">const</span> <a class="code" href="class_f_c_obj_image.html">FCObjImage</a>* pImg) {<a class="code" href="class_f_c_image_handle_base.html#p0">m_SaveImg</a>.push_back(pImg);}
00044 
00045     <span class="keyword">virtual</span> ~<a class="code" href="class_f_c_image_handle_base.html">FCImageHandleBase</a>() {}
00046 <span class="keyword">protected</span>:
<a name="l00048"></a><a class="code" href="class_f_c_image_handle_base.html#p0">00048</a>     std::deque&lt;const FCObjImage*&gt;   <a class="code" href="class_f_c_image_handle_base.html#p0">m_SaveImg</a> ;
00049 } ;
00050 
00051 <span class="comment">//=============================================================================</span>
00052 <span class="comment">// inline Implement</span>
00053 <span class="comment">//=============================================================================</span>
<a name="l00054"></a><a class="code" href="class_f_c_image_handle_base.html#a0">00054</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="class_f_c_image_handle_base.html#a0">FCImageHandleBase::LoadImageFile</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* szFileName)
00055 {
00056     std::ifstream     inFile (szFileName, std::ios::in|std::ios::binary) ;
00057     <span class="keywordflow">if</span> (!inFile.is_open())
00058         <span class="keywordflow">return</span> false ;
00059 
00060     <span class="comment">// get file length</span>
00061     inFile.seekg (0, std::ios::end) ;
00062     <span class="keyword">const</span> <span class="keywordtype">int</span>     nFileSize = inFile.tellg() ;
00063     <span class="keywordflow">if</span> (nFileSize &lt;= 0)
00064         <span class="keywordflow">return</span> false ;
00065 
00066     <span class="comment">// read file into memory</span>
00067     <a class="code" href="class_p_c_l__array.html">PCL_array&lt;BYTE&gt;</a>   pStart (nFileSize) ;
00068     inFile.seekg (0, std::ios::beg) ;
00069     inFile.read ((<span class="keywordtype">char</span>*)pStart.<a class="code" href="class_p_c_l__array.html#a4">get</a>(), nFileSize) ;
00070     <span class="keywordflow">return</span> <a class="code" href="class_f_c_image_handle_base.html#a1">LoadImageMemory</a> (pStart.<a class="code" href="class_p_c_l__array.html#a4">get</a>(), nFileSize) ;
00071 }
00072 
00073 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 8 11:12:46 2006 for ImageStone by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The zlib/libpng License


Written By
Team Leader PhoXo
China China
graduate from University of Science and Technology of China at 2002.

Now I work at www.phoxo.com.

Comments and Discussions