[ Show ]
[ Shrink ]
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.)
Donate to VoyForums (PayPal):
[ Next Thread |
Previous Thread |
Next Message |
Previous Message ]
Date Posted: 10:53:14 03/05/02 Tue
Subject: Re: C++ Problem with Crop
In reply to:
's message, "C++ Problem with Crop" on 09:29:49 03/04/02 Mon
There is a few things I would look at here:
Before trying to obtain the TDibGraphic from TImage->Picture->Graphic make sure the graphic contained is really a TDibGraphic. For example, it may be a TBitmap loaded. To check this, save the return value of
TImage->Picture->Graphic.ClassName() to a variable and view it in the debugger. If it is not a class derived from TDibGraphic, make use you do "Add to Project" the EnReg.Pas unit to register the Envision formats. Also check the Envision.Inc file to enable the Envision bitmap support if desired.
TDibGraphic *Gr =new TDibGraphic();
You should create the appropriate TDibGraphic derived class, not the base TDibGraphic class, which does not implement LoadFromStream. Also, the NewImage call is not necessary because LoadFromStream will take care of setting the size.
Gr = new TBitmapGraphic();
for a BMP file.
Here is a better approach to crop the contents of a TImage->Picture->Graphic:
void __fastcall TForm1::CropBtnClick(TObject *Sender)
TDibGraphic* Graphic = dynamic_cast<TDibGraphic*>(Image->Picture->Graphic);
// Graphic is a TDibGraphic
TCropTransform* Transform = new TCropTransform;
Transform->Left = 20;
Transform->Right = 20;
Transform->Top = 20;
Transform->Bottom = 20;
>Hello I have a TImage and i want to
>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.
> TMemoryStream *strm=new TMemoryStream();
> TCropTransform *Transform = new TCropTransform();
> TDibGraphic *Gr =new TDibGraphic();
> Transform->Left =75;
> Transform->Right =75;
> Transform->Top =25;
> Transform->Bottom =25;
> delete Transform;
> delete Gr;
> delete strm;
Next Thread |
Previous Thread |
Next Message |
[ Contact Forum Admin ]
Forum timezone: GMT-5|
VF Version: 3.00b, ConfDB:
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.