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
 ImageEn problem (zoom with effects)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

leo

3 Posts

Posted - Apr 20 2012 :  13:19:58  Show Profile  Reply
Hello,

I found a problem in the component ImageEN. When apply an effect (operation) in the image, the viewer is zoomed or increase the zoom, at a certain time the image is all white or colors are lost.

To reproduce the problem, use the demo "Layer Editing" group "Image Editing Demos" and use the effect "Negation" or "MAX (Lighten)."
The demo is available in http://www.xequte.com/imageen/demos/ImageEditing/Layers/Layers.exe

I use Delphi XE2 Update3 with the operating system Windows 7 64Bit.

I detected this problem by using DICOM images with TImageEnVect. But it is possible to simulate any type of image and using the TImageEnView.

There is a solution (code) around this problem?

fab

1310 Posts

Posted - Apr 20 2012 :  15:19:11  Show Profile  Reply
Thank you!

The fix is in imageenview.pas unit, at TImageEnView.PaintToEx method, replace function SubDrawBackground with

procedure SubDrawBackground(force: boolean);
  var
    bHandledBG:boolean;
  begin
    if force or
       (fOffX > 0) or
       (fOffY > 0) or
       (frx < ABitmap.Width) or
       (fry < ABitmap.Height) or
       (fEnableAlphaChannel and lBitmap.HasAlphaChannel and (not lBitmap.AlphaChannel.Full)) or
       (IsFirst and (layer.Operation <> ielNormal)) or 
       (Transparency < 255) then
    begin
      if UpdRect <> nil then
      begin
        with UpdRect^ do
          IntersectClipRect(ABitmap.Canvas.Handle, left, top, right + 1, bottom + 1);
      end;
      bHandledBG:=false;
      if assigned(fOnDrawBackground) then
        fOnDrawBackground(self, ABitmap.Canvas, Rect(0, 0, ABitmap.Width, ABitmap.Height), bHandledBG);
      if bHandledBG=false then
        IEDrawBackground(ComponentState, ABitmap.Canvas, ABitmap.VclBitmap, fBackgroundStyle, fBackGround, 0, 0, ABitmap.Width, ABitmap.Height, fOffX, fOffY, fOffX + frx, fOffY + fry, fChessboardSize, fChessboardBrushStyle, fGradientEndColor, fWallPaper,fWallPaperStyle);
      SelectClipRgn(ABitmap.canvas.handle, 0);
    end;
  end;
Go to Top of Page

leo

3 Posts

Posted - Apr 22 2012 :  18:59:23  Show Profile  Reply
Ok Fabrizio, the fix worked. Thank you for quick resolution.

I have another problem. Using the same demo "Layer Editing", change the BackgroudStyle property to "iebsSolid," and the Background property to "clBlack."
When applying effects (operation), most of them are not applied.
To simulate, make changes and recompile the demo. Open any image, go on the "effects" and proceed by applying the operations available and see the result.
Sometimes the image is all black, and sometimes nothing happens.

I tested with the types of images "jpg" and "dicom".

Thanks.
Go to Top of Page

fab

1310 Posts

Posted - Apr 22 2012 :  23:36:21  Show Profile  Reply
It is normal. If background is "black" means it is composed by all zeros (0,0,0).
If you "Add" -> image:(A,B,C) + background:(0,0,0) = A,B,C, so it not changes
If you "Multiply" -> image:(A,B,C) * background:(0,0,0) = 0,0,0 all black
...etc...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: