Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fehlersuche_U7
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Gräbner
Fehlersuche_U7
Commits
ecff83ee
Commit
ecff83ee
authored
18 years ago
by
siflfran
Browse files
Options
Downloads
Patches
Plain Diff
Rotation repariert
parent
6620f483
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
01_git/astime_x.c
+2
-5
2 additions, 5 deletions
01_git/astime_x.c
01_git/x_primitives.c
+13
-10
13 additions, 10 deletions
01_git/x_primitives.c
01_git/x_primitives.h
+4
-0
4 additions, 0 deletions
01_git/x_primitives.h
with
19 additions
and
15 deletions
01_git/astime_x.c
+
2
−
5
View file @
ecff83ee
...
...
@@ -208,8 +208,8 @@ void draw_sunriset(Window win,
x
,
y
,
width
,
height
,
0
*
64
,
359
*
64
);
return
;
}
angle1
=
(
int
)
r
ound
(
start
*
15
.
0
);
angle2
=
(
int
)
r
ound
(
end
*
15
.
0
);
angle1
=
(
int
)
r
int
(
start
*
15
.
0
);
angle2
=
(
int
)
r
int
(
end
*
15
.
0
);
angle2
-=
(
angle1
+
360
)
%
360
;
angle1
+=
loc_time
->
tm_gmtoff
*
0
.
004166667
;
if
(
state
.
counterclockwise
)
{
...
...
@@ -383,9 +383,6 @@ void draw_window(Window win)
state
.
lon
,
state
.
lat
,
civil_pix
,
SUNRISET_SIZE
,
CIVIL_TWILIGHT
);
draw_sunriset
(
win
,
loc_time
,
state
.
lon
,
state
.
lat
,
day_pix
,
SUNRISET_SIZE
,
SUNRISESET
);
XSetForeground
(
mainDisplay
,
mainGC
,
pix
[
0
]);
/*DrawTriangle(mainDisplay, win, mainGC, center.x, center.y, 300, 300,
loc_time->tm_sec * 6 * 64);*/
}
/* draw filled polygonal hands */
for
(
i
=
2
;
i
>=
0
;
i
--
)
{
...
...
This diff is collapsed.
Click to expand it.
01_git/x_primitives.c
+
13
−
10
View file @
ecff83ee
...
...
@@ -19,20 +19,21 @@ void RotateCoordinates(short *x, short *y, short center_x, short center_y,
void
RotateCoordinates
(
short
*
x
,
short
*
y
,
short
center_x
,
short
center_y
,
short
angle
)
{
double
r_angle
=
(
angle
/
64
)
%
360
*
(
M_PI
/
180
.
0
);
int
x_coord
=
x
[
0
],
y_coord
=
y
[
0
];
x
[
0
]
=
center_x
+
cos
(
r_angle
)
*
(
x_coord
-
center_x
)
-
sin
(
r_angle
)
*
(
y_coord
-
center_y
);
y
[
0
]
=
center_y
+
sin
(
r_angle
)
*
(
x_coord
-
center_x
)
-
cos
(
r_angle
)
*
(
y_coord
-
center_y
);
printf
(
"x = %d, y = %d
\n
"
,
x_coord
,
y_coord
);
double
r_angle
;
short
x_coord
,
y_coord
;
r_angle
=
(
angle
/
64
)
*
(
M_PI
/
180
.
0
);
x_coord
=
x
[
0
]
-
center_x
;
y_coord
=
y
[
0
]
-
center_y
;
x
[
0
]
=
center_x
+
rint
(
cos
(
r_angle
)
*
x_coord
+
sin
(
r_angle
)
*
y_coord
);
y
[
0
]
=
center_y
+
rint
(
-
sin
(
r_angle
)
*
x_coord
+
cos
(
r_angle
)
*
y_coord
);
}
void
CalculateTriangleCoordinates
(
XPoint
*
points
,
short
x
,
short
y
,
unsigned
short
width
,
unsigned
short
height
,
short
angle
)
{
points
[
0
].
x
=
x
-
width
/
2
;
points
[
0
].
x
=
x
-
(
width
/
2
)
;
points
[
0
].
y
=
y
;
points
[
1
].
x
=
x
+
width
/
2
;
points
[
1
].
x
=
x
+
(
width
/
2
)
;
points
[
1
].
y
=
y
;
points
[
2
].
x
=
x
;
points
[
2
].
y
=
y
+
height
;
...
...
@@ -41,10 +42,11 @@ void CalculateTriangleCoordinates(XPoint *points, short x, short y,
{
int
i
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
RotateCoordinates
(
&
points
[
i
].
x
,
&
points
[
i
].
y
,
x
,
y
,
angle
);
RotateCoordinates
(
&
(
points
[
i
].
x
)
,
&
(
points
[
i
].
y
)
,
x
,
y
,
angle
);
}
}
}
int
DrawTriangle
(
Display
*
display
,
Drawable
d
,
GC
gc
,
short
x
,
short
y
,
unsigned
short
width
,
unsigned
short
height
,
short
angle
)
...
...
@@ -53,6 +55,7 @@ int DrawTriangle(Display *display, Drawable d, GC gc,
CalculateTriangleCoordinates
(
points
,
x
,
y
,
width
,
height
,
angle
);
return
XDrawLines
(
display
,
d
,
gc
,
points
,
4
,
CoordModeOrigin
);
}
int
FillTriangle
(
Display
*
display
,
Drawable
d
,
GC
gc
,
short
x
,
short
y
,
unsigned
short
width
,
unsigned
short
height
,
short
angle
)
...
...
This diff is collapsed.
Click to expand it.
01_git/x_primitives.h
+
4
−
0
View file @
ecff83ee
...
...
@@ -2,6 +2,10 @@
* This software is distributed under GPL. For details see LICENSE file.
*/
#include
<X11/Xlib.h>
void
RotateCoordinates
(
short
*
x
,
short
*
y
,
short
center_x
,
short
center_y
,
short
angle
);
int
DrawTriangle
(
Display
*
display
,
Drawable
d
,
GC
gc
,
short
x
,
short
y
,
unsigned
short
width
,
unsigned
short
height
,
short
angle
);
...
...
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