?
Solved

load image using library ...

Posted on 2004-11-25
6
Medium Priority
?
867 Views
Last Modified: 2013-11-17
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;
}
0
Comment
Question by:meow00
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:Woodster
ID: 12672763
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
0
 
LVL 1

Author Comment

by:meow00
ID: 12672781
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 !!!

0
 
LVL 4

Expert Comment

by:Woodster
ID: 12672808
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.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:meow00
ID: 12672834
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 !
0
 
LVL 4

Accepted Solution

by:
Woodster earned 1800 total points
ID: 12672882
If you need functions from the eVision library then you may not be able to use TImage class and retain functionality of the eVision library.

To use the EImageC24 class, you can call the Draw function and simply pass in the device context of the window control where you wish to draw the image.

Within the TForm, you can possibly do something like:

EC24Image4.Draw(this->GetDeviceContext);

and see what happens.  I have never used C++ Builder to draw directly to a device context so am not sure what the results will be if drawing directly to the DC of the TForm.  You may need to add a TFrame to the main TForm and then draw to the frame's DC instead.

(from within the TForm's OnShow event or similar)

...
EC24Image4.Draw(myFrame->GetDeviceContext());
...

NOTE: This code may not work as I am not using the eVision library and have not used DC's directly as mentioned above.  But then again - it just might work.

0
 
LVL 1

Author Comment

by:meow00
ID: 12673000
Thanks very much .... I will work on it  ^^
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month15 days, 22 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question