Results 1 to 7 of 7

Thread: Get Bitmap during Runtime

  1. #1
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default Get Bitmap during Runtime

    Hey.
    How do i get a bitmap that is at a ceratin location during runtime ?

    ~caused

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by caused View Post
    Hey.
    How do i get a bitmap that is at a ceratin location during runtime ?

    ~caused
    It could be done, however you would need to use SafeCopyCanvas();, read up on canvases

  3. #3
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    I had no idea on how to do it with copycanvas :'D.

    Anyone knows the trick ?.

    (Gotta read a bit about canvases anyway )

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by caused View Post
    I had no idea on how to do it with copycanvas :'D.

    Anyone knows the trick ?.

    (Gotta read a bit about canvases anyway )

    Well I would make a data type for Dest:TCanvas. Then I would get that location using the sx, sy parameters. I would then call it in run time by doing:

    SCAR Code:
    SafeCopyCanvas(GetClientCanvas, OurCanvas, parameters);
    Bitmap := 'blah here'

    If FindBitmap(Bitmap, x, y) Then //then call it

    If you need more help, then add me on MSN
    Last edited by Naum; 09-19-2012 at 11:34 AM.

  5. #5
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Yeah, i still dont get it.

    Could you write an example procedure ?.

    Basicly i dont understand where to copy the canvas to. Cause i want a bitmap as result :x..

    //added you btw

    ~caused

  6. #6
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function ExtractClientBitmap(area: TBox): integer;
    var
      dx, dy: integer;
    begin
      dx := area.x2 - area.x1; //Figure out our dimensions
      dy := area.y2 - area.y1;

      result := BitmapFromString(dx, dy, ''); //Create a blank bitmap

      try
        CopyClientToBitmap(result, area.x1, area.y1, area.x2, area.y2); //Copy desired area into bitmap
      except
        FreeBitmap(result); //If anything goes wrong, free the bitmap
        writeln('ExtractClientBitmap failed.');
      end;
    end;

    That should help
    Interested in C# and Electrical Engineering? This might interest you.

  7. #7
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Fantastic : D I got it now. thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •