VoyForums

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 12345[6]78910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 09:29:49 03/04/02 Mon
Author: Erik
Subject: C++ Problem with Crop

Hello I have a TImage and i want to
crop it.
I tried to do it similar like the sourcecode
of the delphi example.
I got several Memory errors when I tried to
map the TImage->Picture->Graphics to TDibGraphic.
I didnt find a solution for that so I tried to
solve the whole think using stream.
This worked fine except that the
TDibGraphic->Height and ->Width were zero
therefore the crop didnt work.

You would do me great favour if you could send
me a small C++ sniplet how to use it correctly.

Thanks

Erik



Image1->Picture->LoadFromFile(FileName);

TMemoryStream *strm=new TMemoryStream();
TCropTransform *Transform = new TCropTransform();
TDibGraphic *Gr =new TDibGraphic();
Image1->Picture->Graphic->SaveToStream(strm);
Gr->NewImage(320,280,ifTrueColor,0,0,0);
Gr->LoadFromStream(strm);

Transform->Left =75;
Transform->Right =75;
Transform->Top =25;
Transform->Bottom =25;
Transform->ApplyOnDest(Gr,Gr);
Gr->SaveToStream(strm);
Image1->Picture->Graphic->LoadFromStream(strm);
delete Transform;
delete Gr;
delete strm;

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.