Skip to content
Snippets Groups Projects
Commit c12b9a76 authored by Rene's avatar Rene
Browse files

searchForRect gibt jetzt das Rechteck zurück und die Ausgabe findet in der Main-funktion statt

parent 31ef44cc
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -20,6 +20,7 @@ typedef struct
{
int x, y;
int width, height;
Bool isFound;
} rectangle;
/* Deklarieren der Funktionen */
......@@ -48,6 +49,8 @@ int main (int argc, char **argv)
Window window;
Display *display;
XWindowAttributes win_info;
rectangle rect;
rect.isFound = False;
/* Display */
display = XOpenDisplay(NULL); //NULL Should refer to the root Window
......@@ -103,9 +106,13 @@ int main (int argc, char **argv)
searchColor = lookingForColorOnCoordinate(image, x, y);
colorParam = True;
}
if(colorParam) {
//searchForColorRect(searchColor, image, width,height);
searchForColorRectII(searchColor, image, width,height);
rect = searchForColorRectII(searchColor, image, width,height);
}
if(rect.isFound) {
printf("%d %d %d %d\n", rect.x, rect.y, rect.width, rect.height);
}
image->f.destroy_image(image);
......@@ -353,7 +360,9 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
} */
}
printf("%d %d %d %d\n", rect.x, rect.y, rect.width, rect.height);
if(foundColor) {
rect.isFound = True;
}
return rect;
}
......@@ -415,9 +424,7 @@ rectangle searchForColorRect (uint32_t color, XImage *image, unsigned width, uns
}
//printf("DEBUG: extracted color is %06" PRIx32 " and given color is %06" PRIx32 "\n", extractedColor, color);
}
if(foundColor) {
printf("%d %d %d %d\n", rect.x, rect.y, rect.width, rect.height);
}
return rect;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment