<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<br>
Here is what I put together with the help of everyone =) I've also
added in it as a test code with Xlib to compare speeds and etc...
Posted the code at: http://pastebin.com/f34fa2d3f aswell for better
view.<br>
<br>
[CODE]<br>
<br>
<font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Author: Nadeem Syed</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Desc: Gets a color from the specified point(x, y) from the window id provided</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * @see http://lists.freedesktop.org/archives/xcb/2009-November/005343.html</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">// Standard</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <iostream></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <sys/time.h></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">// Xlib's</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <X11/Xlib.h></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">// XCB's</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <xcb/xcb.h></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <xcb/xproto.h></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#include <xcb/xcb_image.h></font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">#define WINDOW_ID_TO_USE 65011716</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">typedef struct BOUNDS {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint16_t x;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint16_t y;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint16_t width;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint16_t height;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">} BOUNDS;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">void GetColor(unsigned int color, bool useXCB);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">XImage* Xlib_GetImage(Window screen, BOUNDS &bounds);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">unsigned int Xlib_GetColor(int x, int y, XImage *img);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">int Xlib_CountColors(void);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">xcb_image_t* XCB_GetImage(xcb_window_t window, BOUNDS &bounds, uint8_t* &data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">unsigned int XCB_GetColor(int x, int y, xcb_image_t *img, uint8_t *data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">int XCB_CountColors(void);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/* </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return interval of time (uses time.h) </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">*/</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">double get_time (void) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> struct timeval timev; </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> gettimeofday(&timev, NULL);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">int main() {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> double start, xcbt, xlibt;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> start = get_time();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> GetColor(0, true);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcbt = get_time() - start;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> start = get_time();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> GetColor(0, false);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xlibt = get_time() - start;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "XCB GetColor Time = " << xcbt << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "Xlib GetColor Time = " << xlibt << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "--- Counting Colors ---" << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> start = get_time();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int xcb_count = 0;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int i = 0; i <= 19; i++)</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_count = XCB_CountColors();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcbt = (get_time() - start) / 19;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "XCB Colors Counted = " << xcb_count << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "XCB Time Took AVG = " << xcbt << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> start = get_time();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int xlib_count;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int i = 0; i <= 19; i++)</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xlib_count = Xlib_CountColors();</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xlibt = (get_time() - start) / 19;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "Xlib Colors Counted = " << xlib_count << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "Xlib Time Took AVG = " << xlibt << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return 0;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Gets color using the specified library. (true = XCB, false = Xlib)</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">void GetColor(unsigned int color, bool useXCB) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> if (!useXCB) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> BOUNDS bounds;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XImage *img = Xlib_GetImage(WINDOW_ID_TO_USE, bounds);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> unsigned int c = Xlib_GetColor(39, 39, img);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "Xlib Get Color = " << c << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> } else {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint8_t *data;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> BOUNDS bounds;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_image_t *img = XCB_GetImage(WINDOW_ID_TO_USE, bounds, data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> unsigned int c = XCB_GetColor(39, 39, img, data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> std::cout << "XCB Get Color = " << c << std::endl;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> }</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Xlib - Get Image</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">XImage* Xlib_GetImage(Window screen, BOUNDS &bounds) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XImage* bitmap;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> Display *display = XOpenDisplay(NULL);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XWindowAttributes attr;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XGetWindowAttributes(display, screen, &attr);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.x = attr.x;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.y = attr.y;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.width = attr.width - bounds.x;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.height = attr.height - bounds.y;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bitmap = XGetImage(display, screen, bounds.x, bounds.y, </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.width, bounds.height, AllPlanes, ZPixmap);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return bitmap;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Xlib - Get Color</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">unsigned int Xlib_GetColor(int x, int y, XImage *img) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> unsigned char* data = (unsigned char*)img->data;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int bpp = img->bits_per_pixel / 8;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int loc = (y * bpp * img->width) + (bpp * x);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return (data[loc] << 16) | (data[loc+1] << 8) | (data[loc+2]);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * Xlib - Count Colors</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">int Xlib_CountColors(void) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> BOUNDS bounds;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XImage *img = Xlib_GetImage(WINDOW_ID_TO_USE, bounds);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int color_count = 0;//bounds.width * bounds.height - 2;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int w = 0; w < bounds.width; w++) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int h = 0; h < bounds.height; h++) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> //std::cout << </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> Xlib_GetColor(w, h, img);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> color_count++;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> }</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> }</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return color_count;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * XCB - Get image</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">xcb_image_t* XCB_GetImage(xcb_window_t window, BOUNDS &bounds, uint8_t* &data) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_connection_t *c = xcb_connect(NULL, NULL);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_image_format_t format = XCB_IMAGE_FORMAT_Z_PIXMAP; </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(c, window);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(c, gcookie, NULL);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.x = greply->x;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.y = greply->y;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.width = greply->width - bounds.x;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.height = greply->height - bounds.y;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_get_image_cookie_t cookie = xcb_get_image(c, format, window, </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.x, bounds.y, </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> bounds.width, bounds.height, </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> ~0);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_get_image_reply_t *reply = xcb_get_image_reply(c, cookie, NULL);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> data = xcb_get_image_data(reply);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return xcb_image_create_native(c, greply->width, greply->height, format, </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> reply->depth, NULL, ~0, data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * XCB - Get Color</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">unsigned int XCB_GetColor(int x, int y, xcb_image_t *img, uint8_t *data) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int bpp = img->bpp / 8;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int loc = (y * bpp * img->width) + (bpp * x);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return (data[loc] << 16) | (data[loc+1] << 8) | data[loc+2];</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">/**</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> * XCB - Count Colors</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> */</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">int XCB_CountColors(void) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> uint8_t *data;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> BOUNDS bounds;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> xcb_image_t *img = XCB_GetImage(WINDOW_ID_TO_USE, bounds, data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> int color_count = 0;//bounds.width * bounds.height - 2;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int w = 0; w < bounds.width; w++) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> for (int h = 0; h < bounds.height; h++) {</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> //std::cout << </font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> XCB_GetColor(w, h, img, data);</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> color_count++;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> }</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> }</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1"> return color_count;</font><font style="font-size: 8pt;" size="1"><br>
</font><font style="font-size: 8pt;" size="1">}</font><br>
<br>
[/CODE]<br><br><br>-- Some of my results<br><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB GetColor Time = 0.0155019</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib GetColor Time = 0.0166171</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">--- Counting Colors ---</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Time Took AVG = 0.0175713</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Time Took AVG = 0.0190249</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB GetColor Time = 0.0114239</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib GetColor Time = 0.0141051</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">--- Counting Colors ---</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Time Took AVG = 0.0172025</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Time Took AVG = 0.020595</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Get Color = 2829099</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB GetColor Time = 0.0126981</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib GetColor Time = 0.013911</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">--- Counting Colors ---</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">XCB Time Took AVG = 0.0174001</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Colors Counted = 160321</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">Xlib Time Took AVG = 0.0196311</font><font style="font-size: 8pt;" size="1"><br><br><br></font>
<br>
~ Thanks<br>
                                           <br /><hr />Get a great deal on Windows 7 and see how it works the way you want. <a href='http://go.microsoft.com/?linkid=9691813' target='_new'>See the Windows 7 offers now.</a></body>
</html>