trichview.support
Re: Backgrounds & Images |
Author |
Message |
Slavi Marinov |
Posted: 10/29/2002 14:16:24 Well, I do not whether I have an old version of the demo, but the saving routine looks like this : ************************* procedure TForm1.RichView1HTMLSaveImage(Sender: TCustomRichView; RVData: TCustomRVData; ItemNo: Integer; const Path: String; BackgroundColor: TColor; var Location: String; var DoDefault: Boolean); var gif: TGifImage; wmf: TMetafile; gr: TGraphic; s: String; AVAlign: TRVVAlign; ATag: Integer; ImageList: TCustomImageList; ImageIndex: Integer; Canvas: TMetafileCanvas; begin // Parameters: // Saving item is defined by pair (RVData, ItemNo). // It is the ItemNo-th item in RVData object. // RVData may be RichView.RVData, or cell, or RVData of cell inplace editor. // Path - destination directory of HTML file. // BackgroundColor - color of background under this item. Not used here // because GIFs support true transparency. // Location - output parameter to specify filename of image file // DoDefault - set to false if you save this item as image yourself. case RVData.GetItemStyle(ItemNo) of rvsPicture, rvsHotPicture: begin // Assigning image to GIF and saving // (metafiles and icons will be saved with transparency) gif := TGifImage.Create; try RVData.GetPictureInfo(ItemNo, s, gr, AVAlign, ATag); gif.Assign(gr); Location := RVData.GetNextFileName(Edit2.Text, Path, '.gif', RichView1.imgSaveNo, Checkbox1.Checked); gif.SaveToFile(Location); DoDefault := False; finally gif.Free; end; end; rvsBullet, rvsHotspot: begin // This is not efficient way, because the same image will be // saved many times. In your application you can save bullets // before saving HTMLs, and here only return file name. RVData.GetBulletInfo(ItemNo, s, ImageIndex, ImageList, ATag); wmf := TMetafile.Create; gif := TGifImage.Create; try // Drawing image from imagelist to metafile // This method allows to save transparency wmf.Width := TImageList(ImageList).Width; wmf.Height := TImageList(ImageList).Height; Canvas := TMetafileCanvas.Create(wmf, 0); ImageList.Draw(Canvas,0,0, ImageIndex); Canvas.Free; // Assigning metafile to GIF and saving gif.Assign(wmf); // Saving to Path + Bullets Prefix + ImageIndex + .gif Location := Format('%s%s%d.gif', [Path, Edit1.Text, ImageIndex]); gif.SaveToFile(Location); DoDefault := False; finally wmf.Free; gif.Free; end; end; end; end; ************************* I do not see where here there is a check if an image has already been saved, and what is more, > You can store additional information about image in the image name (like > that demo stores file names there), and save images yourself, using > OnHTMLSaveImage event. where does this demo store names? The only place is the Location, but as soon as the project is closed, the RVE is reloaded, Location does not contain the information I have put there. What I need is a place where I can store additional informatin for each image, and this place does not reset its contents each time the RVE is saved/loaded, so I can easily determine whether an image has been saved or not. And also, I saw that OnHTMLSaveImage is not fired when the background image is saved. Why??? --Slavi "Sergey Tkachenko" <[email protected]> wrote in message news:[email protected]... > Ok, I did not understand that you told about HTML export. > You can store additional information about image in the image name (like > that demo stores file names there), and save images yourself, using > OnHTMLSaveImage event. > Example of using of this event is in Demos\Delphi\Assorted\Save HTML and > Table Hypertext\ > > > > No..... the purpose is to upload the HTML that is generated, together > > with the .jpg-s. If I upload all the images each time, there will be > > lots of traffic. So, I would like to upload only images that I have not > > uploaded so far. Do you understand now? > > > > --Slavi > > > > > > Sergey Tkachenko wrote: > > > Do you want to share images among several documents? > > > If yes, look at this demo > > > http://www.trichview.com/support/files/sharedimages.zip > > > > > > > > > > > > |
Powered by ABC Amber Outlook Express Converter