function for copying a screen region


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: function for copying a screen region

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    3

    function for copying a screen region

    Hello all,

    Can you help me with writing a function which copies a screen region. There is a screen with the dimension of Width x Height pixels. Each pixel is stored
    on 1 byte (0x00 is white, OxFF is black, etc. ) , The pixels are stored linearly in the video memory, starting with the upper-left corner of the screen.
    I need to write the following function:

    void CopyScreenRegion (unsigned char *screen,
    int sx, int sy, int sW, int sH,
    int dx, int dy)

    that copies a screen region starting at ( s x , sy) coordinates and has the (sW, s H )
    dimensions to the coordinated given by (dx, dy) .



    2. The screen is filled with black and white images. I will need an additional method that finds the longest horizontal or vertical black line of pixels in
    the screen and returns its dimension, type (horizontal or vertical ) and its starting address.

    Thank you very much for your help!

  2. #2
    Join Date
    Dec 2003
    Posts
    3,366
    your api should be used to talk to vid memory and likely it has a copy region, at least for rectangles.

    2 .. I suggest de-rez (reduce to about 1/8 the starting size -- something that divides evenly in both directions --) (should also be possible using fast api functions) and THEN find the longest. There is little to do here beyond iterating over all the pixels, however if you are clever you can do it just the once maintaining a count in both dimensions. If you *ever* find one that is all the way across you are done!

  3. #3
    Join Date
    Jul 2005
    Posts
    3
    Thanks a lot! I haven't yet tackled this function! But I will submit the result, when ready.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center