ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 No Using Params on New Images
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Elemental

USA
56 Posts

Posted - Apr 25 2014 :  08:02:27  Show Profile  Reply
When I handle the TImageEnMView.OnCreateImage event, I don't seem to be able to use Params on the new image. I get an Access Violation in the code below when setting TIFF_Compression.


procedure TForm1.ImageEnMView1CreateImage(Sender: TObject; idx: Integer);
begin
  ImageEnMView1.SelectedImage := idx;
  ImageEnMView1.Proc.ConvertToBWThreshold( 235 );
  ImageEnMView1.MIO.Params[ idx ].TIFF_Compression := ioTIFF_G4FAX;
  ImageEnMView1.MIO.Params[ idx ].BitsPerSample := 1;
  ImageEnMView1.MIO.Params[ idx ].SamplesPerPixel := 1;
end;


---------------------------
Debugger Exception Notification
---------------------------
Project IETests.exe raised exception class $C0000005 with message 'access violation at 0x00bce0c8: write of address 0x00000040'.
---------------------------
Break Continue Help
---------------------------

w2m

USA
1990 Posts

Posted - Apr 25 2014 :  16:11:53  Show Profile  Reply
I do not get exceptions in the OnCreateImage event, but you could also try OnBeforeDrawImage instead:

procedure TForm1.ImageEnMView1BeforeImageDraw(Sender: TObject; idx, Left,
  Top: Integer; Canvas: TCanvas);
begin
  ImageEnMView1.SelectedImage := idx;
  ImageEnMView1.Proc.ConvertToBWThreshold(235);
  ImageEnMView1.MIO.Params[idx].TIFF_Compression := ioTIFF_G4FAX;
  ImageEnMView1.MIO.Params[idx].BitsPerSample := 1;
  ImageEnMView1.MIO.Params[idx].SamplesPerPixel := 1;
end;

If this also fails, then I suspect the problem may be caused in another event in your app. Have you tried EurekaLog or MadExcept to pinpoint where the exception is raised?

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page

xequte

38615 Posts

Posted - Apr 25 2014 :  17:23:41  Show Profile  Reply
Hi

So it is failing on the line:

ImageEnMView1.MIO.Params[idx].TIFF_Compression := ioTIFF_G4FAX;

Is ImageEnMView1.MIO.Params[ idx ] nil at that point?


The other option is to batch set these params prior to saving. Put it all in a LockUpdate/UnlockUpdate for best performance.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: