VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

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.