Link to home
Start Free TrialLog in
Avatar of meow00
meow00

asked on

load image using library ...

Hi Experts,

    I am trying to load some jpeg files using some library. I tried the following code, it is compiled fine, however, I saw no images ? Does anyone know what I might have missed ??? many thanks !!!

//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>

#include "EColor.h"
#include "EImage.h"

#pragma hdrstop

#pragma argsused
int main(int argc, char* argv[])
{
    EImageC24 EC24Image1;  // EImageC24 class instance
    enum IMAGE_FILE_TYPES eFileFormat;   // File type for load and save of images
    EColorLookup EColorLookup1;  // EColorLookup class instance
    EImageC24 EC24Image2;  // EImageC24 class instance
    EColorLookup EColorLookup2;  // EColorLookup class instance
    EImageBW8 EBW8Image3;  // EImageBW8 class instance
    EImageC24 EC24Image4;  // EImageC24 class instance
    EColorLookup EColorLookup3;  // EColorLookup class instance

//  This section contains the operations code
    ESetJpegQuality(90);
// Load BGA Substrate Color.jpg image into EC24Image1
    eFileFormat = EC24Image1.Load("C:\\Program   Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");
// Load BGA Substrate Color.jpg image into EC24Image2
eFileFormat = EC24Image2.Load("C:\\Program Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");
    EBW8Image3.SetSize(512, 512);
   EBW8Image3.SetSize(&EC24Image2);
// Load BGA Substrate Color.jpg image into EC24Image4
eFileFormat = EC24Image4.Load("C:\\Program Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");

        cout << " Test " << endl ;
         getchar() ;
        return 0;
}
Avatar of Woodster
Woodster
Flag of Australia image

Without knowing the specific library you are using it is hard to know what you are supposed to be doing exactly.  However seeing that this is a console application (I think) I am guessing that just calling .LoadImage() is simply loading the image file into memory and is not physically displaying it, you will need to call a separate member function for EImageC24 in order to actually display the image on the screen.

*** Insert Google search here ***

I am guessing that you are using the eVision C++ library.  There is a separate draw function that is required to be called (as far as I can tell from a quick look) in order to display the image.  The function also needs to be passed in a window handle of the window that will display the image.  In order to pass in a Windows handle, you will need to start a Windows application rather than a simple console application which I think you may be using at the moment
Avatar of meow00
meow00

ASKER

Thanks very much ! What you guess is close to what I need to do.
So could you please give me some suggestions :
What kind of application should I use ? frame ? or form ? or just use :
File -> New -> Application ???

many thanks !!!

File | New | Application from within C++ Builder will give you a base for a Windows application / project and will also present you with a main form on which you can place your image.

If using a TForm to display the image, you will not need to use the eVision library (if tat is what you are using) unless you need the funcionality that it provides.  If you are just simply trying to display an image on a TForm:

Create a new project (File | New | Application)
Add a TImage component to the form within the IDE at design time and double click the added TImage component to allow you to load an image for display.
Once the image has been selected and loaded, you can set the AutoSize property of the Image component to be true so that the whole image can be viewed.


Avatar of meow00

ASKER

Thanks very much ! I do need some functions from eVision library in the future .....

so ... could you please where the "TImage" locates ? I couldn't find it at all :-(

many thanks !
ASKER CERTIFIED SOLUTION
Avatar of Woodster
Woodster
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of meow00

ASKER

Thanks very much .... I will work on it  ^^