Jump to content

Equivalent of Delphis "bmp.Scanline[x]


Myicq
 Share

Recommended Posts

I have a need to convert an old Delphi routine to AutoIT. Purpose is to convert a 1 bit (b/w) BMP image to a special format.

The delphi routine is essentially this:

//
// Delphi Code
//
// bmp is an image, in b/w
// f is a file for writing
// this is not complete code, only the core write routine.
//
    for x:=0 to bmp.Width-1 do

        begin

          byt:=x div 8;

          bit:=$80 shr (x mod 8);

          for y:=0 to bmp.Height div 32-1 do

          begin

            dw:=0;

            for c:=0 to 31 do

            begin

              data:=bmp.ScanLine[32*y+c];

              if (32*y+c<=bottom-top) and ((data[byt] and bit)=0) then dw:=dw or ($01 shl c);

            end;

            Write(f, b[0]);

            Write(f, b[1]);

            Write(f, b[2]);

            Write(f, b[3]);

          end;

        end;

      end;

I have several questions along these lines, both the bitshifting and the or'ing. But the most important one is: what will data contain after being assigned bmp.Scanline[32*y+c]. I can't really make sense of Delphi documentation. Of course I know what the purpose is, but as I am a novice in graphics stuff, I would like some pointers in the right direction.

Happy to answer any question.

 

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...