View Issue Details

IDProjectCategoryView StatusLast Update
0001958Lazarus-public2014-10-01 17:16
Reporteruser268Assigned Toyang jixian  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.15 (SVN) 
Summary0001958: TBitmap and Scanline simulation
DescriptionI have created many base image procesing functions using fast scanline method in Delphi. Now it is a problem to fast translate all the code to Lazarus, unless translation for TLazIntfImage doens't be finished. I also dobut of speed performance using TLazIntfImage.

It would be useful at least to allow simulation of scanline functionality in order to keep Delphi compatibility.

For example, a very fast 90 degree 32-bits rotation with Delphi code:

procedure SZRotateBmp90(Src, Dest: TBitmap);
var
  x, y : integer;
  dY : array of PDWORD; // Array for destination scanline
  sH, dH: integer; // Height variables
  P : PDWORD; // Source pointer
begin

  if Src.PixelFormat<> pf32bit then
     Src.PixelFormat := pf32bit;

  if Dest.PixelFormat<> pf32bit then
     Dest.PixelFormat := pf32bit;

  try
    Dest.Width := Src.Height;
    Dest.Height := Src.Width;

    sH:=Src.Height-1;
    dH:=Dest.Height-1;

    // Initialize dynamic array
    SetLength(DY,dH+1);

    // Save pointers to array for acceleration
    for y := 0 to dH do
      DY[y] := Dest.ScanLine[y];

    // Copy Src horizontal lines to be Dest vertical by +90 degree
    for y := 0 to sH do
    begin
      P:=Src.ScanLine[y];

      for x := dH downto 0 do
      begin
        Dy[x]^:=P^;

        inc(Dy[x]);
        inc(P);
      end;
    end;

  finally
    SetLength(DY,0);
  end;
end;
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

has duplicate 0009954 closedyang jixian TBitmap has no ScanLine property 
related to 0021764 resolvedMarc Weustink TBitmap.Scanline implementation 

Activities

user268

2011-01-19 11:00

  ~0045299

Over 2 years open and assigned. Is there any information of availability of this possibility? What exact problems are to "simulate" scanline?

Vincent Snijders

2011-01-19 11:13

manager   ~0045301

Maybe we should set it to acknowledge and un-assign the issue, then it can be open for another 2-3 years. :-)

user268

2011-01-19 12:25

  ~0045303

Last edited: 2011-01-19 12:27

Perhaps is better to close it as an "unreal" request and force all to use "The Lazarus way"...

Perhaps it is for a forum discussion, but in general, Lazarus have very slow development rate lately. Usually only lot of bug fixes, but releasing 1.0.0 seems far away from 3-5 years... How actually graph of active number of developers working on Lazarus comparing by years looking now? And the same on all platforms claims they are and will be covered?

Actually, in general I have strong impression interest for Lazarus and FPC (including Delphi and Pascal respectively) rapidly drops. Despite I'm senior Delphi programmer and mainly spent all my profession life programming in Pascal, I just only regret the situation is, thus time for Pascal passed long time ago...

Vincent Snijders

2011-01-19 12:46

manager   ~0045304

Yes, this is more for a forum discussion.

user268

2011-01-19 12:53

  ~0045305

Suggestion is still active - you can freely close the issue.

Flávio Etrusco

2011-01-21 08:37

developer   ~0045358

Maybe when FPC 2.6 is released with support for class helpers ;-)

user268

2011-01-22 04:24

  ~0045390

Interesting, Flavio. Can you be more specific about "initiative" (links, discussions)?

Sven Barth

2011-01-22 10:51

manager   ~0045394

@Flávio:
As I'm the one who is implementing class helpers: Do you have any specific ideas or examples regarding this issue? I'd like to test them with my current (unfinished) implementation.

Regards,
Sven

Marco van de Voort

2011-03-23 11:07

manager   ~0046765

Last edited: 2011-03-23 11:20

Sasa: rotation based on simple coordinate inversion is not fast. A 4x speed up is easily possible, see

http://stackoverflow.com/questions/848025/rotating-bitmaps-in-code

maybe even more for 32-bit.

Moreover, the number of bytes to jump from (x,y) to (x,y+1) is always constant in bitmaps (but can be negative). This value can be determined by subtracting scanline[1] and scanline[0]. Using this eliminates the need for the array. (see also the URL above. The rowpitch value is ptrint(scanline[1])-ptrint(scanline[0])

Under Delphi I use the following image class (generic):

http://www.stack.nl/~marcov/baseimagegen.pas which is fully detached from the GUI.

yang jixian

2011-03-28 10:32

developer   ~0046882

I prefer scanline too.

user268

2011-04-18 18:21

  ~0047572

Last edited: 2011-04-18 18:28

@Marco van de Voort

At windows and delphi I notice no significant difference moving by fixed pointer or indexed, also for specific task it requite no SSE and prefer no additional memory to store results for faster execution. Sample I gave is a compromise between speed and code simplicity.

@yang jixian

Waiting to see results. Thanks.

This also looks quite promising - BGRABitmap library:
http://sourceforge.net/projects/lazpaint/files/

yang jixian

2011-04-19 16:48

developer   ~0047610

From
https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/lazimageeditor
The DLBitmap.pas contains TDLBitmap which has a scanline property.

Reinier Olislagers

2014-10-01 10:25

developer   ~0077837

http://forum.lazarus.freepascal.org/index.php/topic,7914.msg158161.html#msg158161
seems to indicate TBitMap has a scanline property.

Is this true? Can this issue be closed?

Vojtech Cihak

2014-10-01 13:38

reporter   ~0077846

I tested with trunk on Qt. ScanLine is here and works.
It has to be used like this:
Bitmap.BeginUpdate;
//do some ScanLine job
Bitmap.EndUpdate;

IMO, this can be resolved.

Reinier Olislagers

2014-10-01 17:16

developer   ~0077856

Thanks for testing, Vojtech!

@reporter: Fixed in meantime. Please close if ok or reopen if not. Thank you

Issue History

Date Modified Username Field Change
2006-04-02 04:05 user268 New Issue
2006-04-02 04:05 user268 Widgetset => Win32
2006-04-02 06:10 Vincent Snijders Target => post 1.0
2006-04-02 06:10 Vincent Snijders Status new => acknowledged
2008-09-16 15:09 Vincent Snijders Status acknowledged => assigned
2008-09-16 15:09 Vincent Snijders Assigned To => Marc Weustink
2008-09-16 16:17 Vincent Snijders Relationship added has duplicate 0009954
2011-01-19 11:00 user268 Note Added: 0045299
2011-01-19 11:13 Vincent Snijders Note Added: 0045301
2011-01-19 12:25 user268 Note Added: 0045303
2011-01-19 12:27 user268 Note Edited: 0045303
2011-01-19 12:46 Vincent Snijders Note Added: 0045304
2011-01-19 12:53 user268 Note Added: 0045305
2011-01-21 08:37 Flávio Etrusco Note Added: 0045358
2011-01-22 04:24 user268 Note Added: 0045390
2011-01-22 10:51 Sven Barth Note Added: 0045394
2011-03-23 11:07 Marco van de Voort Note Added: 0046765
2011-03-23 11:08 Marco van de Voort Note Edited: 0046765
2011-03-23 11:17 Marco van de Voort Note Edited: 0046765
2011-03-23 11:20 Marco van de Voort Note Edited: 0046765
2011-03-28 10:27 yang jixian Assigned To Marc Weustink => yang jixian
2011-03-28 10:32 yang jixian Note Added: 0046882
2011-04-18 18:21 user268 Note Added: 0047572
2011-04-18 18:23 user268 Note Edited: 0047572
2011-04-18 18:28 user268 Note Edited: 0047572
2011-04-19 16:48 yang jixian Note Added: 0047610
2012-02-04 12:03 Zeljan Rikalo LazTarget post 1.0 => 1.2
2012-05-19 01:24 Juha Manninen Relationship added related to 0021764
2014-01-14 15:16 Martin Friebe LazTarget 1.2 => 1.4
2014-09-10 01:02 Juha Manninen LazTarget 1.4 => -
2014-10-01 10:25 Reinier Olislagers Note Added: 0077837
2014-10-01 13:38 Vojtech Cihak Note Added: 0077846
2014-10-01 17:16 Reinier Olislagers Note Added: 0077856
2014-10-01 17:16 Reinier Olislagers Status assigned => resolved
2014-10-01 17:16 Reinier Olislagers Resolution open => fixed