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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 No Using Params on New Images

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Elemental Posted - Apr 25 2014 : 08:02:27
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
---------------------------
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 25 2014 : 17:23:41
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
w2m Posted - Apr 25 2014 : 16:11:53
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