Re: Optimize this code
DK <[email protected]> Thu, 21 Aug 2003 11:25:32 +0800 (CST)
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <[email protected]> |
If this code is what you mean, then the delta time between my old proc with this proc is insignificant. When I use this unit (with my old proc.) to process 85kB file in 24 bit bitmap 800x600, the average time required is 2600 ms (run on Duron 750, WinXP Pro, 256 MB) and when I use this proc the average time is about 2600 ms too. I think it's mainly because it still use pixels to access the color twice. Does the use of scanline will make bigger improvement? In this unit the color info is not accessed simultaneously in a row so I wonder if scanline can reduce the required time, isn't it? I don't know how to use DIB. Any example on how to use DIB will be appreciated so much. procedure TStegoStream.SetBit(Value: Integer); var Pos : integer; begin Pos := ColorPos * 8 + BitPos; Value := (Value and 1) Shl Pos; BMP.Canvas.Pixels[X, Y] := (BMP.Canvas.Pixels[X, Y] and not (1 shl Pos) or Value); NextBit; end; Forgive my horrible English Regards, DK Yahoo! Biztools - Promote your business from just $5 a month! [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM ---------------------------------------------------------------------~-> Delphi VCL Top Sites! http://www.sandbrooksoftware.com/TS/TS2/Components.shtml --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/