function for copying a screen region
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!
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!
Thanks a lot! I haven't yet tackled this function! But I will submit the result, when ready.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center