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
 Rotate Background Color issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
42 Posts

Posted - Jan 17 2017 :  14:49:27  Show Profile  Reply


I'm call this method

TImageEnProc.Rotate(AAngle, False, ierFast, clWhite);

But it doesn't seem to respect the backround color of clWhite. The rotate occurs correctly but the new regions generated by rotate are filled with Black.



jp

xequte

38611 Posts

Posted - Jan 19 2017 :  04:20:50  Show Profile  Reply
Hi Jeff

Are you connected to an TImageEnView? i.e. ImageEnView1.Rotate(AAngle, False, ierFast, clWhite);

Is it a full color image? Can you attach it for testing?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Jan 19 2017 :  09:49:09  Show Profile  Reply
No I'm not. Why won't this work.

function IMG_DeskewDib(HDib: Integer; AAngle: Double = -1): Cardinal;
var
  H1, W1, H2, W2: Integer;
  B: TIEBitmap;
  P: TImageEnProc;
  AFlag: Boolean;
begin
  Result := HDib;
  try
    B := TIEBitmap.Create;
    P := TImageEnProc.CreateFromBitmap(B);
    try
      B.CopyFromDIB(HDib);
      H1 := B.Height;
      W1 := B.Width;
      AFlag := (AAngle = -1);
      if AFlag then AAngle := P.SkewDetectionFine(0, 0.1, 10, False);
      if (Abs(AAngle) > 0) then
      begin
        P.Rotate(AAngle, False, ierFast, clWhite);
        if AFlag then B.Resize(W1, H1);
        P.Update;
      end;
      Result := B.CreateDIB;
      GlobalFree(HDib);
    finally
      B.Free;
      P.Free;
    end;
  except end;
end;


jp
Go to Top of Page

xequte

38611 Posts

Posted - Jan 19 2017 :  18:26:02  Show Profile  Reply
Hi

I tried to reproduce as follows:

procedure Tfmain.Button1Click(Sender: TObject);
const
  AAngle = 45;
var
  H1, W1, H2, W2: Integer;
  B: TIEBitmap;
  P: TImageEnProc;
  AFlag: Boolean;
begin
  try
    B := TIEBitmap.Create;
    P := TImageEnProc.CreateFromBitmap(B);
    try
      B.Read( 'D:\bmpout.bmp' );

      if (Abs(AAngle) > 0) then
      begin
        P.Rotate(AAngle, False, ierFast, clWhite);;
        P.Update;
      end;
      B.Write( 'D:\bmpout_Save.bmp' );

    finally
      B.Free;
      P.Free;
    end;
  except end;
end;


The background was set correctly as white.

I suspect the issue is the nature of the image you are processing, or that what you consider as "Black" is actually alpha, and the display app does not support Alpha.

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: