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
 How to draw a TIEBitmap to the canvas of TPaintbox
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

casual1001

2 Posts

Posted - Feb 19 2019 :  12:15:14  Show Profile  Reply
Hi, Anybody can help me the below question?

I assigned a bitmap to a TIEBitmap. And then process the TIEBitmap with chroma key effect. How to draw the result TIEBitmap to the canvas of TPaintBox with the chroma key effect?

Thanks

xequte

38611 Posts

Posted - Feb 19 2019 :  14:46:56  Show Profile  Reply
Hi

In the OnPaint event of the PaintBox, you just need to render the TIEBitmap to the canvas:

https://www.imageen.com/help/TIEBitmap.DrawToCanvas.html

Something like:

// trigger OnPaint event
PaintBox1.Paint();

procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
  MyChromaBitmap.DrawToCanvas( TPaintBox(Sender).Canvas, 0, 0 );
end;


Of course, that isn't scrollable, so you need to include a TScrollBox to allow scrolling (or just use a TImageEnView, of course )

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

casual1001

2 Posts

Posted - Feb 19 2019 :  20:58:04  Show Profile  Reply
Hi Nigel,

Thanks!

I did the same as your code. But there were two issues.

1. the alphachannel of TIEBitmap didn't work.

2. System raise an "Access Violation" Error.

By the way, I put the chroma key process in a thread circulation. After process a bitmap then make the paintbox invalidate to trigger the paint event every circulation.
Go to Top of Page

xequte

38611 Posts

Posted - Feb 19 2019 :  22:22:45  Show Profile  Reply
Hi

1. If you want Alpha use:

https://www.imageen.com/help/TIEBitmap.DrawToCanvasWithAlpha.html

2. You'd have to show me your code. If you are using threads, ensure you are synchronizing before communicating with the UI (i.e. TPaintBox).



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