To save an image

Re: To save an image [Solved]

Postby mastintin » Sat Nov 07, 2015 5:32 pm

User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Sat Nov 07, 2015 8:43 pm

Please confirm that these are the errors you get:

Code: Select all  Expand view
Error E2303 QColorQuantizer.h 53: Type name expected
Error E2139 QColorQuantizer.h 53: Declaration missing ;
Error E2293 QColorQuantizer.h 71: ) expected
Error E2293 QColorQuantizer.h 86: ) expected
Error E2293 QColorQuantizer.h 87: ) expected
Error E2293 QColorQuantizer.h 101: ) expected
Error E2303 QColorQuantizer.h 139: Type name expected
Error E2238 QColorQuantizer.h 139: Multiple declaration for 'QColorQuantizer::Bitmap'
Error E2344 QColorQuantizer.h 53: Earlier declaration of 'QColorQuantizer::Bitmap'
Error E2139 QColorQuantizer.h 139: Declaration missing ;
Error E2293 QColorQuantizer.h 140: ) expected
Error E2303 QColorQuantizer.h 142: Type name expected
Error E2139 QColorQuantizer.h 142: Declaration missing ;
Error E2303 QColorQuantizer.h 144: Type name expected
Error E2139 QColorQuantizer.h 144: Declaration missing ;
Error E2303 QColorQuantizer.h 147: Type name expected
Error E2139 QColorQuantizer.h 147: Declaration missing ;
Error E2451 QColorQuantizer.h 83: Undefined symbol 'm_pThread' in function QColorQuantizer::IsCalculating()
Error E2312 QColorQuantizer.cc 170: 'm_pMsgWnd' is not an unambiguous base class of 'QColorQuantizer' in function QColorQuantizer::QColorQ
uantizer()
Error E2312 QColorQuantizer.cc 172: 'm_pThread' is not an unambiguous base class of 'QColorQuantizer' in function QColorQuantizer::QColorQ
uantizer()
Error E2312 QColorQuantizer.cc 174: 'm_pSource' is not an unambiguous base class of 'QColorQuantizer' in function QColorQuantizer::QColorQ
uantizer()
Error E2451 QColorQuantizer.cc 183: Undefined symbol 'Image'
*** 22 errors in Compile ***


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby mastintin » Sun Nov 08, 2015 9:46 am

gdipluss.cpp:
Warning W8022 c:\bcc7\include\windows\sdk\GdiplusHeaders.h 636: 'Bitmap::Clone(c
onst Rect &,int)' hides virtual function 'Image::Clone()'
QColorQuantizer.cpp:
Error E2209 stdafx.h 32: Unable to open include file 'afxwin.h'
Error E2209 stdafx.h 33: Unable to open include file 'afxext.h'
Error E2209 stdafx.h 35: Unable to open include file 'afxdtctl.h'
Error E2209 stdafx.h 37: Unable to open include file 'afxcmn.h'
Error E2209 stdafx.h 41: Unable to open include file 'QGdiPlus.h'
Error E2303 QColorQuantizer.h 53: Type name expected
Error E2139 QColorQuantizer.h 53: Declaration missing ;
Error E2293 QColorQuantizer.h 71: ) expected
Error E2293 QColorQuantizer.h 86: ) expected
Error E2293 QColorQuantizer.h 87: ) expected
Error E2293 QColorQuantizer.h 95: ) expected
Error E2293 QColorQuantizer.h 97: ) expected
Error E2293 QColorQuantizer.h 98: ) expected
Error E2303 QColorQuantizer.h 99: Type name expected
Error E2139 QColorQuantizer.h 99: Declaration missing ;
Error E2303 QColorQuantizer.h 100: Type name expected
Error E2238 QColorQuantizer.h 100: Multiple declaration for 'QColorQuantizer::Oc
treeNode::UINT'
Error E2344 QColorQuantizer.h 99: Earlier declaration of 'QColorQuantizer::Octre
eNode::UINT'
Error E2139 QColorQuantizer.h 100: Declaration missing ;
Error E2293 QColorQuantizer.h 101: ) expected
Error E2303 QColorQuantizer.h 115: Type name expected
Error E2139 QColorQuantizer.h 115: Declaration missing ;
Error E2303 QColorQuantizer.h 119: Type name expected
Error E2139 QColorQuantizer.h 119: Declaration missing ;
Error E2303 QColorQuantizer.h 120: Type name expected
Error E2139 QColorQuantizer.h 120: Declaration missing ;
Error E2303 QColorQuantizer.h 131: Type name expected
Error E2139 QColorQuantizer.h 131: Declaration missing ;
Error E2303 QColorQuantizer.h 132: Type name expected
Error E2139 QColorQuantizer.h 132: Declaration missing ;
Error E2303 QColorQuantizer.h 133: Type name expected
Error E2139 QColorQuantizer.h 133: Declaration missing ;
Error E2303 QColorQuantizer.h 139: Type name expected
Error E2139 QColorQuantizer.h 139: Declaration missing ;
Error E2293 QColorQuantizer.h 140: ) expected
Error E2303 QColorQuantizer.h 142: Type name expected
Error E2139 QColorQuantizer.h 142: Declaration missing ;
Error E2303 QColorQuantizer.h 143: Type name expected
Error E2139 QColorQuantizer.h 143: Declaration missing ;
Error E2303 QColorQuantizer.h 144: Type name expected
Error E2139 QColorQuantizer.h 144: Declaration missing ;
Error E2303 QColorQuantizer.h 146: Type name expected
Error E2139 QColorQuantizer.h 146: Declaration missing ;
Error E2303 QColorQuantizer.h 147: Type name expected
Error E2139 QColorQuantizer.h 147: Declaration missing ;
Error E2139 QColorQuantizer.h 150: Declaration missing ;
Error E2451 QColorQuantizer.h 83: Undefined symbol 'm_pThread' in function QColo
rQuantizer::IsCalculating()
Error E2451 QColorQuantizer.h 83: Undefined symbol 'NULL' in function QColorQuan
tizer::IsCalculating()
Error E2451 QColorQuantizer.h 106: Undefined symbol 'm_nLevel' in function QColo
rQuantizer::OctreeNode::ReduceBefore(const QColorQuantizer::OctreeNode &) const
Error E2316 QColorQuantizer.h 106: 'm_nLevel' is not a member of 'QColorQuantize
r::OctreeNode' in function QColorQuantizer::OctreeNode::ReduceBefore(const QColo
rQuantizer::OctreeNode &) const
Error E2228 QColorQuantizer.h 106: Too many error or warning messages in functio
n QColorQuantizer::OctreeNode::ReduceBefore(const QColorQuantizer::OctreeNode &)
const
*** 51 errors in Compile ***
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Sun Nov 08, 2015 6:37 pm

Please try this (from xHarbour SVN) and report back the list of errors/warnings:

Code: Select all  Expand view
/*
 * $Id: stdafx.h 9685 2012-09-16 05:42:35Z andijahja $
 */


////////////////////////////////////////////////////////////////////////////////
// $Workfile: stdafx.h $
// $Archive: /ZipArchive_STL/stdafx.h $
// $Date: 2012-09-16 07:42:35 +0200 (dom, 16 set 2012) $ $Author: andijahja $
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// For the licensing details see the file License.txt
////////////////////////////////////////////////////////////////////////////////

#if ! defined( AFX_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_ )
#define AFX_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_

#if ( _MSC_VER < 1300 ) && ! defined ( __BORLANDC__ ) && ! defined ( __GNUC__ )
        #define ZIPINLINE inline
#else
        #define ZIPINLINE
#endif


#define ZIP_ARCHIVE_STL

#if _MSC_VER > 1000
   #pragma once
   //because of STL
   #pragma warning (disable : 4710)  // 'function' : function not inlined
   #pragma warning (disable : 4514)  // unreferenced inline/local function has been removed
   #pragma warning (disable : 4786)  // 'identifier' : identifier was truncated to 'number' characters in the debug information
   #pragma warning( push, 3 ) // STL requrements
   #if ( _MSC_VER >= 1400 )
      #if ! defined( _CRT_SECURE_NO_WARNINGS )
         #define _CRT_SECURE_NO_WARNINGS
      #endif
   #endif
#elif defined( __BORLANDC__ )
   #pragma warn -8027
   #pragma warn -8004
#endif // _MSC_VER > 1000


// some Windows typical definitions

#if defined ( _UNICODE ) && ! defined ( UNICODE )
        #define UNICODE
#endif
#if defined ( UNICODE ) && ! defined ( _UNICODE )
        #define _UNICODE
#endif

#ifndef _WIN32
        #ifndef NULL
                #define NULL 0
        #endif

        #include <ctype.h>
typedef int HFILE;
typedef void *                           HANDLE;
typedef unsigned long DWORD;
typedef long LONG;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int UINT;

        #ifndef FALSE
                #define FALSE ( int ) 0
        #endif

        #ifndef TRUE
                #define TRUE  ( int ) 1
        #endif


typedef unsigned short WCHAR;            // wc,   16-bit UNICODE character
typedef const WCHAR * LPCWSTR;
typedef const char * LPCSTR;
typedef WCHAR * LPWSTR;
typedef char * LPSTR;

        #ifdef  _UNICODE
typedef wchar_t TCHAR;
typedef LPCWSTR LPCTSTR;
typedef LPWSTR LPTSTR;
                #define _T( x )  L##x
        #else /* _UNICODE */                 // r_winnt
typedef char TCHAR;
typedef LPCSTR LPCTSTR;
typedef LPSTR LPTSTR;
                #define _T( x )  x
        #endif /* _UNICODE */                // r_winnt


#else
        #include <tchar.h>
        #include <windows.h>
        #ifndef STRICT
                #define STRICT
        #endif
#endif  // #ifndef _WIN32

#ifndef ASSERT
        #include <assert.h>
        #define ASSERT( f )         assert( ( f ) )
#endif
#ifndef VERIFY
        #ifdef _DEBUG
                #define VERIFY( x ) ASSERT( ( x ) )
        #else
                #define VERIFY( x ) x
        #endif
#endif


#ifndef TRACE
        #define TRACE( m )          ( ( void ) 0 )
#endif

#if _MSC_VER >= 1300
        #define ZIP_ULONGLONG ULONGLONG
        #define ZIP_LONGLONG  LONGLONG
#else
        #define ZIP_ULONGLONG DWORD
        #define ZIP_LONGLONG  LONG
#endif

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_)


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Sun Nov 08, 2015 10:37 pm

Then add these

Code: Select all  Expand view
#include "gdiplus.h"
using namespace Gdiplus;


between

Code: Select all  Expand view
#include "stdafx.h"


and

Code: Select all  Expand view
#include "QColorQuantizer.h"


in QColorQuantizer.cc.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Sun Nov 08, 2015 10:40 pm

Now an harder problem. In the following line

Code: Select all  Expand view
    void MakeQuantized(Image * pSource, Mode mode, CWnd * pMsgWnd, UINT nMaxColors = 256,
        UINT message = QM_COLORQUANTIZER);


the class CWnd is used. It belongs to MFC. But we don't have MFC in BCC. Or at least I can't find it. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby mastintin » Mon Nov 09, 2015 8:45 am

include en cpp file :
Code: Select all  Expand view


#define STRICT
#pragma option -w-hid
#include <Windows.h>
#include <Algorithm>
using std::min;
using std::max;
#include <GdiPlus.h>

#pragma option -whid

 


only 9 errors..

Code: Select all  Expand view


Warning W8022 c:\bcc7\include\windows\sdk\GdiplusHeaders.h 636: 'Bitmap::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
QColorQuantizer.cpp:
Error E2303 QColorQuantizer.h 71: Type name expected
Error E2303 QColorQuantizer.h 142: Type name expected
Error E2139 QColorQuantizer.h 142: Declaration missing ;
Error E2303 QColorQuantizer.h 147: Type name expected
Error E2139 QColorQuantizer.h 147: Declaration missing ;
Error E2451 QColorQuantizer.h 83: Undefined symbol 'm_pThread' in function QColorQuantizer::IsCalculating()
Error E2312 QColorQuantizer.cpp 43: 'm_pMsgWnd' is not an unambiguous base class of 'QColorQuantizer' in function QColorQuantizer::QColorQuantizer()
Error E2312 QColorQuantizer.cpp 45: 'm_pThread' is not an unambiguous base class of 'QColorQuantizer' in function QColorQuantizer::QColorQuantizer()
Error E2451 QColorQuantizer.cpp 56: Undefined symbol 'Image'
*** 9 errors in Compile ***
gdipluss.cpp:
Warning W8022 c:\bcc7\include\windows\sdk\GdiplusHeaders.h 636: 'Bitmap::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
tgdiplus.c:
prv2pdf.c:
* Linking errors *

 


" pMsgWnd points to CWnd that will receive message when bitmap is completed;"

The MFC code used to perform the calculations in a thread apart.
It is multithreaded, it would have to adapt to not use threads and you can dispense with the MFC.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Mon Nov 09, 2015 9:46 am

I just sent you an updated version that compiles fine here. I don't know if it will work fine or it will work at all, though.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby mastintin » Mon Nov 09, 2015 11:36 am

Enrico , I created a function -> Bitmap * CreateGif function (Bitmap * pSource) in qColorQuantizer file to test it.
In gdiplus.cpp
error code ...

gdipluss.cpp:
Warning W8022 c:\bcc7\include\windows\sdk\GdiplusHeaders.h 636: 'Bitmap::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
Error E2268 gdipluss.cpp 1442: Call to undefined function 'CreateGif' in function HB_FUN_GDIPLUSIMAGELOADCACHEDFILE()
Error E2034 gdipluss.cpp 1442: Cannot convert 'int' to 'Bitmap *' in function HB_FUN_GDIPLUSIMAGELOADCACHEDFILE()
*** 2 errors in Compile ***

How I declaree the CreateGif function as the file gdiplus.cpp ?
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Mon Nov 09, 2015 11:49 am

Can I see the source code, please?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby mastintin » Mon Nov 09, 2015 12:38 pm

Enrico .
Fixed error above.
And compiles everything, and apparently works but when recording the result is not as expected. :-(
I'm investigating to solve it, the hardest part is made .
I have very messy code, when you have a little cleaner I am sending.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby mastintin » Mon Nov 09, 2015 6:35 pm

resolved ... :D .
it works now.
see if we can clean up the code even more.
Enrico, i send files to your email.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Mon Nov 09, 2015 6:38 pm

Great! Can I have the updated LIBs to test here?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To save an image [Solved]

Postby mastintin » Mon Nov 09, 2015 6:44 pm

clean a little more the code and I send to test two obj files.
You have the code in your email.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: To save an image [Solved]

Postby Enrico Maria Giordano » Mon Nov 09, 2015 6:57 pm

mastintin wrote:clean a little more the code and I send to test two obj files.


Thank you.

mastintin wrote:You have the code in your email.


Yes, but it's not easy to try it. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 118 guests