Link to home
Start Free TrialLog in
Avatar of tewehuang
tewehuang

asked on

i use the c++ bilder ,and i want to change the bitmap file to gif.

i just want to change the bitmap file to gif file .how could i do?
my source code is:
 while(!Query1->Eof)
  {
      char szName[255];
      // get data from first table
      // and save data into csc
      String csc = Query1->FindField("STKCODE")->AsString;
      String mkt = Query1->FindField("MKT")->AsString;
      // into csc to second table and get data

      if(mkt == "TSE"){
      Query2->Close();

      Query2->SQL->Clear();
      Query2->SQL->Add("select scode,syear*100+smon,T3950,T3100");
      Query2->SQL->Add("from AP.ASEARN");
      Query2->SQL->Add("where SCODE =:sss");
      Query2->ParamByName("sss")->AsString= csc;
      Query2->Active=TRUE;


     // use the data of second table to draw the line chart


      Series1->DataSource=Query2;
      Series1->ParentChart=DBChart1;
      Series1->XLabelsSource="syear*100+smon";
      Series1->YValues->ValueSource= "T3950";
      Series2->DataSource=Query2;
      Series2->ParentChart=DBChart1;
      Series2->XLabelsSource="syear*100+smon";
      Series2->YValues->ValueSource= "T3100";
      wsprintf(szName,"e:\\gsearnsale\\gsearnsale%s.bmp",csc);
      DBChart1->SaveToBitmapFile(szName);
      Query1->Next();
      }

and i know maybe i should reload the saving bitmap file again!but i don't know what's kind of method i can use?
please help me .thanks.

                 
Avatar of jbodom
jbodom

You could use a third party component to change from gif to bmp or vice-versa

http://www.melander.dk/delphi/gifimage/

Avatar of tewehuang

ASKER

Adjusted points from 100 to 120
i just reading the homepage.
but i can't understand how will i do.
because i don't know the delphi source
code.so would you mind write a sample to me.
thanks!
If you haven't done this already, to use the component, you must first download it from one of these sites:

http://www.melander.dk/cgi-bin/download/mirrors?package=tgifimage

Once you've downloaded it, follow these installation instructions for your version of C++ Builder:

http://www.melander.dk/delphi/gifimage/release_notes/install.html

Here's the code to convert from bmp to gif:

Graphics::TBitmap * bm = new Graphics::TBitmap();
TGIFImage *gf = new TGIFImage();
bm->LoadFromFile("test.bmp");
gf->Assign(bm);
gf->SaveToFile("test.gif");
delete bm;
delete gf;

If you need help to convert back the other way then let me know.  Make sure you include the appropriate headers.


I would also find out first if you have gif support first, before you install TGifImage to avoid conflicts. As some package come with gif support. Like RX Library 2.60. To test if you have gif support slap a image component on a form
under the Picture property press Load and see if *.gif is included under the file types. You can disable the gif support in RX Library 2.60 and other packages if you want to use TGifImage Read ReadMe File.
dear jbodom:
     thanks for your help .but i can't
link the first web.could you mind show
me anthoer web address.thanks
                         tewehuang
dear jbodom:
     thanks for your help .but i can't
link the first web.could you mind show
me anthoer web address.thanks
                         tewehuang
Just go here and go to the download section.

http://www.melander.dk/delphi/gifimage/
i just use the method.
but how file i must include.
my means is like *.h.
my source code is :
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  char szName[255];
  char szName1[255];
   while(!Query1->Eof)
  {
    //get the ­ÓªÑ¸ê®Æªºstkcode

      String ind_stk = Query1->FindField("STKCODE")->AsString;
      String mkt = Query1->FindField("MKT")->AsString;


                    if (mkt == "TSE"){

                                             Query2->Close();
                                             Query2->SQL->Clear();
                                             Query2->SQL->Add("select sdate,cp");
                                             Query2->SQL->Add("from ap.aprcd_e");
                                             Query2->SQL->Add("where stkcode=:mem");
                                             Query2->ParamByName("mem")->AsString=ind_stk;
                                             Query2->Active = TRUE;
                                             //String stk_date = Query2->FindField("SYEAR*100+SMON")->AsString;
                                             /*Query3->Close();
                                             Query3->SQL->Clear();
                                             Query3->SQL->Add("select syear*100+smon,cp");
                                             Query3->SQL->Add("from ap.aisprcw");
                                             Query3->SQL->Add("where indid='Y9999'");
                                             Query3->SQL->Add("and (syear*100+smon) >=:date");
                                             Query3->ParamByName("date")->AsString=stk_date;
                                             Query3->Active = TRUE;
                                             */
                                             Series1->DataSource=Query2;
                                             Series1->ParentChart=DBChart1;
                                             Series1->XLabelsSource="sdate";
                                             Series1->YValues->ValueSource = "cp";
                                             /*Series2->DataSource=Query3;
                                             Series2->ParentChart=DBChart1;
                                             Series2->XLabelsSource="syear*100+smon";
                                             Series2->YValues->ValueSource = "cp";
                                             */
                                             wsprintf(szName,"e:\\gprcd\\gprcd%s.bmp",ind_stk);
                                             wsprintf(szName1,"e:\\gprcd\\gprcd%s.gif",ind_stk);
                                             DBChart1->SaveToBitmapFile(szName);
                                             Graphics::TBitmap * bm = new Graphics::TBitmap();
                                             TGIFImage *gf = new TGIFImage();
                                             bm->LoadFromFile("szName");
                                             gf->Assign(bm);
                                             gf->SaveToFile("szName1");
                                             delete bm;
                                             delete gf;

                                             Query1->Next();
                                }
the error meaaage is :
[C++ Error] Unit1.cpp(6): E2209 Unable to open include file 'gifimage.pas'.
[C++ Error] Unit1.cpp(62): E2451 Undefined symbol 'TGIFImage'.
thanks for your help!
You need to include

#include "gifimage.hpp"
ASKER CERTIFIED SOLUTION
Avatar of jbodom
jbodom

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
i just include the headle file "gifimage.hpp".but the error message is
[C++ Error] gifimage.pas(1): E2141 Declaration syntax error.
and appear in the gifimage.h file.
how will i debug?
            thanks!
                      tewehuang
thanks my freiend:i already to find the
correct way to solve.
thanks a lots.
                eric