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
 Fastest Way to Create a Bitmap with Opaque Text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 14 2019 :  02:34:31  Show Profile  Reply
What is the fastest way to burn Opaque text into a bitmap. Have two lines of text and each is centered.

Regards,

John

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 14 2019 :  04:07:01  Show Profile  Reply
I use the following code but I get a message that GDI is not present on my machine???:

with TImageEnView.Create(nil) do
begin
Bitmap.Assign(bmp);
LayersAdd( 'test test 123', 22, clRed, DERFONT, [fsBold], IELayer_Pos_HCenter, IELayer_Pos_VCenter);
CurrentLayer.PosX := IELayer_Pos_HCenter;
CurrentLayer.PosY := IELayer_Pos_VCenter;
CurrentLayer.FillColor := clWhite;
CurrentLayer.BorderColor := clNone;
CurrentLayer.Opacity := 0.4;
LayersMergeAll();
bmp.Assign(bitmap);
Free;
end;
Go to Top of Page

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 14 2019 :  04:37:47  Show Profile  Reply
The specific error I get is:
'Cannot create TIECanvas. Ensure GDI+ is installed on system.'
I am running Windows 10, Imageen Version: 8.1.1
Go to Top of Page

xequte

6040 Posts

Posted - Jun 16 2019 :  16:10:34  Show Profile  Reply
Hi John

Sorry, our forum software does not support the @ symbol in URL's. It needs to be encoded (%40).

Which line generates the GDI+ error?

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

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 17 2019 :  21:06:57  Show Profile  Reply
Blows up at "Bitmap.Assign(bmp)

Works intermitantly

Thanks again,
Go to Top of Page

xequte

6040 Posts

Posted - Jun 18 2019 :  00:27:21  Show Profile  Reply
OK, don't use TImageEnView.Bitmap. It is only for legacy applications, and forces use of LegacyBitmap.

Please change your code to...

with TImageEnView.Create(nil) do
begin
  IEBitmap.Assign(bmp);
  ...
end;


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

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 19 2019 :  10:36:33  Show Profile  Reply
Works for several seconds then freezes app. or gives same error about GDI+ not installed.

How much slower are the more stable "TextOut" routines anyway ?

Go to Top of Page

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 19 2019 :  13:14:06  Show Profile  Reply
FYI: Am running this routine 15 times a second or so...
Go to Top of Page

xequte

6040 Posts

Posted - Jun 19 2019 :  15:42:33  Show Profile  Reply
Hi

I would not recommend creating and destroying a layer 15 times a second!

You would be better to use a TextOut routine, which calls the GDI routines directly.

But something that is used that frequently should be cached. TextOut to a iebitmap and draw that instead.

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

john_siggy@yahoo.com

USA
128 Posts

Posted - Jun 23 2019 :  13:42:04  Show Profile  Reply
Thanks for your response.

I am using TextOut to a TBitmap. Is this slower than TextOut to a TIEBitmap. No caching necessary ??
Go to Top of Page

xequte

6040 Posts

Posted - Jun 23 2019 :  21:09:11  Show Profile  Reply
Hi John

As you don't need transparency, Bitmap textout is fine. I should imagine the time is about the same as TIEBitmap GDI+ DrawString, or possibly a little faster due to less overhead.

Only you can decide if performance is acceptible without caching the drawn bitmap. Personally speaking for an operation repeated so frequently, I would cache it.

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