T O P I C R E V I E W |
Flashcqxg |
Posted - Sep 26 2021 : 20:51:28 Is it normal to use the TextOut method of TImageEnProc to take about 240 milliseconds?
SW := TStopwatch.StartNew; Proce.TextOut(50, 50, 'SS', 'Times New Roman', MarkTextFontSize, clRed, [fsBold]); Memo1.Lines.Add(SW.ElapsedMilliseconds.ToString);
|
15 L A T E S T R E P L I E S (Newest First) |
Flashcqxg |
Posted - Sep 29 2021 : 22:53:09 This is good news. I will wait for the next version to be released before upgrading, thank you. |
xequte |
Posted - Sep 29 2021 : 22:46:33 Hi
We've added extra checking and if the image has no alpha channel (like your image) then we can make it around 8x faster. Please email me for the update.
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 29 2021 : 21:27:42 Thank you, hope there is a good solution. |
xequte |
Posted - Sep 29 2021 : 21:25:42 Hi
Your image works here, though is a little slow. I will investigate the code some more.
TEST 1... 1780 200 196 196 196 199 197 195 199 197 TEST 2... 229 215 216 216 217 213 216 216 230 213
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 29 2021 : 19:47:59 I don't think so, my test results on windows10 are as follows. You can use my test picture for testing, I uploaded it.
Memo1 TEST 1... 417 452 407 408 411 405 397 396 442 409 TEST 2... 414 401 466 378 346 349 339 332 359 374
 |
xequte |
Posted - Sep 29 2021 : 00:00:20 Hmm, it must be an issue in Windows 7. If you need to support Windows 7, you should use TCanvas.TextOut instead.
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 28 2021 : 23:46:16 Project1_32
TEST 1... 298 279 283 278 280 280 281 279 278 281 TEST 2... 314 297 299 295 297 299 295 294 295 296
Project1_64: TEST 1... 386 364 366 361 363 372 368 362 370 365 TEST 2... 393 380 384 383 383 396 384 381 385 384 |
xequte |
Posted - Sep 28 2021 : 23:41:02 Hi
Please try the EXE files in the following zip and let me know what timings you get:
www.imageen.com/temp/TextOutTest.zip
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 28 2021 : 23:22:08 Yes,i test with delphi 10.3.3+windows7 + ImageEn 10.2 |
xequte |
Posted - Sep 28 2021 : 23:19:19 Sorry, is this ImageEn 10.2.0?
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 27 2021 : 23:20:03 I found that the larger the picture, the slower the speed; the smaller the picture, the faster the speed. The image size I tested before was 3307*2339(316kb). Just now I tested a 4960*3508(588kb) image. The test results are as follows:
665 623 624 621 619 623 621 620 622 621 |
Flashcqxg |
Posted - Sep 27 2021 : 22:53:32 No any other code or ImageEn components in this test project. Delphi 10.3.2 and Windows 7 |
xequte |
Posted - Sep 27 2021 : 20:18:39 Hmmm, i cannot reproduce that.
249 20 20 20 21 21 21 21 21 21
What version of Delphi and Windows are you using? Is there any other code or ImageEn components in that test project?
Nigel Xequte Software www.imageen.com
|
Flashcqxg |
Posted - Sep 26 2021 : 21:23:08 Hi,my test:
procedure TForm1.Button1Click(Sender: TObject);
var
IO: TImageEnIO;
Proce: TImageEnProc;
I: Integer;
SW: TStopwatch;
begin
IO := TImageEnIO.Create(nil);
IO.Params.PDF_PaperWidth := 1190;
IO.Params.PDF_PaperHeight := 842;
Proce := TImageEnProc.CreateFromBitmap(IO.IEBitmap);
IO.LoadFromFileJpeg(ExtractFilePath(ParamStr(0)) + '1.JPEG');
try
for I := 1 to 10 do
begin
SW := TStopwatch.StartNew;
Proce.TextOut(50, 10 * I, 'SSS', 'Times New Roman', 35, clRed, [fsBold]);
Memo1.Lines.Add(SW.ElapsedMilliseconds.ToString);
end;
finally
IO.Free;
Proce.Free;
end;
end;
result: 294 267 267 268 268 265 267 268 270 267 |
xequte |
Posted - Sep 26 2021 : 21:05:14 Hi
TImageEnProc.TextOut actually uses GDI+ under the hood (for transparency and other features). The first time GDI+ is used it needs to be initialized which is slow, but subsequent calls should be much faster, for instance, when i tested your code five times, I got
200ms 1ms 1ms <1ms 1ms
If you want to avoid this, use TCanvas.TextOut instead.
Nigel Xequte Software www.imageen.com
|