Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dyncam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rene Kolling
dyncam
Commits
31ef44cc
Commit
31ef44cc
authored
Apr 3, 2021
by
Rene
Browse files
Options
Downloads
Patches
Plain Diff
Einfügen des -help command
parent
41caa85c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dyncam
+0
-0
0 additions, 0 deletions
dyncam
dyncam.c
+53
-5
53 additions, 5 deletions
dyncam.c
with
53 additions
and
5 deletions
dyncam
+
0
−
0
View file @
31ef44cc
No preview for this file type
This diff is collapsed.
Click to expand it.
dyncam.c
+
53
−
5
View file @
31ef44cc
...
@@ -38,6 +38,10 @@ int main (int argc, char **argv)
...
@@ -38,6 +38,10 @@ int main (int argc, char **argv)
{
{
evaluateArguments
(
argc
,
argv
);
evaluateArguments
(
argc
,
argv
);
if
(
debug
)
{
printf
(
"running in debug mode!
\n
"
);
}
unsigned
width
,
height
;
unsigned
width
,
height
;
int
screenID
;
int
screenID
;
XImage
*
image
;
XImage
*
image
;
...
@@ -65,8 +69,8 @@ int main (int argc, char **argv)
...
@@ -65,8 +69,8 @@ int main (int argc, char **argv)
Bool
picked
=
False
;
Bool
picked
=
False
;
if
(
pickColor
)
{
if
(
pickColor
)
{
while
(
!
picked
)
{
while
(
!
picked
)
{
XNextEvent
(
display
,
&
ev
);
printf
(
"select a color!
\n
"
);
printf
(
"select a color!
\n
"
);
XNextEvent
(
display
,
&
ev
);
if
(
ev
.
type
==
ButtonPress
)
{
if
(
ev
.
type
==
ButtonPress
)
{
x
=
ev
.
xbutton
.
x
;
x
=
ev
.
xbutton
.
x
;
y
=
ev
.
xbutton
.
y
;
y
=
ev
.
xbutton
.
y
;
...
@@ -116,13 +120,27 @@ void evaluateArguments (int argc, char **argv)
...
@@ -116,13 +120,27 @@ void evaluateArguments (int argc, char **argv)
#define OPTION argv[0]
#define OPTION argv[0]
#define NEXTOPT ++argv, --argf>0
#define NEXTOPT ++argv, --argf>0
{
{
const
char
*
argt
=
argv
[
0
];
#define PROGRAMNAME argt
int
argf
=
ARG
;
int
argf
=
ARG
;
while
(
NEXTOPT
)
while
(
NEXTOPT
)
{
{
if
(
!
strcmp
(
OPTION
,
"-help"
))
{
printf
(
"Usage: %s [OPTION]...
\n
Search for a Rectangle pattern with a specific color return the startpixel and the width and height.
\n
%s
\n
"
,
PROGRAMNAME
,
"return-pattern is [x y width height] while x and y are the topleft corner of the rectangle"
);
printf
(
"viable Options are
\n
%s
\n
%s
\n
%s
\n
%s
\n
"
,
"-c, -color color Searches the window for a specific color in hex RGB type. For Example -color ff39ad"
,
"-f, -find x y returns the value of the color on that pixel and atfer that works like -color"
,
"-p, -pick let you pick a specific color with your mouse cursor and works just like -color after picking. Excludes -find and -color"
,
"-debug gives extra output messages
\n
"
);
exit
(
0
);
}
if
(
!
strcmp
(
OPTION
,
"-debug"
))
if
(
!
strcmp
(
OPTION
,
"-debug"
))
{
{
debug
=
True
;
debug
=
True
;
printf
(
"running in debug mode!
\n
"
);
continue
;
continue
;
}
}
...
@@ -200,8 +218,8 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
...
@@ -200,8 +218,8 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
rectangle
rect
;
rectangle
rect
;
int
count
=
0
;
int
count
=
0
;
uint32_t
extractedColor
;
uint32_t
extractedColor
;
int
*
countX
=
malloc
(
sizeof
(
int
)
*
width
);
int
*
countY
=
malloc
(
sizeof
(
int
)
*
height
);
int
*
countY
=
malloc
(
sizeof
(
int
)
*
height
);
int
*
countX
=
malloc
(
sizeof
(
int
)
*
width
);
Bool
foundColor
=
False
;
Bool
foundColor
=
False
;
for
(
int
i
=
0
;
i
<
width
;
i
++
)
for
(
int
i
=
0
;
i
<
width
;
i
++
)
...
@@ -262,6 +280,35 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
...
@@ -262,6 +280,35 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
}
}
}
}
/* Testscript */
/*
int *amount;
int *temp;
int entrys = 0;
for (int i = 0; i < width; i++)
{
if(countX[i] == 0)
continue;
realloc(amount, sizeof(int) * entrys);
realloc(temp,sizeof(int) * entrys);
temp[entrys] = countX[entrys];
for (int j = i; j < width - i; j++) {
if (countX[i] == countX[j])
{
amount[i]++;
}
}
}
*/
rowMiddle
=
(
rowMax
-
rowMin
)
/
2
;
rowMiddle
=
(
rowMax
-
rowMin
)
/
2
;
columnMiddle
=
(
columnMax
-
columnMin
)
/
2
;
columnMiddle
=
(
columnMax
-
columnMin
)
/
2
;
...
@@ -435,6 +482,7 @@ unsigned long extractIntFromString(char *intString) {
...
@@ -435,6 +482,7 @@ unsigned long extractIntFromString(char *intString) {
void
throwError
(
char
*
errorMSG
)
{
void
throwError
(
char
*
errorMSG
)
{
fprintf
(
stderr
,
"ERROR: %s
\n
"
,
errorMSG
);
fprintf
(
stderr
,
"ERROR: %s
\n
"
,
errorMSG
);
printf
(
"Use -help for more Informations!
\n
"
);
exit
(
0
);
exit
(
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment