wmglobe: Update to version 1.3.
From https://github.com/d-torrance/dockapps/pull/6
This commit is contained in:
parent
23019d9278
commit
cb7b362149
|
@ -1,4 +1,27 @@
|
|||
VMGlobe
|
||||
|
||||
1.3 released 12/08/01
|
||||
- solve bug of custom map loading (now all maps are 3 layers RGB)
|
||||
- default -bord is now 2
|
||||
- accept a night map of different size than the day map
|
||||
- new -defnimap option
|
||||
- a few minor changes
|
||||
|
||||
1.2 released 9/04/2000
|
||||
- WindowMaker 0.62 compliancy
|
||||
|
||||
1.1 not released
|
||||
- another floating point exception bug solved (Alpha)
|
||||
- little optimizations and rewriting in rend.c
|
||||
- -sun option
|
||||
- -moon option
|
||||
- -mk marker option
|
||||
|
||||
1.0 released 30/05/99
|
||||
- option -stable : latitude never change of sign
|
||||
- change email to jerome.dumonteil@linuxfr.org
|
||||
- modify a few typo in doc
|
||||
|
||||
0.5 released 6/02/99
|
||||
- floating point exception bug solved
|
||||
- many minor bugs solved (earth displaying, mouse, time management)
|
||||
|
@ -22,14 +45,14 @@ VMGlobe
|
|||
- shift+left button : change longitude & latitude
|
||||
- man page
|
||||
|
||||
0.3.1 released 5/02/99
|
||||
0.3.1 released 5/01/99
|
||||
- option -austral
|
||||
- solved bug about colors 24 and 32 bit per pixel
|
||||
|
||||
0.3 released 3/02/99
|
||||
0.3 released 3/01/99
|
||||
- right button : screen of digital modification of latitude/long.
|
||||
|
||||
0.2.1 released 3/02/99
|
||||
0.2.1 released 3/01/99
|
||||
- change & enhance mouse operations (longitude/latitude/zoom)
|
||||
- minor bugs, CPU optimization
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
WMGlobe 0.5 - The Whole Earth spinning on you desktop... as a dockable app
|
||||
Copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
WMGlobe 1.3 - The Whole Earth spinning on you desktop... as a dockable app
|
||||
Copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
This program is licensed under the terms of the GNU GPL, see below.
|
||||
|
||||
|
||||
|
@ -10,7 +10,6 @@ WMGlobe is a WindowMaker dock.app that displays the earth on an icon. It's
|
|||
an adaptation of XGlobe to WMaker environnement. WMGlobe uses a map which is
|
||||
rendered on a sphere by raytracing. Yes, for a 64x64 pixel result :-)
|
||||
|
||||
It's still a beta version...
|
||||
|
||||
|
||||
|
||||
|
@ -19,10 +18,10 @@ Installation
|
|||
You need WindowMaker to build WMGlobe. WMGlobe needs libwraster to compile,
|
||||
this lib is built by WindowMaker. No more need at run time if statically
|
||||
linked, but then, you need WindowMaker to get the full magic :-)
|
||||
Warning : this version won't work with WindowMaker < 0.62
|
||||
|
||||
|
||||
tar -xvzf wmglobe-0.5.tar.gz
|
||||
cd wmglobe-0.5
|
||||
tar -xvzf wmglobe-1.3.tar.gz
|
||||
cd wmglobe-1.3
|
||||
make
|
||||
|
||||
then move wmglobe in /usr/local/bin and man page somewhere or do
|
||||
|
@ -34,20 +33,23 @@ If it doesn't work, look for the graphic libraries.
|
|||
|
||||
The Makefile is quite crude...
|
||||
|
||||
WMGlobe is developped on Linux (WMaker 0.51.0 and linux 2.0.36/ix86).
|
||||
WMGlobe is developped on Linux (WMaker 0.65.1 and linux 2.4.x/ix86).
|
||||
If you are successful on other platforms, please tell me so.
|
||||
|
||||
|
||||
platforms with successfull built reported :
|
||||
platforms with successfull built reported (wmglobe 1.0 for older WMaker):
|
||||
|
||||
NetBSD 1.3.2 / SPARC (wmaker 0.20.3) , with Makefile adaptations for libs
|
||||
Linux 2.0.36 / RedHat 5.1
|
||||
Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif
|
||||
Linux 2.0.36 / RedHat 5.2 (wmaker 0.53)
|
||||
Linux 2.2.0-pre4 / Debian :-)
|
||||
FreeBSD-3.0 with -ltiff -> -ltiff34 and -lungif -> -lgif
|
||||
Solaris 2.6 / Sun Sparc (wmaker 0.20.3) , with Makefile adaptations for libs
|
||||
AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2)
|
||||
|
||||
Linux 2.3.14 / Mandrake (wmaker but also blackbox !)
|
||||
LinuxPPC 1999
|
||||
Linux 2.2.10 / Alpha (wmglobe 1.1+)
|
||||
|
||||
|
||||
RPM & DEBIAN linux packages coming soon. Or you can directly use the binary.
|
||||
|
@ -62,10 +64,14 @@ and graphics libs, or install a rpm version of wmglobe.
|
|||
libwraster :
|
||||
WindowMaker 0.20.3 uses a libwraster.a , so if you use it, you can execute
|
||||
the binary on a computer without WindowMaker on it, and displaying on a
|
||||
remote computer (this one using WindowMaker). WM 0.51.0 creates a dynamic
|
||||
remote computer (this one using WindowMaker). WM > 0.51.0 creates a dynamic
|
||||
libwraster.so, so it's necessary to have it on the computer running wmglobe
|
||||
if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3
|
||||
and 0.51.0
|
||||
For wmglobe 1.2+, you need WMaker 0.62 or more recent. And wmglobe 1.0 won't
|
||||
run on these recent versions of WindowMaker. You need to have wraster.h
|
||||
in the include path to compile wmglobe.
|
||||
For wmglobe 1.3+, you probably need WMaker 0.64 or more recent.
|
||||
|
||||
graphic libs :
|
||||
you can use libgif or libungif. If your version of WindowMaker is built
|
||||
|
@ -81,12 +87,14 @@ make: *** [wmglobe] Error 1
|
|||
compile time options :
|
||||
You can modify the file wmgoption.h where many options are set up in defines :
|
||||
|
||||
To disable the builtin default map, just comment out the line in wmgoptions.h :
|
||||
To disable the builtin default map, just comment out the line in wmgoptions.h
|
||||
#define DEFMAPOK
|
||||
to supprim the shift+left/left method of rotate earth, uncomment the lines
|
||||
to remove the shift+left/left method of rotate earth, uncomment the lines
|
||||
#define MOUSE_LAT_FULL
|
||||
|
||||
you can also suppress some options screen in wmgoption.h
|
||||
you can also suppress some options screen in wmgoption.h (or even suppress
|
||||
new features of wmglobe 1.2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -101,8 +109,7 @@ You can get maps usable with WMGlobe on the net. See the LINKS chapter.
|
|||
using custom maps :
|
||||
- For the image to be mapped correctly, position 0°North 0°West must be in
|
||||
the center of the image and the latitude must be linear from 90°N to 90°S.
|
||||
- When using a night map, make sure that day and night map have the same
|
||||
dimensions.
|
||||
- You can safely use a night map of different size than the day map.
|
||||
|
||||
By the way, you can use maps of Mars, Luna ... and text.
|
||||
|
||||
|
@ -123,11 +130,16 @@ Configuration is done through command line options.
|
|||
the sun rotation. Accepted values in the form
|
||||
45°12'36 or 45.21 or 45:12:36
|
||||
Default : the initial position is "under" the sun, and
|
||||
the point of view follows the sun
|
||||
the point of view follows the sun.
|
||||
|
||||
-sun The point of view follows the Sun (default).
|
||||
|
||||
-moon The point of view follows the Moon (i.e. you see the
|
||||
Earth as you were on the Moon).
|
||||
|
||||
-rand New random position at every refresh of screen
|
||||
|
||||
-map map_file Map used for the rendering. Can be JPEG, GIG, XPM
|
||||
-map map_file Map used for the rendering. Can be JPEG, GIF, XPM
|
||||
PNM, TIFF but none BMP
|
||||
Default : use internal map of earth.
|
||||
|
||||
|
@ -135,8 +147,8 @@ Configuration is done through command line options.
|
|||
the same width x height as the day side map.
|
||||
Default : if the default internal day map is used, use
|
||||
a default internal night file (see -nonimap option).
|
||||
If a custom day map is provided, and no night map, the
|
||||
dark side is computed via the -light option.
|
||||
|
||||
-defnimap Use the default night map (with a custom map).
|
||||
|
||||
-nonimap Don't use the default night map.
|
||||
|
||||
|
@ -183,11 +195,19 @@ Configuration is done through command line options.
|
|||
Negative values for dates before 1970 accepted.
|
||||
Default : not set, use current time.
|
||||
|
||||
-mk latitude long. Put a fixed marker at latitude/longitude.
|
||||
-mk sun : put a marker under the Sun position.
|
||||
-mk moon : put a marker under the Moon.
|
||||
5 markers can be defined simultaneously, so you can
|
||||
use wmglobe to predict when Moon will meet the Sun :-)
|
||||
|
||||
-fun dx dy Move the earth image by dx dy pixels in the icon. See
|
||||
puzzle.sh to understand why.
|
||||
|
||||
-oz Start in "austral" mode (for "down under" people)
|
||||
|
||||
-stable Keep the globe from going over the poles.
|
||||
|
||||
-d display Select another display
|
||||
|
||||
-w -shape Useless, since it is set by default (WMaker dockable
|
||||
|
@ -223,10 +243,10 @@ http://www.bensinclair.com/dockapp/
|
|||
Links : Where to find maps and similar softs
|
||||
--------------------------------------------
|
||||
where to find the sources of wmglobe :
|
||||
http://www.capway.com/dumonte1/wm/wmglobe-0.5.tar.gz
|
||||
http://perso.linuxfr.org/jdumont/wmg/wmglobe-1.0.tar.gz
|
||||
|
||||
the web page of WMGlobe (made by Sylvestre Taburet) :
|
||||
http://www.capway.com/dumonte1/wm/wmg.html
|
||||
http://perso.linuxfr.org/jdumont/wmg/
|
||||
|
||||
|
||||
where to find maps and similar softs :
|
||||
|
@ -272,9 +292,11 @@ interesting. It also has a rather high resolution.
|
|||
|
||||
Todo
|
||||
----------------------------------------
|
||||
- add interface module to allow plugins
|
||||
- test on different platforms, better makefile
|
||||
- changing map "on the fly", map generator, clouds generator...
|
||||
- must work on every current WindowMaker platform
|
||||
- must work on every current WindowMaker platform (hug...)
|
||||
- rewrite some ugly things in the code
|
||||
- see how to minimize CPU load
|
||||
- feature : load a local detailed map of some part of the globe when zooming
|
||||
(country maps, city maps)
|
||||
|
@ -284,6 +306,7 @@ Todo
|
|||
|
||||
Bugs
|
||||
----------------------------------------
|
||||
- Wmglobe depends on WindowMaker version
|
||||
- The Makefile
|
||||
- if you use the --enable-single-icon compile time option of WindowMaker,
|
||||
you can not display more than one WMGlobe.
|
||||
|
@ -291,22 +314,25 @@ Bugs
|
|||
and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
|
||||
when the date go over year 2038. The expected result is wmglobe
|
||||
continuing smoothly from 1901.
|
||||
|
||||
- Using WMGlobe at high speed through a LAN may induce some load on the net.
|
||||
|
||||
|
||||
License
|
||||
----------------------------------------
|
||||
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through
|
||||
the GNU General Public License.
|
||||
WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed
|
||||
through the GNU General Public License.
|
||||
Read the COPYING file for the complete GNU license.
|
||||
|
||||
|
||||
|
||||
Credits
|
||||
----------------------------------------
|
||||
Original idea, tests, logos : Sylvestre Taburet <staburet@consort.fr>
|
||||
Original idea, tests, logos : Sylvestre Taburet <Sylvestre.Taburet@free.fr>
|
||||
|
||||
WindowMaker 0.62 fix : Charles G Waldman <cgw@fnal.gov>
|
||||
|
||||
The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
|
||||
(Actually, it uses now the 1.1 version of Xearth)
|
||||
|
||||
/*
|
||||
* sunpos.c
|
||||
|
@ -343,7 +369,7 @@ Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker
|
|||
Feedback
|
||||
----------------------------------------
|
||||
For your questions, bugs, remarks, please contact our representative on
|
||||
planet Earth : jerome dumonteil <jerome.dumonteil@capway.com>
|
||||
planet Earth : jerome dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ else
|
|||
WMG="nice wmglobe"
|
||||
fi
|
||||
|
||||
HOP=" -delay 0.1 -pos -25 10 -dlat 0.5 -dlong -5 -zoom 1.8 -accel 240"
|
||||
HOP=" -bord 0 -delay 0.1 -pos -25 10 -dlat 0.5 -dlong -5 -zoom 1.8 -accel 240 -stable"
|
||||
|
||||
$WMG $HOP -fun 32 32 &
|
||||
$WMG $HOP -fun -32 32 &
|
||||
$WMG $HOP -fun 32 -32 &
|
||||
$WMG $HOP -fun -32 -32 &
|
||||
$WMG -map ./wmgmap.gif -delay 0.05 -dlong 25 -pos 0 0 -accel 10000&
|
||||
[ -f wmgmap.jpeg ] && $WMG -nimap ./wmgmap.jpeg -delay 0.05 -dlat 2 -dlong -20 -pos 0 -20 -accel 21600 -zoom 0.85 -dawn 0 -stable &
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* mycontext.c - an adaptation of wrlib for use in wmglobe
|
||||
* initial source taken in WindowMaker-0.20.3/wrlib :
|
||||
*/
|
||||
|
@ -42,13 +42,13 @@
|
|||
* #include "wraster.h"
|
||||
*/
|
||||
|
||||
static Bool bestContext(Display * dpy, int screen_number, RContext * context);
|
||||
static Bool bestContext(Display * dpy, int screen_number,
|
||||
RContext * context);
|
||||
|
||||
static RContextAttributes DEFAULT_CONTEXT_ATTRIBS =
|
||||
{
|
||||
static RContextAttributes DEFAULT_CONTEXT_ATTRIBS = {
|
||||
RC_DefaultVisual, /* flags */
|
||||
0, /* render_mode */
|
||||
0, /* colors_per_channel */
|
||||
3, /* colors_per_channel */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -57,8 +57,7 @@ static RContextAttributes DEFAULT_CONTEXT_ATTRIBS =
|
|||
};
|
||||
|
||||
|
||||
static XColor *
|
||||
allocatePseudoColor(RContext * ctx)
|
||||
static XColor *allocatePseudoColor(RContext * ctx)
|
||||
{
|
||||
XColor *colors;
|
||||
XColor avcolors[256];
|
||||
|
@ -71,7 +70,8 @@ static XColor *
|
|||
|
||||
if (ncolors > (1 << ctx->depth)) {
|
||||
/* reduce colormap size */
|
||||
cpc = ctx->attribs->colors_per_channel = 1 << ((int) ctx->depth / 3);
|
||||
cpc = ctx->attribs->colors_per_channel =
|
||||
1 << ((int) ctx->depth / 3);
|
||||
ncolors = cpc * cpc * cpc;
|
||||
}
|
||||
assert(cpc >= 2 && ncolors <= (1 << ctx->depth));
|
||||
|
@ -83,8 +83,9 @@ static XColor *
|
|||
}
|
||||
i = 0;
|
||||
|
||||
if ((ctx->attribs->flags & RC_GammaCorrection) && ctx->attribs->rgamma > 0
|
||||
&& ctx->attribs->ggamma > 0 && ctx->attribs->bgamma > 0) {
|
||||
if ((ctx->attribs->flags & RC_GammaCorrection)
|
||||
&& ctx->attribs->rgamma > 0 && ctx->attribs->ggamma > 0
|
||||
&& ctx->attribs->bgamma > 0) {
|
||||
double rg, gg, bg;
|
||||
double tmp;
|
||||
|
||||
|
@ -101,13 +102,16 @@ static XColor *
|
|||
colors[i].flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
tmp = (double) colors[i].red / 65536.0;
|
||||
colors[i].red = (unsigned short) (65536.0 * pow(tmp, rg));
|
||||
colors[i].red =
|
||||
(unsigned short) (65536.0 * pow(tmp, rg));
|
||||
|
||||
tmp = (double) colors[i].green / 65536.0;
|
||||
colors[i].green = (unsigned short) (65536.0 * pow(tmp, gg));
|
||||
colors[i].green =
|
||||
(unsigned short) (65536.0 * pow(tmp, gg));
|
||||
|
||||
tmp = (double) colors[i].blue / 65536.0;
|
||||
colors[i].blue = (unsigned short) (65536.0 * pow(tmp, bg));
|
||||
colors[i].blue =
|
||||
(unsigned short) (65536.0 * pow(tmp, bg));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -181,8 +185,7 @@ static XColor *
|
|||
}
|
||||
|
||||
|
||||
static XColor *
|
||||
allocateGrayScale(RContext * ctx)
|
||||
static XColor *allocateGrayScale(RContext * ctx)
|
||||
{
|
||||
XColor *colors;
|
||||
XColor avcolors[256];
|
||||
|
@ -199,7 +202,8 @@ static XColor *
|
|||
} else {
|
||||
if (ncolors > (1 << ctx->depth)) {
|
||||
/* reduce colormap size */
|
||||
cpc = ctx->attribs->colors_per_channel = 1 << ((int) ctx->depth / 3);
|
||||
cpc = ctx->attribs->colors_per_channel =
|
||||
1 << ((int) ctx->depth / 3);
|
||||
ncolors = cpc * cpc * cpc;
|
||||
}
|
||||
assert(cpc >= 2 && ncolors <= (1 << ctx->depth));
|
||||
|
@ -207,7 +211,7 @@ static XColor *
|
|||
|
||||
if (ncolors >= 256 && ctx->vclass == StaticGray) {
|
||||
/* don't need dithering for 256 levels of gray in StaticGray visual */
|
||||
ctx->attribs->render_mode = RM_MATCH;
|
||||
ctx->attribs->render_mode = RBestMatchRendering;
|
||||
}
|
||||
colors = malloc(sizeof(XColor) * ncolors);
|
||||
if (!colors) {
|
||||
|
@ -223,17 +227,20 @@ static XColor *
|
|||
/* try to allocate the colors */
|
||||
for (i = 0; i < ncolors; i++) {
|
||||
#ifdef DEBUG
|
||||
printf("trying:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
|
||||
printf("trying:%x,%x,%x\n", colors[i].red, colors[i].green,
|
||||
colors[i].blue);
|
||||
#endif
|
||||
if (!XAllocColor(ctx->dpy, ctx->cmap, &(colors[i]))) {
|
||||
colors[i].flags = 0; /* failed */
|
||||
#ifdef DEBUG
|
||||
printf("failed:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
|
||||
printf("failed:%x,%x,%x\n", colors[i].red, colors[i].green,
|
||||
colors[i].blue);
|
||||
#endif
|
||||
} else {
|
||||
colors[i].flags = DoRed | DoGreen | DoBlue;
|
||||
#ifdef DEBUG
|
||||
printf("success:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
|
||||
printf("success:%x,%x,%x\n", colors[i].red, colors[i].green,
|
||||
colors[i].blue);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +274,10 @@ static XColor *
|
|||
}
|
||||
/* allocate closest color found */
|
||||
#ifdef DEBUG
|
||||
printf("best match:%x,%x,%x => %x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue, avcolors[closest].red, avcolors[closest].green, avcolors[closest].blue);
|
||||
printf("best match:%x,%x,%x => %x,%x,%x\n", colors[i].red,
|
||||
colors[i].green, colors[i].blue,
|
||||
avcolors[closest].red, avcolors[closest].green,
|
||||
avcolors[closest].blue);
|
||||
#endif
|
||||
colors[i].red = avcolors[closest].red;
|
||||
colors[i].green = avcolors[closest].green;
|
||||
|
@ -286,8 +296,7 @@ static XColor *
|
|||
}
|
||||
|
||||
|
||||
static char *
|
||||
mygetenv(char *var, int scr)
|
||||
static char *mygetenv(char *var, int scr)
|
||||
{
|
||||
char *p;
|
||||
char varname[64];
|
||||
|
@ -323,7 +332,8 @@ static void gatherconfig(RContext * context, int screen_n)
|
|||
if (ptr) {
|
||||
int i;
|
||||
if (sscanf(ptr, "%d", &i) != 1 || i < 2 || i > 6) {
|
||||
printf("wrlib: invalid value for color resolution \"%s\"\n", ptr);
|
||||
printf("wrlib: invalid value for color resolution \"%s\"\n",
|
||||
ptr);
|
||||
} else {
|
||||
context->attribs->flags |= RC_ColorsPerChannel;
|
||||
context->attribs->colors_per_channel = i;
|
||||
|
@ -383,8 +393,8 @@ static int count_offset(unsigned long mask)
|
|||
}
|
||||
|
||||
|
||||
RContext *
|
||||
myRCreateContext(Display * dpy, int screen_number, RContextAttributes * attribs)
|
||||
RContext *myRCreateContext(Display * dpy, int screen_number,
|
||||
RContextAttributes * attribs)
|
||||
{
|
||||
RContext *context;
|
||||
XGCValues gcv;
|
||||
|
@ -421,7 +431,8 @@ RContext *
|
|||
|
||||
templ.screen = screen_number;
|
||||
templ.visualid = context->attribs->visualid;
|
||||
vinfo = XGetVisualInfo(context->dpy, VisualIDMask | VisualScreenMask,
|
||||
vinfo =
|
||||
XGetVisualInfo(context->dpy, VisualIDMask | VisualScreenMask,
|
||||
&templ, &nret);
|
||||
if (!vinfo || nret == 0) {
|
||||
free(context);
|
||||
|
@ -442,10 +453,12 @@ RContext *
|
|||
attr.override_redirect = True;
|
||||
attr.border_pixel = 0;
|
||||
attr.background_pixel = 0;
|
||||
mask = CWBorderPixel | CWColormap | CWOverrideRedirect | CWBackPixel;
|
||||
mask =
|
||||
CWBorderPixel | CWColormap | CWOverrideRedirect |
|
||||
CWBackPixel;
|
||||
context->drawable =
|
||||
XCreateWindow(dpy, RootWindow(dpy, screen_number), 1, 1,
|
||||
1, 1, 0, context->depth, CopyFromParent,
|
||||
XCreateWindow(dpy, RootWindow(dpy, screen_number), 1, 1, 1,
|
||||
1, 0, context->depth, CopyFromParent,
|
||||
context->visual, mask, &attr);
|
||||
/* XSetWindowColormap(dpy, context->drawable, attr.colormap); */
|
||||
}
|
||||
|
@ -474,7 +487,8 @@ RContext *
|
|||
if (!context->colors) {
|
||||
return NULL;
|
||||
}
|
||||
} else if (context->vclass == GrayScale || context->vclass == StaticGray) {
|
||||
} else if (context->vclass == GrayScale
|
||||
|| context->vclass == StaticGray) {
|
||||
context->colors = allocateGrayScale(context);
|
||||
if (!context->colors) {
|
||||
return NULL;
|
||||
|
@ -486,7 +500,7 @@ RContext *
|
|||
context->blue_offset = count_offset(context->visual->blue_mask);
|
||||
/* disable dithering on 24 bits visuals */
|
||||
if (context->depth >= 24)
|
||||
context->attribs->render_mode = RM_MATCH;
|
||||
context->attribs->render_mode = RBestMatchRendering;
|
||||
}
|
||||
/* check avaiability of MIT-SHM */
|
||||
|
||||
|
@ -495,7 +509,7 @@ RContext *
|
|||
|
||||
|
||||
static Bool
|
||||
bestContext(Display * dpy, int screen_number, RContext * context)
|
||||
bestContext(Display * dpy, int screen_number, RContext * context)
|
||||
{
|
||||
XVisualInfo *vinfo = NULL, rvinfo;
|
||||
int best = -1, numvis, i;
|
||||
|
@ -543,7 +557,8 @@ static Bool
|
|||
XCreateWindow(dpy, RootWindow(dpy, screen_number),
|
||||
1, 1, 1, 1, 0, context->depth,
|
||||
CopyFromParent, context->visual,
|
||||
CWBorderPixel | CWColormap | CWOverrideRedirect, &attr);
|
||||
CWBorderPixel | CWColormap | CWOverrideRedirect,
|
||||
&attr);
|
||||
/* XSetWindowColormap(dpy, context->drawable, context->cmap); */
|
||||
}
|
||||
if (vinfo)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* myconvert.c - an adaptation of wrlib for use in wmglobe
|
||||
* initial source taken in WindowMaker-0.20.3/wrlib :
|
||||
*/
|
||||
|
@ -23,9 +23,6 @@
|
|||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* #include <config.h>
|
||||
*/
|
||||
#include "wmglobe.h"
|
||||
|
||||
typedef struct RConversionTable {
|
||||
|
@ -58,8 +55,7 @@ void initmyconvert()
|
|||
|
||||
|
||||
|
||||
static unsigned short *
|
||||
computeTable(unsigned short mask, int hop)
|
||||
static unsigned short *computeTable(unsigned short mask, int hop)
|
||||
{
|
||||
RConversionTable *tmp = conversionTable;
|
||||
int i;
|
||||
|
@ -74,8 +70,7 @@ static unsigned short *
|
|||
}
|
||||
|
||||
|
||||
static RXImage *
|
||||
image2TrueColor(RContext * ctx, RImage * image)
|
||||
static RXImage *image2TrueColor(RContext * ctx, RImage * image)
|
||||
{
|
||||
RXImage *ximg;
|
||||
register int x, y, r, g, b;
|
||||
|
@ -87,16 +82,18 @@ static RXImage *
|
|||
int ofs;
|
||||
|
||||
if (ximgok == NULL)
|
||||
ximgok = RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
ximgok =
|
||||
RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
|
||||
ximg = ximgok;
|
||||
if (!ximg) {
|
||||
puts("err ");
|
||||
return NULL;
|
||||
}
|
||||
red = image->data[0];
|
||||
grn = image->data[1];
|
||||
blu = image->data[2];
|
||||
|
||||
red = image->data;
|
||||
grn = image->data + 1;
|
||||
blu = image->data + 2;
|
||||
|
||||
roffs = ctx->red_offset;
|
||||
goffs = ctx->green_offset;
|
||||
|
@ -117,13 +114,13 @@ static RXImage *
|
|||
RDestroyXImage(ctx, ximg);
|
||||
return NULL;
|
||||
}
|
||||
if (ctx->attribs->render_mode == RM_MATCH) {
|
||||
if (ctx->attribs->render_mode == RBestMatchRendering) {
|
||||
/* fake match */
|
||||
#ifdef DEBUG
|
||||
puts("true color match");
|
||||
#endif
|
||||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++, ofs++) {
|
||||
for (x = 0; x < image->width; x++, ofs += 3) {
|
||||
/* reduce pixel */
|
||||
r = rtable[red[ofs]];
|
||||
g = gtable[grn[ofs]];
|
||||
|
@ -141,6 +138,7 @@ static RXImage *
|
|||
const int dr = 0xff / rmask;
|
||||
const int dg = 0xff / gmask;
|
||||
const int db = 0xff / bmask;
|
||||
register int x1;
|
||||
|
||||
#ifdef DEBUG
|
||||
puts("true color dither");
|
||||
|
@ -157,24 +155,26 @@ static RXImage *
|
|||
RDestroyXImage(ctx, ximg);
|
||||
return NULL;
|
||||
}
|
||||
for (x = 0; x < image->width; x++) {
|
||||
for (x = x1 = 0; x < image->width; x++, x1 += 3) {
|
||||
|
||||
rerr[x] = red[x];
|
||||
gerr[x] = grn[x];
|
||||
berr[x] = blu[x];
|
||||
rerr[x] = red[x1];
|
||||
gerr[x] = grn[x1];
|
||||
berr[x] = blu[x1];
|
||||
}
|
||||
rerr[x] = gerr[x] = berr[x] = 0;
|
||||
/* convert and dither the image to XImage */
|
||||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
if (y < image->height - 1) {
|
||||
int x1;
|
||||
for (x = 0, x1 = ofs + image->width; x < image->width; x++, x1++) {
|
||||
|
||||
for (x = 0, x1 = 3 * (ofs + image->width); x <
|
||||
image->width; x++, x1 += 3) {
|
||||
|
||||
nrerr[x] = red[x1];
|
||||
ngerr[x] = grn[x1];
|
||||
nberr[x] = blu[x1];
|
||||
}
|
||||
/* last column */
|
||||
x1--;
|
||||
x1-=3;
|
||||
nrerr[x] = red[x1];
|
||||
ngerr[x] = grn[x1];
|
||||
nberr[x] = blu[x1];
|
||||
|
@ -241,8 +241,7 @@ static RXImage *
|
|||
}
|
||||
|
||||
|
||||
static RXImage *
|
||||
image2PseudoColor(RContext * ctx, RImage * image)
|
||||
static RXImage *image2PseudoColor(RContext * ctx, RImage * image)
|
||||
{
|
||||
RXImage *ximg;
|
||||
register int x, y, r, g, b;
|
||||
|
@ -259,7 +258,8 @@ static RXImage *
|
|||
/*register unsigned char maxrgb = 0xff; */
|
||||
|
||||
if (ximgok == NULL)
|
||||
ximgok = RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
ximgok =
|
||||
RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
|
||||
ximg = ximgok;
|
||||
|
||||
|
@ -267,9 +267,9 @@ static RXImage *
|
|||
puts("err psc");
|
||||
return NULL;
|
||||
}
|
||||
red = image->data[0];
|
||||
grn = image->data[1];
|
||||
blu = image->data[2];
|
||||
red = image->data;
|
||||
grn = image->data + 1;
|
||||
blu = image->data + 2;
|
||||
|
||||
data = ximg->image->data;
|
||||
|
||||
|
@ -283,13 +283,13 @@ static RXImage *
|
|||
RDestroyXImage(ctx, ximg);
|
||||
return NULL;
|
||||
}
|
||||
if (ctx->attribs->render_mode == RM_MATCH) {
|
||||
if (ctx->attribs->render_mode == RBestMatchRendering) {
|
||||
/* fake match */
|
||||
#ifdef DEBUG
|
||||
printf("pseudo color match with %d colors per channel\n", cpc);
|
||||
#endif
|
||||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++, ofs++) {
|
||||
for (x = 0; x < image->width; x++, ofs += 3) {
|
||||
/* reduce pixel */
|
||||
r = rtable[red[ofs]];
|
||||
g = gtable[grn[ofs]];
|
||||
|
@ -308,6 +308,7 @@ static RXImage *
|
|||
const int dr = 0xff / rmask;
|
||||
const int dg = 0xff / gmask;
|
||||
const int db = 0xff / bmask;
|
||||
register int x1;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("pseudo color dithering with %d colors per channel\n", cpc);
|
||||
|
@ -323,23 +324,24 @@ static RXImage *
|
|||
RDestroyXImage(ctx, ximg);
|
||||
return NULL;
|
||||
}
|
||||
for (x = 0; x < image->width; x++) {
|
||||
rerr[x] = red[x];
|
||||
gerr[x] = grn[x];
|
||||
berr[x] = blu[x];
|
||||
for (x = x1 = 0; x < image->width; x++, x1+=3) {
|
||||
rerr[x] = red[x1];
|
||||
gerr[x] = grn[x1];
|
||||
berr[x] = blu[x1];
|
||||
}
|
||||
rerr[x] = gerr[x] = berr[x] = 0;
|
||||
/* convert and dither the image to XImage */
|
||||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
if (y < image->height - 1) {
|
||||
int x1;
|
||||
for (x = 0, x1 = ofs + image->width; x < image->width; x++, x1++) {
|
||||
for (x = 0, x1 = 3*(ofs + image->width); x <
|
||||
image->width; x++, x1 += 3) {
|
||||
nrerr[x] = red[x1];
|
||||
ngerr[x] = grn[x1];
|
||||
nberr[x] = blu[x1];
|
||||
}
|
||||
/* last column */
|
||||
x1--;
|
||||
x1-=3;
|
||||
nrerr[x] = red[x1];
|
||||
ngerr[x] = grn[x1];
|
||||
nberr[x] = blu[x1];
|
||||
|
@ -410,8 +412,7 @@ static RXImage *
|
|||
}
|
||||
|
||||
|
||||
static RXImage *
|
||||
image2GrayScale(RContext * ctx, RImage * image)
|
||||
static RXImage *image2GrayScale(RContext * ctx, RImage * image)
|
||||
{
|
||||
RXImage *ximg;
|
||||
register int x, y, g;
|
||||
|
@ -424,7 +425,8 @@ static RXImage *
|
|||
/*register unsigned char maxrgb = 0xff; */
|
||||
|
||||
if (ximgok == NULL)
|
||||
ximgok = RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
ximgok =
|
||||
RCreateXImage(ctx, ctx->depth, image->width, image->height);
|
||||
|
||||
ximg = ximgok;
|
||||
|
||||
|
@ -432,9 +434,9 @@ static RXImage *
|
|||
puts("error!");
|
||||
return NULL;
|
||||
}
|
||||
red = image->data[0];
|
||||
grn = image->data[1];
|
||||
blu = image->data[2];
|
||||
red = image->data;
|
||||
grn = image->data + 1;
|
||||
blu = image->data + 2;
|
||||
|
||||
data = ximg->image->data;
|
||||
|
||||
|
@ -450,7 +452,7 @@ static RXImage *
|
|||
RDestroyXImage(ctx, ximg);
|
||||
return NULL;
|
||||
}
|
||||
if (ctx->attribs->render_mode == RM_MATCH) {
|
||||
if (ctx->attribs->render_mode == RBestMatchRendering) {
|
||||
/* fake match */
|
||||
#ifdef DEBUG
|
||||
printf("grayscale match with %d colors per channel\n", cpc);
|
||||
|
@ -458,7 +460,9 @@ static RXImage *
|
|||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++, ofs++) {
|
||||
/* reduce pixel */
|
||||
g = table[(red[ofs] * 30 + grn[ofs] * 59 + blu[ofs] * 11) / 100];
|
||||
g =
|
||||
table[(red[ofs] * 30 + grn[ofs] * 59 + blu[ofs] * 11) /
|
||||
100];
|
||||
|
||||
/*data[ofs] = ctx->colors[g].pixel; */
|
||||
XPutPixel(ximg->image, x, y, ctx->colors[g].pixel);
|
||||
|
@ -490,12 +494,15 @@ static RXImage *
|
|||
for (y = 0, ofs = 0; y < image->height; y++) {
|
||||
if (y < image->height - 1) {
|
||||
int x1;
|
||||
for (x = 0, x1 = ofs + image->width; x < image->width; x++, x1++) {
|
||||
ngerr[x] = (red[x1] * 30 + grn[x1] * 59 + blu[x1] * 11) / 100;
|
||||
for (x = 0, x1 = ofs + image->width; x < image->width;
|
||||
x++, x1++) {
|
||||
ngerr[x] =
|
||||
(red[x1] * 30 + grn[x1] * 59 + blu[x1] * 11) / 100;
|
||||
}
|
||||
/* last column */
|
||||
x1--;
|
||||
ngerr[x] = (red[x1] * 30 + grn[x1] * 59 + blu[x1] * 11) / 100;
|
||||
ngerr[x] =
|
||||
(red[x1] * 30 + grn[x1] * 59 + blu[x1] * 11) / 100;
|
||||
}
|
||||
for (x = 0; x < image->width; x++, ofs++) {
|
||||
/* reduce pixel */
|
||||
|
@ -545,8 +552,9 @@ int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap)
|
|||
/* clear error message */
|
||||
if (context->vclass == TrueColor)
|
||||
ximg = image2TrueColor(context, image);
|
||||
else if (context->vclass == PseudoColor || context->vclass == StaticColor)
|
||||
ximg = image2PseudoColor(context, image);
|
||||
else if (context->vclass == PseudoColor
|
||||
|| context->vclass == StaticColor) ximg =
|
||||
image2PseudoColor(context, image);
|
||||
else if (context->vclass == GrayScale || context->vclass == StaticGray)
|
||||
ximg = image2GrayScale(context, image);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -15,11 +15,9 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
***************************************************************************/
|
||||
/* this code is based on XGlobe :
|
||||
|
||||
/* this code was based on XGlobe :
|
||||
renderer.cpp
|
||||
*
|
||||
*
|
||||
* This file is part of XGlobe. See README for details.
|
||||
*
|
||||
* Copyright (C) 1998 Thorsten Scheuermann
|
||||
|
@ -27,8 +25,11 @@
|
|||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public Licenses as published by
|
||||
* the Free Software Foundation.
|
||||
*************************************************************************** */
|
||||
|
||||
************************************************************************/
|
||||
/*
|
||||
Some parts of this files should be rewritten to not depend on
|
||||
WindowMaker version
|
||||
*/
|
||||
|
||||
#include "wmglobe.h"
|
||||
|
||||
|
@ -42,18 +43,31 @@ static RColor mygetMapColorLinear
|
|||
static void randomPosition();
|
||||
void setViewPos(double lat, double lon);
|
||||
static void myRPutPixel(int x, int y, RColor * color);
|
||||
static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx, int dy);
|
||||
#ifdef WITH_MARKERS
|
||||
#if (WITH_MARKERS == 1)
|
||||
static void invertPixel(int x, int y);
|
||||
static void put_cross(int x, int y);
|
||||
static void put_dot_cross(int x, int y, RColor * color);
|
||||
#endif
|
||||
#endif
|
||||
static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx,
|
||||
int dy);
|
||||
static void updateTime(int force);
|
||||
static struct timeval timeaccel(struct timeval t);
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct timeval timeaccel(struct timeval t)
|
||||
{
|
||||
struct timeval at;
|
||||
double rr;
|
||||
|
||||
t = diftimev(t, tini);
|
||||
rr = floor((double) t.tv_sec * time_multi + (double) t.tv_usec * time_multi / 1000000.);
|
||||
rr = floor((double) t.tv_sec * time_multi +
|
||||
(double) t.tv_usec * time_multi / 1000000.);
|
||||
/*** something bad may appen if time_multi=max after 41 minutes (overflow) ***/
|
||||
while (rr > (double) LONG_MAX)
|
||||
rr -= (2.0 * (double) LONG_MAX + 1.0);
|
||||
|
@ -61,24 +75,158 @@ struct timeval timeaccel(struct timeval t)
|
|||
at.tv_usec = (int) (t.tv_usec * time_multi) % 1000000;
|
||||
return addtimev(at, tbase);
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void myRPutPixel(int x, int y, RColor * color)
|
||||
{
|
||||
int ofs;
|
||||
unsigned char *sr, *sg, *sb;
|
||||
|
||||
ofs = y * DIAMETRE + x;
|
||||
sr = small->data[0] + ofs;
|
||||
sg = small->data[1] + ofs;
|
||||
sb = small->data[2] + ofs;
|
||||
ofs = (y * DIAMETRE + x) * 3;
|
||||
sr = small->data + (ofs++);
|
||||
sg = small->data + (ofs++);
|
||||
sb = small->data + (ofs);
|
||||
|
||||
*sr = color->red;
|
||||
*sg = color->green;
|
||||
*sb = color->blue;
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx, int dy)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if WITH_MARKERS
|
||||
static void invertPixel(int x, int y)
|
||||
{
|
||||
int ofs;
|
||||
unsigned char *sr, *sg, *sb;
|
||||
|
||||
ofs = (y * DIAMETRE + x) * 3;
|
||||
sr = small->data + (ofs++);
|
||||
sg = small->data + (ofs++);
|
||||
sb = small->data + (ofs);
|
||||
|
||||
#if ( CROSS_INVERT == 1 )
|
||||
*sr = 255 - *sr;
|
||||
*sg = 255 - *sg;
|
||||
*sb = 255 - *sb;
|
||||
#else
|
||||
if (*sb > 127 || *sg > 127 || *sr > 127)
|
||||
*sr = *sg = *sb = 0;
|
||||
else
|
||||
*sr = *sg = *sb = 255;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#define T_CADRE(x,y) ((x) < DIAMETRE && (x) >= 0 \
|
||||
&& (y) < DIAMETRE && (y) >= 0 && tabsolu[(x)][(y)])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void put_cross(int x, int y)
|
||||
{
|
||||
int i, x_cross, y_cross;
|
||||
|
||||
if (T_CADRE(x, y)) {
|
||||
if (!fun && sens != 1) {
|
||||
x = DIAMETRE - 1 - x;
|
||||
y = DIAMETRE - 1 - y;
|
||||
}
|
||||
for (i = 2; i <= CROSS_LENGTH; i++) {
|
||||
x_cross = x + i;
|
||||
y_cross = y;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
x_cross = x - i;
|
||||
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
x_cross = x;
|
||||
y_cross = y - i;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
|
||||
y_cross = y + i;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void put_dot_cross(int x, int y, RColor * color)
|
||||
{
|
||||
int i, x_cross, y_cross;
|
||||
|
||||
if (T_CADRE(x, y)) {
|
||||
if (!fun && sens != 1) {
|
||||
x = DIAMETRE - 1 - x;
|
||||
y = DIAMETRE - 1 - y;
|
||||
}
|
||||
for (i = 2; i <= CROSS_LENGTH; i += 2) {
|
||||
x_cross = x + i;
|
||||
y_cross = y;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
x_cross = x - i;
|
||||
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
x_cross = x;
|
||||
y_cross = y - i;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
|
||||
y_cross = y + i;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
invertPixel(x_cross, y_cross);
|
||||
|
||||
x_cross = x + i + 1;
|
||||
y_cross = y;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
myRPutPixel(x_cross, y_cross, color);
|
||||
x_cross = x - i - 1;
|
||||
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
myRPutPixel(x_cross, y_cross, color);
|
||||
x_cross = x;
|
||||
y_cross = y - i - 1;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
myRPutPixel(x_cross, y_cross, color);
|
||||
|
||||
y_cross = y + i + 1;
|
||||
if (T_CADRE(x_cross, y_cross))
|
||||
myRPutPixel(x_cross, y_cross, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx,
|
||||
int dy)
|
||||
{
|
||||
int xx;
|
||||
register int ofs;
|
||||
|
@ -88,29 +236,29 @@ static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx, int dy)
|
|||
x %= image->width;
|
||||
xx = x;
|
||||
y %= image->height;
|
||||
ofs = y * image->width + x;
|
||||
m[0]->r = image->data[0][ofs];
|
||||
m[0]->g = image->data[1][ofs];
|
||||
m[0]->b = image->data[2][ofs];
|
||||
ofs = (y * image->width + x) * 3;
|
||||
m[0]->r = image->data[ofs++];
|
||||
m[0]->g = image->data[ofs++];
|
||||
m[0]->b = image->data[ofs];
|
||||
|
||||
xx++;
|
||||
xx %= image->width;
|
||||
ofs = y * image->width + xx;
|
||||
m[1]->r = image->data[0][ofs];
|
||||
m[1]->g = image->data[1][ofs];
|
||||
m[1]->b = image->data[2][ofs];
|
||||
ofs = (y * image->width + xx) * 3;
|
||||
m[1]->r = image->data[ofs++];
|
||||
m[1]->g = image->data[ofs++];
|
||||
m[1]->b = image->data[ofs];
|
||||
|
||||
y++;
|
||||
y %= image->height;
|
||||
ofs = y * image->width + x;
|
||||
m[2]->r = image->data[0][ofs];
|
||||
m[2]->g = image->data[1][ofs];
|
||||
m[2]->b = image->data[2][ofs];
|
||||
ofs = (y * image->width + x) * 3;
|
||||
m[2]->r = image->data[ofs++];
|
||||
m[2]->g = image->data[ofs++];
|
||||
m[2]->b = image->data[ofs];
|
||||
|
||||
ofs = y * image->width + xx;
|
||||
m[3]->r = image->data[0][ofs];
|
||||
m[3]->g = image->data[1][ofs];
|
||||
m[3]->b = image->data[2][ofs];
|
||||
ofs = (y * image->width + xx) * 3;
|
||||
m[3]->r = image->data[ofs++];
|
||||
m[3]->g = image->data[ofs++];
|
||||
m[3]->b = image->data[ofs];
|
||||
|
||||
|
||||
/*
|
||||
|
@ -151,7 +299,15 @@ static void getquarter(RImage * image, int x, int y, MPO * m[4], int dx, int dy)
|
|||
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void calcDistance()
|
||||
{
|
||||
double tan_a;
|
||||
|
@ -165,7 +321,15 @@ void calcDistance()
|
|||
solution = FALSE;
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void renderFrame()
|
||||
{
|
||||
int py, px;
|
||||
|
@ -181,7 +345,7 @@ void renderFrame()
|
|||
|
||||
double a; /* coeff. of quardatic equation */
|
||||
|
||||
double radikand;
|
||||
double udroot; /* racine */
|
||||
double wurzel;
|
||||
double r; /* r' */
|
||||
|
||||
|
@ -218,7 +382,6 @@ void renderFrame()
|
|||
*/
|
||||
if (solution == FALSE)
|
||||
RClearImage(small, &noir);
|
||||
|
||||
/*
|
||||
* rotation matrix
|
||||
*/
|
||||
|
@ -238,9 +401,10 @@ void renderFrame()
|
|||
*/
|
||||
if (solution == FALSE) {
|
||||
b_coef = 2 * center_dist * dir_z;
|
||||
radius_proj = (int) sqrt(b_coef * b_coef / (4 * c_coef) - dir_z * dir_z) + 1;
|
||||
radius_proj =
|
||||
(int) sqrt(b_coef * b_coef / (4 * c_coef) - dir_z * dir_z) + 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------------*/
|
||||
|
||||
if (fun) {
|
||||
starty = DIAMETRE / 2 - radius_proj - 3;
|
||||
endy = DIAMETRE - starty - 1;
|
||||
|
@ -253,12 +417,24 @@ void renderFrame()
|
|||
if ((double) endy > (double) (DIAMETRE - 1 - funy))
|
||||
endy = DIAMETRE - 1 - funy;
|
||||
|
||||
if (solution == FALSE) {
|
||||
int i, j;
|
||||
if (starty + funy > 0)
|
||||
for (j = 0; j < starty + funy; j++)
|
||||
for (i = 0; i < DIAMETRE; i++)
|
||||
tabsolu[i][j] = 0;
|
||||
if (endy + 1 + funy <= DIAMETRE - 1)
|
||||
for (j = endy + funy + 1; j < DIAMETRE; j++)
|
||||
for (i = 0; i < DIAMETRE; i++)
|
||||
tabsolu[i][j] = 0;
|
||||
}
|
||||
|
||||
for (py = starty; py <= endy; py++) {
|
||||
|
||||
startx = DIAMETRE / 2 - 6 -
|
||||
(int) sqrt(radius_proj * radius_proj -
|
||||
(int) sqrt(MAX((radius_proj * radius_proj -
|
||||
(py - DIAMETRE / 2) *
|
||||
(py - DIAMETRE / 2));
|
||||
(py - DIAMETRE / 2)), 0.0));
|
||||
|
||||
endx = DIAMETRE - startx - 1;
|
||||
if ((double) startx < (double) (-funx))
|
||||
|
@ -272,34 +448,51 @@ void renderFrame()
|
|||
if ((double) endx > (double) (DIAMETRE - 1 - funx))
|
||||
endx = DIAMETRE - 1 - funx;
|
||||
|
||||
if (solution == FALSE) {
|
||||
int i;
|
||||
if (startx + funx > 0)
|
||||
for (i = 0; i < startx + funx; i++)
|
||||
tabsolu[i][py + funy] = 0;
|
||||
if (endx + 1 + funx <= DIAMETRE - 1)
|
||||
for (i = endx + 1 + funx; i < DIAMETRE; i++)
|
||||
tabsolu[i][py + funy] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* calculate offset into image data
|
||||
*/
|
||||
|
||||
for (px = startx; px <= endx; px++) {
|
||||
|
||||
if (solution == FALSE) {
|
||||
dir_x = (double) px - DIAMETRE / 2 + 0.5;
|
||||
dir_y = -(double) py + DIAMETRE / 2 - 0.5;
|
||||
|
||||
a = dir_x * dir_x + dir_y * dir_y + dir_z * dir_z;
|
||||
/*
|
||||
* c constant, see above
|
||||
*/
|
||||
radikand = b_coef * b_coef - 4 * a * c_coef; /*what's under the sq.root when solving the
|
||||
quadratic equation */
|
||||
|
||||
if (radikand >= 0.0) { /* solution exists <=> intersection */
|
||||
|
||||
wurzel = sqrt(radikand);
|
||||
udroot = b_coef * b_coef - 4 * a * c_coef; /*what's under the
|
||||
sq.root when solving the quadratic equation */
|
||||
if (udroot >= 0) {
|
||||
tabsolu[px + funx][py + funy] = 1;
|
||||
wurzel = sqrt(udroot);
|
||||
s1 = (-b_coef + wurzel) / (2. * a);
|
||||
s2 = (-b_coef - wurzel) / (2. * a);
|
||||
s = (s1 < s2) ? s1 : s2; /* smaller solution belongs to nearer
|
||||
* intersection */
|
||||
s = (s1 < s2) ? s1 : s2; /* smaller solution belongs
|
||||
to nearer intersection */
|
||||
solu[px + funx][py + funy][0] = s * dir_x;
|
||||
solu[px + funx][py + funy][1] = s * dir_y;
|
||||
solu[px + funx][py + funy][2] =
|
||||
center_dist + s * dir_z;
|
||||
} else {
|
||||
tabsolu[px + funx][py + funy] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sp_x = s * dir_x; /* sp = camera pos + s*dir */
|
||||
sp_y = s * dir_y;
|
||||
sp_z = center_dist + s * dir_z;
|
||||
if (tabsolu[px + funx][py + funy]) { /* solution exists <=>
|
||||
intersection exists */
|
||||
sp_x = solu[px + funx][py + funy][0]; /* sp = camera pos + s*dir */
|
||||
sp_y = solu[px + funx][py + funy][1];
|
||||
sp_z = solu[px + funx][py + funy][2];
|
||||
|
||||
hit_x = m11 * sp_x + m12 * sp_y + m13 * sp_z;
|
||||
hit_y = m22 * sp_y + m23 * sp_z;
|
||||
|
@ -330,19 +523,26 @@ void renderFrame()
|
|||
latitude = atan(-hit_y / r);
|
||||
|
||||
light_angle =
|
||||
(light_x * hit_x + light_y * hit_y + light_z * hit_z) / radius;
|
||||
(light_x * hit_x + light_y * hit_y +
|
||||
light_z * hit_z) / radius;
|
||||
|
||||
/*
|
||||
* Set pixel in image
|
||||
*/
|
||||
|
||||
teinte = mygetMapColorLinear(longitude, latitude, light_angle);
|
||||
teinte =
|
||||
mygetMapColorLinear(longitude, latitude,
|
||||
light_angle);
|
||||
/* here dont use myRPutPixel since we prefer some
|
||||
error detection about limits */
|
||||
RPutPixel(small, px + funx, py + funy, &teinte);
|
||||
}
|
||||
} /*px */
|
||||
} /*py */
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*** not fun : ***/
|
||||
else {
|
||||
starty = DIAMETRE / 2 - radius_proj - 3;
|
||||
|
@ -351,15 +551,36 @@ void renderFrame()
|
|||
/*
|
||||
* py 0 to 63 max
|
||||
*/
|
||||
if (solution == FALSE) {
|
||||
int i, j;
|
||||
if (starty > 0)
|
||||
for (j = 0; j < starty; j++)
|
||||
for (i = 0; i < DIAMETRE; i++)
|
||||
tabsolu[i][j] = 0;
|
||||
if (endy + 1 <= DIAMETRE - 1)
|
||||
for (j = endy + 1; j < DIAMETRE; j++)
|
||||
for (i = 0; i < DIAMETRE; i++)
|
||||
tabsolu[i][j] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (py = starty; py <= endy; py++) {
|
||||
startx = DIAMETRE / 2 - 6 -
|
||||
(int) sqrt(radius_proj * radius_proj -
|
||||
(int) sqrt(MAX((radius_proj * radius_proj -
|
||||
(py - DIAMETRE / 2) *
|
||||
(py - DIAMETRE / 2));
|
||||
(py - DIAMETRE / 2)), 0.0));
|
||||
startx = (startx < 0) ? 0 : startx;
|
||||
/*
|
||||
* 0<= startx <=31
|
||||
*/
|
||||
if (solution == FALSE) {
|
||||
int i;
|
||||
if (startx > 0)
|
||||
for (i = 0; i < startx; i++) {
|
||||
tabsolu[i][py] = 0;
|
||||
tabsolu[DIAMETRE - 1 - i][py] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (px = startx; px < DIAMETRE / 2; px++) {
|
||||
if (solution == FALSE) {
|
||||
|
@ -369,28 +590,32 @@ void renderFrame()
|
|||
|
||||
a = dir_x * dir_x + dir_y * dir_y + dir_z * dir_z;
|
||||
|
||||
|
||||
soluce[px][py][0] = b_coef * b_coef - 4 * a * c_coef;
|
||||
/*what's under the sq.root when solving the
|
||||
quadratic equation */
|
||||
|
||||
}
|
||||
if (soluce[px][py][0] >= 0.0) { /* solution exists <=> intersection */
|
||||
|
||||
if (solution == FALSE) {
|
||||
wurzel = sqrt(soluce[px][py][0]);
|
||||
udroot = b_coef * b_coef - 4 * a * c_coef;
|
||||
if (udroot >= 0) {
|
||||
tabsolu[px][py] = 1;
|
||||
tabsolu[DIAMETRE - 1 - px][py] = 1;
|
||||
wurzel = sqrt(udroot);
|
||||
s1 = (-b_coef + wurzel) / (2. * a);
|
||||
s2 = (-b_coef - wurzel) / (2. * a);
|
||||
s = (s1 < s2) ? s1 : s2; /* smaller solution belongs to nearer
|
||||
* intersection */
|
||||
|
||||
soluce[px][py][1] = s * dir_x; /* sp = camera pos + s*dir */
|
||||
soluce[px][py][2] = s * dir_y;
|
||||
soluce[px][py][3] = center_dist + s * dir_z;
|
||||
s = (s1 < s2) ? s1 : s2; /* smaller solution
|
||||
belongs to nearer
|
||||
intersection */
|
||||
/* sp = camera pos + s*dir */
|
||||
solu[px][py][0] = s * dir_x;
|
||||
solu[px][py][1] = s * dir_y;
|
||||
solu[px][py][2] = center_dist + s * dir_z;
|
||||
} else {
|
||||
tabsolu[px][py] = 0;
|
||||
tabsolu[DIAMETRE - 1 - px][py] = 0;
|
||||
}
|
||||
sp_x = soluce[px][py][1];
|
||||
sp_y = soluce[px][py][2];
|
||||
sp_z = soluce[px][py][3];
|
||||
}
|
||||
if (tabsolu[px][py]) { /* solution exists <=>
|
||||
intersection exists */
|
||||
sp_x = solu[px][py][0];
|
||||
sp_y = solu[px][py][1];
|
||||
sp_z = solu[px][py][2];
|
||||
hit_x = m11 * sp_x + m12 * sp_y + m13 * sp_z;
|
||||
hit_y = m22 * sp_y + m23 * sp_z;
|
||||
hit_z = m31 * sp_x + m32 * sp_y + m33 * sp_z;
|
||||
|
@ -405,10 +630,12 @@ void renderFrame()
|
|||
minhz = hit_z;
|
||||
fprintf(stdout, "should >>0 : hit_z %f\n", hit_z);
|
||||
fprintf(stdout, " hit_x %f\n", hit_x);
|
||||
fprintf(stdout, " ratio %f\n", hit_x / hit_z);
|
||||
fprintf(stdout, " long %f\n", atan(hit_x / hit_z));
|
||||
fprintf(stdout, " ratio %f\n",
|
||||
hit_x / hit_z);
|
||||
fprintf(stdout, " long %f\n",
|
||||
atan(hit_x / hit_z));
|
||||
|
||||
sleep(5);
|
||||
sleep(1);
|
||||
}
|
||||
#endif
|
||||
if (ABS(hit_z) < 0.001) {
|
||||
|
@ -432,24 +659,31 @@ void renderFrame()
|
|||
latitude = atan(-hit_y / r);
|
||||
|
||||
light_angle =
|
||||
(light_x * hit_x + light_y * hit_y + light_z * hit_z) / radius;
|
||||
(light_x * hit_x + light_y * hit_y +
|
||||
light_z * hit_z) / radius;
|
||||
if (sens == 1) {
|
||||
|
||||
/*
|
||||
* Set pixel in image
|
||||
*/
|
||||
|
||||
teinte = mygetMapColorLinear(longitude, latitude, light_angle);
|
||||
teinte =
|
||||
mygetMapColorLinear(longitude, latitude,
|
||||
light_angle);
|
||||
myRPutPixel(px, py, &teinte);
|
||||
|
||||
/*
|
||||
* mirror the left half-circle of the globe: we need a new position
|
||||
* and have to recalc. the light intensity
|
||||
* mirror the left half-circle of the globe:
|
||||
* we need a new position and have to recalc. the
|
||||
* light intensity
|
||||
*/
|
||||
|
||||
light_angle =
|
||||
(light_x * hit2_x + light_y * hit2_y + light_z * hit2_z) / radius;
|
||||
teinte = mygetMapColorLinear(2 * v_long - longitude, latitude, light_angle);
|
||||
(light_x * hit2_x + light_y * hit2_y +
|
||||
light_z * hit2_z) / radius;
|
||||
teinte =
|
||||
mygetMapColorLinear(2 * v_long - longitude,
|
||||
latitude, light_angle);
|
||||
myRPutPixel(DIAMETRE - px - 1, py, &teinte);
|
||||
} else {
|
||||
/* sens==-1 */
|
||||
|
@ -457,29 +691,84 @@ void renderFrame()
|
|||
* Set pixel in image
|
||||
*/
|
||||
|
||||
teinte = mygetMapColorLinear(longitude, latitude, light_angle);
|
||||
myRPutPixel(DIAMETRE - px - 1, DIAMETRE - py - 1, &teinte);
|
||||
teinte =
|
||||
mygetMapColorLinear(longitude, latitude,
|
||||
light_angle);
|
||||
myRPutPixel(DIAMETRE - px - 1, DIAMETRE - py - 1,
|
||||
&teinte);
|
||||
|
||||
/*
|
||||
* mirror the left half-circle of the globe: we need a new position
|
||||
* and have to recalc. the light intensity
|
||||
* mirror the left half-circle of the globe:
|
||||
* we need a new position and have
|
||||
* to recalc. the light intensity
|
||||
*/
|
||||
|
||||
light_angle =
|
||||
(light_x * hit2_x + light_y * hit2_y + light_z * hit2_z) / radius;
|
||||
teinte = mygetMapColorLinear(2 * v_long - longitude, latitude, light_angle);
|
||||
(light_x * hit2_x + light_y * hit2_y +
|
||||
light_z * hit2_z) / radius;
|
||||
teinte =
|
||||
mygetMapColorLinear(2 * v_long - longitude,
|
||||
latitude, light_angle);
|
||||
myRPutPixel(px, DIAMETRE - py - 1, &teinte);
|
||||
}
|
||||
}
|
||||
} /*px */
|
||||
} /*py */
|
||||
|
||||
|
||||
} /*else fun */
|
||||
#if WITH_MARKERS
|
||||
/* markers */
|
||||
if (nb_marker) {
|
||||
int i;
|
||||
double mx, my, mz;
|
||||
|
||||
for (i = 0; i < nb_marker; i++) {
|
||||
|
||||
mx = m11 * marker[i][0] + m31 * marker[i][2];
|
||||
mz = -m31 * marker[i][0] + m11 * marker[i][2];
|
||||
my = m22 * marker[i][1] - m23 * mz;
|
||||
mz = m23 * marker[i][1] + m22 * mz;
|
||||
|
||||
if (mz > 0) {
|
||||
if (i == sun_marker) {
|
||||
put_dot_cross((int)
|
||||
(mx * radius_proj + DIAMETRE / 2 + funx),
|
||||
(int) (-my * radius_proj + DIAMETRE / 2 +
|
||||
funy), &sun_col);
|
||||
} else if (i == moon_marker) {
|
||||
put_dot_cross((int)
|
||||
(mx * radius_proj + DIAMETRE / 2 + funx),
|
||||
(int) (-my * radius_proj + DIAMETRE / 2 +
|
||||
funy), &moon_col);
|
||||
} else {
|
||||
put_cross((int)
|
||||
(mx * radius_proj + DIAMETRE / 2 + funx),
|
||||
(int) (-my * radius_proj + DIAMETRE / 2 +
|
||||
funy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
solution = TRUE;
|
||||
return;
|
||||
}
|
||||
/*------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static RColor
|
||||
mygetMapColorLinear(double longitude, double latitude, double angle)
|
||||
mygetMapColorLinear(double longitude, double latitude, double angle)
|
||||
{
|
||||
RColor point;
|
||||
int x, y, xl, yl, dx, dy, ang;
|
||||
|
@ -520,9 +809,15 @@ static RColor
|
|||
} else {
|
||||
getquarter(map, x, y, md, dx, dy);
|
||||
if (ang > 0) {
|
||||
md[0]->r = ((md[0]->r * aml + md[0]->r * ang / 256 * (256 - aml))) >> 8;
|
||||
md[0]->g = ((md[0]->g * aml + md[0]->g * ang / 256 * (256 - aml))) >> 8;
|
||||
md[0]->b = ((md[0]->b * aml + md[0]->b * ang / 256 * (256 - aml))) >> 8;
|
||||
md[0]->r =
|
||||
((md[0]->r * aml +
|
||||
md[0]->r * ang / 256 * (256 - aml))) >> 8;
|
||||
md[0]->g =
|
||||
((md[0]->g * aml +
|
||||
md[0]->g * ang / 256 * (256 - aml))) >> 8;
|
||||
md[0]->b =
|
||||
((md[0]->b * aml +
|
||||
md[0]->b * ang / 256 * (256 - aml))) >> 8;
|
||||
} else {
|
||||
md[0]->r = (md[0]->r * aml) >> 8;
|
||||
md[0]->g = (md[0]->g * aml) >> 8;
|
||||
|
@ -533,31 +828,88 @@ static RColor
|
|||
point.red = (unsigned char) md[0]->r;
|
||||
point.green = (unsigned char) md[0]->g;
|
||||
point.blue = (unsigned char) md[0]->b;
|
||||
point.alpha = 255;
|
||||
point.alpha = 255; /* in fun mode, we use original Rputpixel that need alpha?*/
|
||||
return point;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void randomPosition()
|
||||
{
|
||||
addlat = ((rand() % 30001) / 30000.) * 180. - 90.;
|
||||
addlong = ((rand() % 30001) / 30000.) * 360. - 180.;
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void updateTime(int force)
|
||||
{
|
||||
/* calcul of sun position every minute */
|
||||
if ((trend.tv_sec - tsunpos) >= 60 || force) {
|
||||
tsunpos = trend.tv_sec;
|
||||
GetSunPos(tsunpos, &sun_lat, &sun_long);
|
||||
sun_position(tsunpos, &sun_lat, &sun_long);
|
||||
light_x = cos(sun_lat) * sin(sun_long);
|
||||
light_y = sin(sun_lat);
|
||||
light_z = cos(sun_lat) * cos(sun_long);
|
||||
do_something = TRUE;
|
||||
#if WITH_MARKERS
|
||||
if (sun_marker >= 0) {
|
||||
marker[sun_marker][0] = light_x;
|
||||
marker[sun_marker][1] = light_y;
|
||||
marker[sun_marker][2] = light_z;
|
||||
}
|
||||
/* ... and the moon position */
|
||||
if (moon_marker >= 0 || p_type == PTMOON || force == STRONG) {
|
||||
moon_position(tsunpos, &moon_lat, &moon_long);
|
||||
if (moon_marker >= 0) {
|
||||
marker[moon_marker][1] = moon_lat;
|
||||
marker[moon_marker][0] = moon_long;
|
||||
transform_marker(moon_marker);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void transform_marker(int m)
|
||||
{
|
||||
/* long/lat => rotation matrix */
|
||||
double dtmp1, dtmp2;
|
||||
|
||||
dtmp1 = sin(marker[m][0]) * cos(marker[m][1]);
|
||||
dtmp2 = sin(marker[m][1]);
|
||||
marker[m][2] = cos(marker[m][0]) * cos(marker[m][1]);
|
||||
marker[m][0] = dtmp1;
|
||||
marker[m][1] = dtmp2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setViewPos(double lat, double lon)
|
||||
{
|
||||
double dif;
|
||||
|
@ -575,10 +927,11 @@ void setViewPos(double lat, double lon)
|
|||
lat = 180. - lat;
|
||||
addlat += (lat - dif);
|
||||
dlat *= -1;
|
||||
if (!fun) {
|
||||
if (!fun && !stable) {
|
||||
lon += 180.;
|
||||
addlong += 180.;
|
||||
}
|
||||
if (!stable)
|
||||
sens *= -1;
|
||||
}
|
||||
if (lat <= -90.) {
|
||||
|
@ -586,10 +939,11 @@ void setViewPos(double lat, double lon)
|
|||
lat = -180. - lat;
|
||||
addlat += (lat - dif);
|
||||
dlat *= -1;
|
||||
if (!fun) {
|
||||
if (!fun && !stable) {
|
||||
lon += 180.;
|
||||
addlong += 180.;
|
||||
}
|
||||
if (!stable)
|
||||
sens *= -1;
|
||||
}
|
||||
if (lat >= 90.) {
|
||||
|
@ -597,10 +951,11 @@ void setViewPos(double lat, double lon)
|
|||
lat = 180. - lat;
|
||||
addlat += (lat - dif);
|
||||
dlat *= -1;
|
||||
if (!fun) {
|
||||
if (!fun && !stable) {
|
||||
lon += 180.;
|
||||
addlong += 180.;
|
||||
}
|
||||
if (!stable)
|
||||
sens *= -1;
|
||||
}
|
||||
if (lat <= -90.) {
|
||||
|
@ -608,10 +963,11 @@ void setViewPos(double lat, double lon)
|
|||
lat = -180. - lat;
|
||||
addlat += (lat - dif);
|
||||
dlat *= -1;
|
||||
if (!fun) {
|
||||
if (!fun && !stable) {
|
||||
lon += 180.;
|
||||
addlong += 180.;
|
||||
}
|
||||
if (!stable)
|
||||
sens *= -1;
|
||||
}
|
||||
while (lon >= 180.) {
|
||||
|
@ -630,8 +986,15 @@ void setViewPos(double lat, double lon)
|
|||
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
void recalc(int calme)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void recalc(int force)
|
||||
{
|
||||
double coeff, va, vo;
|
||||
struct timeval tv, tnow;
|
||||
|
@ -642,11 +1005,11 @@ void recalc(int calme)
|
|||
|
||||
if (firstTime) {
|
||||
firstTime = FALSE;
|
||||
updateTime(TRUE);
|
||||
updateTime(STRONG);
|
||||
} else {
|
||||
coeff = (double) tv.tv_sec + tv.tv_usec / 1000000.;
|
||||
|
||||
if (!calme) {
|
||||
if (!force) {
|
||||
/** while !clic button rotate earth **/
|
||||
addlat += dlat * coeff;
|
||||
addlong += dlong * coeff;
|
||||
|
@ -658,23 +1021,46 @@ void recalc(int calme)
|
|||
old_dvlat = addlat;
|
||||
do_something = TRUE;
|
||||
}
|
||||
if (calme && p_type == PTSUNREL) {
|
||||
#if WITH_MARKERS
|
||||
if (force) {
|
||||
if (p_type == PTSUN) {
|
||||
va = sun_lat * 180. / PI;
|
||||
vo = sun_long * 180. / PI;
|
||||
updateTime(TRUE);
|
||||
addlat -= sun_lat * 180. / PI - va;
|
||||
addlong -= sun_long * 180. / PI - vo;
|
||||
} else if (p_type == PTMOON) {
|
||||
va = moon_lat * 180. / PI;
|
||||
vo = moon_long * 180. / PI;
|
||||
updateTime(TRUE);
|
||||
addlat -= moon_lat * 180. / PI - va;
|
||||
addlong -= moon_long * 180. / PI - vo;
|
||||
}
|
||||
#else
|
||||
if (force && p_type == PTSUN) {
|
||||
va = sun_lat * 180. / PI;
|
||||
vo = sun_long * 180. / PI;
|
||||
updateTime(TRUE);
|
||||
addlat -= sun_lat * 180. / PI - va;
|
||||
addlong -= sun_long * 180. / PI - vo;
|
||||
#endif
|
||||
} else {
|
||||
updateTime(FALSE);
|
||||
}
|
||||
|
||||
if (do_something) {
|
||||
switch (p_type) {
|
||||
case PTSUNREL:
|
||||
case PTSUN:
|
||||
setViewPos(sun_lat * 180. / PI + addlat,
|
||||
sun_long * 180. / PI + addlong);
|
||||
break;
|
||||
|
||||
#if WITH_MARKERS
|
||||
case PTMOON:
|
||||
setViewPos(moon_lat * 180. / PI + addlat,
|
||||
moon_long * 180. / PI + addlong);
|
||||
break;
|
||||
#endif
|
||||
case PTFIXED:
|
||||
setViewPos(addlat, addlong);
|
||||
break;
|
||||
|
@ -700,4 +1086,42 @@ void recalc(int calme)
|
|||
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* convert a 4 layers RGBA image to a 3 layer one */
|
||||
int ripalpha(RImage * image)
|
||||
{
|
||||
int x, y;
|
||||
unsigned char *d, *s, *old;
|
||||
|
||||
if (image == NULL)
|
||||
return 0;
|
||||
if (image->format == RRGBFormat)
|
||||
return 1;
|
||||
|
||||
d = malloc(image->width * image->height * 3 + 4);
|
||||
if (!d) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
puts("error in ripalpha");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s = image->data;
|
||||
old = image->data;
|
||||
image->data = d;
|
||||
image->format = RRGBFormat;
|
||||
for (y = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++) {
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
free(old);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
* sunpos.c is taken from Xearth :
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
* sunpos.c is taken from Xearth 1.0 (and part of 1.1):
|
||||
*/
|
||||
/*
|
||||
* sunpos.c
|
||||
|
@ -62,6 +62,7 @@
|
|||
#define PI 3.141592653
|
||||
#endif
|
||||
#define TWOPI (2*PI)
|
||||
#define DegsToRads(x) ((x)*(TWOPI/360))
|
||||
|
||||
/*
|
||||
* the epoch upon which these astronomical calculations are based is
|
||||
|
@ -93,8 +94,8 @@
|
|||
* Eccentricity (eccentricity of orbit) 0.016713
|
||||
*/
|
||||
|
||||
#define Epsilon_g (279.403303*(TWOPI/360))
|
||||
#define OmegaBar_g (282.768422*(TWOPI/360))
|
||||
#define Epsilon_g (DegsToRads(279.403303))
|
||||
#define OmegaBar_g (DegsToRads(282.768422))
|
||||
#define Eccentricity (0.016713)
|
||||
|
||||
/*
|
||||
|
@ -102,7 +103,36 @@
|
|||
* 1990.0 (computed as 23.440592 degrees according to the method given
|
||||
* in duffett-smith, section 27)
|
||||
*/
|
||||
#define MeanObliquity (23.440592*(TWOPI/360))
|
||||
#define MeanObliquity (DegsToRads(23.440592))
|
||||
|
||||
/*
|
||||
* Lunar parameters, epoch January 0, 1990.0 (from Xearth 1.1)
|
||||
*/
|
||||
#define MoonMeanLongitude DegsToRads(318.351648)
|
||||
#define MoonMeanLongitudePerigee DegsToRads( 36.340410)
|
||||
#define MoonMeanLongitudeNode DegsToRads(318.510107)
|
||||
#define MoonInclination DegsToRads( 5.145396)
|
||||
|
||||
#define SideralMonth (27.3217)
|
||||
|
||||
/*
|
||||
* Force an angular value into the range [-PI, +PI]
|
||||
*/
|
||||
#define Normalize(x) \
|
||||
do { \
|
||||
if ((x) < -PI) \
|
||||
do (x) += TWOPI; while ((x) < -PI); \
|
||||
else if ((x) > PI) \
|
||||
do (x) -= TWOPI; while ((x) > PI); \
|
||||
} while (0)
|
||||
|
||||
static double solve_keplers_equation(double M);
|
||||
static double mean_sun(double D);
|
||||
static double sun_ecliptic_longitude(time_t ssue);
|
||||
static void ecliptic_to_equatorial(double lambda, double beta,
|
||||
double *alpha, double *delta);
|
||||
static double julian_date(int y, int m, int d);
|
||||
static double GST(time_t ssue);
|
||||
|
||||
/*
|
||||
* solve Kepler's equation via Newton's method
|
||||
|
@ -120,10 +150,29 @@ static double solve_keplers_equation(double M)
|
|||
break;
|
||||
E -= delta / (1 - Eccentricity * cos(E));
|
||||
}
|
||||
|
||||
return E;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the position of the mean sun: where the sun would
|
||||
* be if the earth's orbit were circular instead of ellipictal.
|
||||
*/
|
||||
|
||||
static double mean_sun(double D)
|
||||
/* double D; days since ephemeris epoch */
|
||||
{
|
||||
double N, M;
|
||||
|
||||
N = RadsPerDay * D;
|
||||
N = fmod(N, TWOPI);
|
||||
if (N < 0)
|
||||
N += TWOPI;
|
||||
|
||||
M = N + Epsilon_g - OmegaBar_g;
|
||||
if (M < 0)
|
||||
M += TWOPI;
|
||||
return M;
|
||||
}
|
||||
|
||||
/*
|
||||
* compute ecliptic longitude of sun (in radians)
|
||||
|
@ -139,16 +188,10 @@ static double sun_ecliptic_longitude(time_t ssue)
|
|||
D = DaysSinceEpoch(ssue);
|
||||
|
||||
N = RadsPerDay * D;
|
||||
N = fmod(N, TWOPI);
|
||||
if (N < 0)
|
||||
N += TWOPI;
|
||||
|
||||
M_sun = N + Epsilon_g - OmegaBar_g;
|
||||
if (M_sun < 0)
|
||||
M_sun += TWOPI;
|
||||
|
||||
M_sun = mean_sun(D);
|
||||
E = solve_keplers_equation(M_sun);
|
||||
v = 2 * atan(sqrt((1 + Eccentricity) / (1 - Eccentricity)) * tan(E / 2));
|
||||
v = 2 * atan(sqrt((1 + Eccentricity) / (1 - Eccentricity)) *
|
||||
tan(E / 2));
|
||||
|
||||
return (v + OmegaBar_g);
|
||||
}
|
||||
|
@ -158,7 +201,8 @@ static double sun_ecliptic_longitude(time_t ssue)
|
|||
* convert from ecliptic to equatorial coordinates
|
||||
* (after duffett-smith, section 27)
|
||||
*/
|
||||
static void ecliptic_to_equatorial(double lambda, double beta, double *alpha, double *delta)
|
||||
static void ecliptic_to_equatorial(double lambda, double beta,
|
||||
double *alpha, double *delta)
|
||||
/*
|
||||
* double lambda; ecliptic longitude
|
||||
* double beta; ecliptic latitude
|
||||
|
@ -251,10 +295,10 @@ static double GST(time_t ssue)
|
|||
* epoch), compute position on the earth (lat, lon) such that sun is
|
||||
* directly overhead.
|
||||
*/
|
||||
void GetSunPos(time_t ssue, double *lat, double *lon)
|
||||
void sun_position(time_t ssue, double *lat, double *lon)
|
||||
/* time_t ssue; seconds since unix epoch */
|
||||
/* double *lat; (return) latitude */
|
||||
/* double *lon; (return) longitude */
|
||||
/* double *lat; (return) latitude in rad */
|
||||
/* double *lon; (return) longitude in rad */
|
||||
{
|
||||
double lambda;
|
||||
double alpha, delta;
|
||||
|
@ -264,15 +308,54 @@ void GetSunPos(time_t ssue, double *lat, double *lon)
|
|||
ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta);
|
||||
|
||||
tmp = alpha - (TWOPI / 24) * GST(ssue);
|
||||
if (tmp < -PI) {
|
||||
do
|
||||
tmp += TWOPI;
|
||||
while (tmp < -PI);
|
||||
} else if (tmp > PI) {
|
||||
do
|
||||
tmp -= TWOPI;
|
||||
while (tmp < -PI);
|
||||
}
|
||||
Normalize(tmp);
|
||||
*lon = tmp;
|
||||
*lat = delta;
|
||||
}
|
||||
|
||||
/*
|
||||
* given a particular time (expressed in seconds since the unix
|
||||
* epoch), compute position on the earth (lat, lon) such that the
|
||||
* moon is directly overhead.
|
||||
*
|
||||
* Based on duffett-smith **2nd ed** section 61; combines some steps
|
||||
* into single expressions to reduce the number of extra variables.
|
||||
*/
|
||||
void moon_position(time_t ssue, double *lat, double *lon)
|
||||
/* time_t ssue; seconds since unix epoch */
|
||||
/* double *lat; (return) latitude in ra */
|
||||
/* double *lon; (return) longitude in ra */
|
||||
{
|
||||
double lambda, beta;
|
||||
double D, L, Ms, Mm, N, Ev, Ae, Ec, alpha, delta;
|
||||
|
||||
D = DaysSinceEpoch(ssue);
|
||||
lambda = sun_ecliptic_longitude(ssue);
|
||||
Ms = mean_sun(D);
|
||||
|
||||
L = fmod(D / SideralMonth, 1.0) * TWOPI + MoonMeanLongitude;
|
||||
Normalize(L);
|
||||
Mm = L - DegsToRads(0.1114041 * D) - MoonMeanLongitudePerigee;
|
||||
Normalize(Mm);
|
||||
N = MoonMeanLongitudeNode - DegsToRads(0.0529539 * D);
|
||||
Normalize(N);
|
||||
Ev = DegsToRads(1.2739) * sin(2.0 * (L - lambda) - Mm);
|
||||
Ae = DegsToRads(0.1858) * sin(Ms);
|
||||
Mm += Ev - Ae - DegsToRads(0.37) * sin(Ms);
|
||||
Ec = DegsToRads(6.2886) * sin(Mm);
|
||||
L += Ev + Ec - Ae + DegsToRads(0.214) * sin(2.0 * Mm);
|
||||
L += DegsToRads(0.6583) * sin(2.0 * (L - lambda));
|
||||
N -= DegsToRads(0.16) * sin(Ms);
|
||||
|
||||
L -= N;
|
||||
lambda = (fabs(cos(L)) < 1e-12) ?
|
||||
(N + sin(L) * cos(MoonInclination) * PI / 2) :
|
||||
(N + atan2(sin(L) * cos(MoonInclination), cos(L)));
|
||||
Normalize(lambda);
|
||||
beta = asin(sin(L) * sin(MoonInclination));
|
||||
ecliptic_to_equatorial(lambda, beta, &alpha, &delta);
|
||||
alpha -= (TWOPI / 24) * GST(ssue);
|
||||
Normalize(alpha);
|
||||
*lon = alpha;
|
||||
*lat = delta;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,7 +35,9 @@
|
|||
#include "defnimap.xpm"
|
||||
#endif
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -81,6 +83,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
cmdline(argc, argv);
|
||||
|
||||
#if WITH_MARKERS
|
||||
if (nb_marker) {
|
||||
int i;
|
||||
for (i = 0; i < nb_marker; i++)
|
||||
if (i != moon_marker && i != sun_marker) {
|
||||
marker[i][0] = marker[i][0] * PI / 180.;
|
||||
marker[i][1] = marker[i][1] * PI / 180.;
|
||||
transform_marker(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (typecadre) {
|
||||
case 1:
|
||||
rond_bits = cadre1_bits;
|
||||
|
@ -95,13 +109,17 @@ int main(int argc, char *argv[])
|
|||
dlat = 0;
|
||||
dlong = 0;
|
||||
}
|
||||
|
||||
/* setup long term mem allocation */
|
||||
initmyconvert();
|
||||
|
||||
|
||||
tdelay.tv_sec = (int) floor(delay);
|
||||
tdelay.tv_usec = (int) ((delay - tdelay.tv_sec) * 1000000);
|
||||
aml = (int) floor(ambient_light * 256);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* ctx initialization */
|
||||
|
||||
if (!(dpy = XOpenDisplay(dpy_name))) {
|
||||
fprintf(stderr, "%s: can't open display \"%s\"\n",
|
||||
|
@ -112,7 +130,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ctx->attribs->use_shared_memory) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout, "enleve les flags use_shared_memory\n");
|
||||
fprintf(stdout, "remove flags use_shared_memory\n");
|
||||
#endif
|
||||
ctx->attribs->flags ^= RC_UseSharedMemory;
|
||||
ctx->attribs->use_shared_memory = FALSE;
|
||||
|
@ -125,11 +143,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
/*
|
||||
* loading maps .............
|
||||
*
|
||||
*/
|
||||
|
||||
if (dayfile != NULL) {
|
||||
map = RLoadImage(ctx, dayfile, 0);
|
||||
if (!use_default_nightmap)
|
||||
use_nightmap = FALSE;
|
||||
ripalpha(map);
|
||||
if (!map) {
|
||||
fprintf(stdout, "pb map ! file not found ?\n");
|
||||
exit(1);
|
||||
|
@ -137,43 +157,62 @@ int main(int argc, char *argv[])
|
|||
} else {
|
||||
#ifdef DEFMAPOK
|
||||
map = RGetImageFromXPMData(ctx, defmap_xpm);
|
||||
use_default_nightmap = TRUE;
|
||||
ripalpha(map);
|
||||
if (!map) {
|
||||
fprintf(stdout, "pb def map ! file not found ?\n");
|
||||
exit(1);
|
||||
}
|
||||
nightfile = NULL;
|
||||
use_nightmap = TRUE;
|
||||
}
|
||||
#else
|
||||
fprintf(stdout, "need a map !\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!oknimap) {
|
||||
use_nightmap = FALSE;
|
||||
use_default_nightmap = FALSE;
|
||||
}
|
||||
if (use_nightmap) {
|
||||
if (nightfile != NULL) {
|
||||
mapnight = RLoadImage(ctx, nightfile, 0);
|
||||
ripalpha(mapnight);
|
||||
if (!mapnight) {
|
||||
fprintf(stdout, "pb map night! file not found ?\n");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
#ifdef DEFMAPOK
|
||||
if (use_default_nightmap) {
|
||||
mapnight = RGetImageFromXPMData(ctx, defnimap_xpm);
|
||||
ripalpha(mapnight);
|
||||
if (!mapnight) {
|
||||
fprintf(stdout, "pb def map night ! file not found ?\n");
|
||||
fprintf(stdout,
|
||||
"pb def map night ! file not found ?\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* not very useful... */
|
||||
use_nightmap = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
use_nmap_ini = use_nightmap;
|
||||
if (!oknimap)
|
||||
use_nightmap = FALSE;
|
||||
|
||||
/* we need a night map of same size as day map */
|
||||
if (mapnight) {
|
||||
if ((mapnight->width != map->width)
|
||||
|| (mapnight->height != map->height)) {
|
||||
RImage *tmp;
|
||||
tmp = mapnight;
|
||||
mapnight = RScaleImage(tmp, map->width, map->height);
|
||||
RReleaseImage(tmp);
|
||||
ripalpha(mapnight);
|
||||
}
|
||||
}
|
||||
|
||||
/* some other init ..................................... */
|
||||
ratiox = (double) map->width / (2 * PI);
|
||||
ratioy = (double) map->height / PI;
|
||||
|
@ -181,25 +220,22 @@ int main(int argc, char *argv[])
|
|||
mratioy = (int) floor(ratioy * 256);
|
||||
loadxpm(ctx->drawable);
|
||||
|
||||
small = RCreateImage(DIAMETRE, DIAMETRE, 1);
|
||||
small = RCreateImage(DIAMETRE, DIAMETRE, 0);
|
||||
|
||||
calcDistance();
|
||||
/*...................................................... */
|
||||
|
||||
/*
|
||||
* first rendering of the earth
|
||||
*/
|
||||
rotation_terre(DIAMETRE / 2, DIAMETRE / 2, 0);
|
||||
recalc(0);
|
||||
do_something = FALSE;
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* well, here the problems begin : this code is a merge from wmgeneral and
|
||||
* some stuff of wmaker, should be rewritten ...
|
||||
************************************************************************/
|
||||
|
||||
/* wmg */
|
||||
|
||||
XGetWindowAttributes(dpy, ctx->drawable, &attributes);
|
||||
|
||||
if (!RConvertImage(ctx, small, &pix)) {
|
||||
|
@ -233,16 +269,21 @@ int main(int argc, char *argv[])
|
|||
fore_pix = color.pixel;
|
||||
|
||||
|
||||
XWMGeometry(dpy, ctx->screen_number, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.height, &dummy);
|
||||
XWMGeometry(dpy, ctx->screen_number, Geometry, NULL, borderwidth,
|
||||
&mysizehints, &mysizehints.x, &mysizehints.y,
|
||||
&mysizehints.width, &mysizehints.height, &dummy);
|
||||
mysizehints.width = DIAMETRE;
|
||||
mysizehints.height = DIAMETRE;
|
||||
|
||||
win = XCreateSimpleWindow(dpy, ctx->drawable, mysizehints.x, mysizehints.y,
|
||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||
win =
|
||||
XCreateSimpleWindow(dpy, ctx->drawable, mysizehints.x,
|
||||
mysizehints.y, mysizehints.width,
|
||||
mysizehints.height, borderwidth, fore_pix,
|
||||
back_pix);
|
||||
|
||||
iconwin = XCreateSimpleWindow(dpy, win, mysizehints.x, mysizehints.y,
|
||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||
mysizehints.width, mysizehints.height,
|
||||
borderwidth, fore_pix, back_pix);
|
||||
|
||||
/* Activate hints */
|
||||
XSetWMNormalHints(dpy, win, &mysizehints);
|
||||
|
@ -250,8 +291,12 @@ int main(int argc, char *argv[])
|
|||
classHint.res_class = wname;
|
||||
XSetClassHint(dpy, win, &classHint);
|
||||
|
||||
XSelectInput(dpy, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
||||
XSelectInput(dpy, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
||||
XSelectInput(dpy, win,
|
||||
ButtonPressMask | ExposureMask | ButtonReleaseMask |
|
||||
PointerMotionMask | StructureNotifyMask);
|
||||
XSelectInput(dpy, iconwin,
|
||||
ButtonPressMask | ExposureMask | ButtonReleaseMask |
|
||||
PointerMotionMask | StructureNotifyMask);
|
||||
|
||||
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
|
||||
fprintf(stdout, "%s: can't allocate window name\n", wname);
|
||||
|
@ -269,9 +314,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* ONLYSHAPE ON */
|
||||
if (onlyshape) {
|
||||
pixmask = XCreateBitmapFromData(dpy, win, rond_bits, DIAMETRE, DIAMETRE);
|
||||
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||
XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||
pixmask =
|
||||
XCreateBitmapFromData(dpy, win, rond_bits, DIAMETRE, DIAMETRE);
|
||||
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask,
|
||||
ShapeSet);
|
||||
XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask,
|
||||
ShapeSet);
|
||||
}
|
||||
/* ONLYSHAPE OFF */
|
||||
|
||||
|
@ -280,18 +328,17 @@ int main(int argc, char *argv[])
|
|||
mywmhints.icon_x = mysizehints.x;
|
||||
mywmhints.icon_y = mysizehints.y;
|
||||
mywmhints.window_group = win;
|
||||
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
|
||||
mywmhints.flags =
|
||||
StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
|
||||
|
||||
XSetWMHints(dpy, win, &mywmhints);
|
||||
|
||||
XSetCommand(dpy, win, argv, argc);
|
||||
XMapWindow(dpy, win);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
XCopyArea(dpy, wmg.pixmap, win, NormalGC, 0, 0, DIAMETRE, DIAMETRE, 0, 0);
|
||||
|
||||
XCopyArea(dpy, wmg.pixmap, win, NormalGC, 0, 0, DIAMETRE, DIAMETRE, 0,
|
||||
0);
|
||||
|
||||
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
|
||||
|
||||
|
@ -355,7 +402,8 @@ int main(int argc, char *argv[])
|
|||
if (wait_release) {
|
||||
usleep(2 * VAL_USLEEP_SHORT);
|
||||
if (redoaction == 1)
|
||||
rotation_terre(Event.xbutton.x, Event.xbutton.y, move_lat_flag);
|
||||
rotation_terre(Event.xbutton.x, Event.xbutton.y,
|
||||
move_lat_flag);
|
||||
else
|
||||
zooming(Event.xbutton.state & ShiftMask);
|
||||
ok = TRUE;
|
||||
|
@ -365,8 +413,8 @@ int main(int argc, char *argv[])
|
|||
recalc(redoaction == 1);
|
||||
if (do_something) {
|
||||
if (!myRConvertImage(ctx, small, &pix)) {
|
||||
fprintf(stdout, "plante !?\n");
|
||||
fprintf(stdout, RMessageForError(RErrorCode));
|
||||
fprintf(stderr, "crash !?\n");
|
||||
fprintf(stderr, RMessageForError(RErrorCode));
|
||||
exit(1);
|
||||
}
|
||||
wmg.pixmap = pix;
|
||||
|
@ -380,8 +428,5 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
usleep(VAL_USLEEP);
|
||||
}
|
||||
/*
|
||||
* Still wonder about freeing some memory for X
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -51,13 +51,15 @@
|
|||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define STRONG 2
|
||||
#define MAX(x, y) ((x) < (y) ? (y) : (x))
|
||||
#define MIN(x, y) ((x) > (y) ? (y) : (x))
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
|
||||
#define PTFIXED 1
|
||||
#define PTSUNREL 2
|
||||
#define PTSUN 2
|
||||
#define PTRANDOM 3
|
||||
#define PTMOON 4
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.141592653
|
||||
|
@ -89,19 +91,16 @@ typedef struct MPO {
|
|||
|
||||
MPO *md[4], *mn[4];
|
||||
|
||||
double soluce[DIAMETRE / 2][DIAMETRE][4];
|
||||
double solu[DIAMETRE][DIAMETRE][3];
|
||||
int tabsolu[DIAMETRE][DIAMETRE];
|
||||
int solution;
|
||||
|
||||
/************/
|
||||
|
||||
typedef struct {
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
XpmAttributes attributes;
|
||||
} XpmIcon;
|
||||
|
||||
/************/
|
||||
|
||||
|
||||
Display *dpy;
|
||||
|
||||
|
@ -121,6 +120,13 @@ GC NormalGC;
|
|||
|
||||
/********* rendering********/
|
||||
|
||||
#if WITH_MARKERS
|
||||
double marker[MAX_MARKERS][3];
|
||||
int nb_marker, sun_marker, moon_marker;
|
||||
RColor sun_col, moon_col;
|
||||
double moon_lat,moon_long;
|
||||
#endif
|
||||
|
||||
double delay, time_multi;
|
||||
/*
|
||||
* struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
|
||||
|
@ -133,8 +139,8 @@ time_t tsunpos;
|
|||
|
||||
int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
|
||||
|
||||
int typecadre, p_type, use_nightmap, use_nmap_ini, firstTime, stoprand,
|
||||
do_something, iop;
|
||||
int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini,
|
||||
firstTime, stoprand, do_something, iop;
|
||||
|
||||
double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
|
||||
double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn;
|
||||
|
@ -161,11 +167,14 @@ RColor noir;
|
|||
double minhz;
|
||||
#endif
|
||||
|
||||
int stable;
|
||||
|
||||
/****************************************************************/
|
||||
/* Function Prototypes */
|
||||
/****************************************************************/
|
||||
int main(int argc, char *argv[]);
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
void AddMouseRegion(int index, int left, int top, int right, int bottom);
|
||||
int CheckMouseRegion(int x, int y);
|
||||
void RedrawWindowXYWH(int x, int y, int w, int h);
|
||||
|
@ -179,7 +188,7 @@ struct timeval diftimev(struct timeval t1, struct timeval t2);
|
|||
struct timeval addtimev(struct timeval t1, struct timeval t2);
|
||||
struct timeval getimev();
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
void setZoom(double z);
|
||||
void calcDistance();
|
||||
void renderFrame();
|
||||
|
@ -189,9 +198,14 @@ RContext *myRCreateContext
|
|||
(Display * dpy, int screen_number, RContextAttributes * attribs);
|
||||
void setTime(struct timeval t);
|
||||
void recalc(int calme);
|
||||
void GetSunPos(time_t ssue, double *lat, double *lon);
|
||||
void sun_position(time_t ssue, double *lat, double *lon);
|
||||
void moon_position(time_t ssue, double *lat, double *lon);
|
||||
void transform_marker(int m);
|
||||
void setViewPos(double lat, double lon);
|
||||
|
||||
/***************************************************************/
|
||||
int ripalpha(RImage * image);
|
||||
RImage*
|
||||
RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
|
||||
void
|
||||
RReleaseImage(RImage *image);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* WMGlobe 0.5 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +20,7 @@
|
|||
* #define DEBUG
|
||||
*/
|
||||
|
||||
#define WMGVERSION "WMGlobe v.0.5 6 fev 1999 <jerome.dumonteil@capway.com>"
|
||||
#define WMGVERSION "WMGlobe v.1.3 12 aug 2001 <jerome.dumonteil@linuxfr.org>"
|
||||
|
||||
/*
|
||||
* comment DEFMAPOK to not install the built-in default maps,
|
||||
|
@ -64,14 +64,27 @@
|
|||
#define STOP_RANDOM_FACTOR 1
|
||||
#define RATIO_ROTATE 0.5
|
||||
|
||||
/* Markers */
|
||||
#define WITH_MARKERS 1 /* put to 0 to remove markers code */
|
||||
#define CROSS_LENGTH 8 /* min 2 */
|
||||
#define CROSS_INVERT 0 /* 0: black/white, 1: inv. color */
|
||||
#define MAX_MARKERS 5
|
||||
#define CR_SUN_R 255 /* sun cross color */
|
||||
#define CR_SUN_G 255
|
||||
#define CR_SUN_B 127
|
||||
#define CR_MOON_R 0 /* moon cross color */
|
||||
#define CR_MOON_G 200
|
||||
#define CR_MOON_B 255
|
||||
|
||||
|
||||
/* some default values*/
|
||||
#define DEFAULT_DELAY 1.0
|
||||
#define DEFAULT_V_LAT 0.0
|
||||
#define DEFAULT_V_LONG 0.0
|
||||
#define DEFAULT_SENS 1
|
||||
#define DEFAULT_ZOOM 1.0
|
||||
#define DEFAULT_LIGHT 0.25
|
||||
#define DEFAULT_BORDER 0
|
||||
#define DEFAULT_BORDER 2
|
||||
#define DEFAULT_NIGHTMAP 1 /* 1 or 0 */
|
||||
|
||||
#define MAX_DELAY_SEC 86400.0
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,398 +0,0 @@
|
|||
|
||||
/*
|
||||
* Raster graphics library
|
||||
*
|
||||
* Copyright (c) 1997, 1998 Alfredo K. Kojima
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Environment variables:
|
||||
*
|
||||
* WRASTER_GAMMA <rgamma>/<ggamma>/<bgamma>
|
||||
* gamma correction value. Must be greater than 0
|
||||
* Only for PseudoColor visuals.
|
||||
*
|
||||
* Default:
|
||||
* WRASTER_GAMMA 1/1/1
|
||||
*
|
||||
*
|
||||
* If you want a specific value for a screen, append the screen number
|
||||
* preceded by a hash to the variable name as in
|
||||
* WRASTER_GAMMA#1
|
||||
* for screen number 1
|
||||
*/
|
||||
|
||||
#ifndef RLRASTER_H_
|
||||
#define RLRASTER_H_
|
||||
|
||||
|
||||
/* version of the header for the library: 0.11 */
|
||||
#define WRASTER_HEADER_VERSION 11
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef XSHM
|
||||
#include <X11/extensions/XShm.h>
|
||||
#endif
|
||||
|
||||
/* RM_MATCH or RM_DITHER */
|
||||
#define RC_RenderMode (1<<0)
|
||||
|
||||
/* number of colors per channel for colormap in PseudoColor mode */
|
||||
#define RC_ColorsPerChannel (1<<1)
|
||||
|
||||
/* do gamma correction */
|
||||
#define RC_GammaCorrection (1<<2)
|
||||
|
||||
/* visual id to use */
|
||||
#define RC_VisualID (1<<3)
|
||||
|
||||
/* shared memory usage */
|
||||
#define RC_UseSharedMemory (1<<4)
|
||||
|
||||
/* use default instead of best visual */
|
||||
#define RC_DefaultVisual (1<<5)
|
||||
|
||||
typedef struct RContextAttributes {
|
||||
int flags;
|
||||
int render_mode;
|
||||
int colors_per_channel; /* for PseudoColor */
|
||||
float rgamma; /* gamma correction for red, */
|
||||
float ggamma; /* green, */
|
||||
float bgamma; /* and blue */
|
||||
VisualID visualid; /* visual ID to use */
|
||||
int use_shared_memory; /* True of False */
|
||||
} RContextAttributes;
|
||||
|
||||
|
||||
/*
|
||||
* describes a screen in terms of depth, visual, number of colors
|
||||
* we can use, if we should do dithering, and what colors to use for
|
||||
* dithering.
|
||||
*/
|
||||
typedef struct RContext {
|
||||
Display *dpy;
|
||||
int screen_number;
|
||||
Colormap cmap;
|
||||
|
||||
RContextAttributes *attribs;
|
||||
|
||||
GC copy_gc;
|
||||
|
||||
Visual *visual;
|
||||
int depth;
|
||||
Window drawable; /* window to pass for XCreatePixmap(). */
|
||||
/* generally = root */
|
||||
int vclass;
|
||||
|
||||
unsigned long black;
|
||||
unsigned long white;
|
||||
|
||||
int red_offset; /* only used in 24bpp */
|
||||
int green_offset;
|
||||
int blue_offset;
|
||||
|
||||
/* only used for pseudocolor and grayscale */
|
||||
|
||||
XStandardColormap *std_rgb_map; /* standard RGB colormap */
|
||||
XStandardColormap *std_gray_map; /* standard grayscale colormap */
|
||||
|
||||
int ncolors; /* total number of colors we can use */
|
||||
XColor *colors; /* internal colormap */
|
||||
|
||||
struct {
|
||||
unsigned int use_shared_pixmap:1;
|
||||
} flags;
|
||||
} RContext;
|
||||
|
||||
|
||||
typedef struct RColor {
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
unsigned char alpha;
|
||||
} RColor;
|
||||
|
||||
|
||||
typedef struct RHSVColor {
|
||||
unsigned short hue; /* 0-359 */
|
||||
unsigned char saturation; /* 0-255 */
|
||||
unsigned char value; /* 0-255 */
|
||||
} RHSVColor;
|
||||
|
||||
|
||||
|
||||
typedef struct RPoint {
|
||||
int x, y;
|
||||
} RPoint;
|
||||
|
||||
|
||||
typedef struct RSegment {
|
||||
int x1, y1, x2, y2;
|
||||
} RSegment;
|
||||
|
||||
|
||||
/*
|
||||
* internal 24bit+alpha image representation
|
||||
*/
|
||||
typedef struct RImage {
|
||||
unsigned width, height; /* size of the image */
|
||||
RColor background; /* background color */
|
||||
unsigned char *data[4]; /* image data (R,G,B,A) */
|
||||
} RImage;
|
||||
|
||||
|
||||
/*
|
||||
* internal wrapper for XImage. Used for shm abstraction
|
||||
*/
|
||||
typedef struct RXImage {
|
||||
XImage *image;
|
||||
|
||||
/* Private data. Do not access */
|
||||
#ifdef XSHM
|
||||
XShmSegmentInfo info;
|
||||
char is_shared;
|
||||
#endif
|
||||
} RXImage;
|
||||
|
||||
|
||||
/* note that not all operations are supported in all functions */
|
||||
enum {
|
||||
RClearOperation, /* clear with 0 */
|
||||
RCopyOperation,
|
||||
RNormalOperation, /* same as combine */
|
||||
RAddOperation,
|
||||
RSubtractOperation
|
||||
};
|
||||
|
||||
|
||||
/* image display modes */
|
||||
enum {
|
||||
RDitheredRendering = 0,
|
||||
RBestMatchRendering = 1
|
||||
};
|
||||
|
||||
/* bw compat */
|
||||
#define RM_DITHER RDitheredRendering
|
||||
#define RM_MATCH RBestMatchRendering
|
||||
|
||||
enum {
|
||||
RAbsoluteCoordinates = 0,
|
||||
RRelativeCoordinates = 1
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
RSunkenBevel = -1,
|
||||
RRaisedBevel = 1
|
||||
};
|
||||
|
||||
/* bw compat */
|
||||
#define RBEV_SUNKEN RSunkenBevel
|
||||
/* 1 pixel wide */
|
||||
#define RBEV_RAISED RRaisedBevel
|
||||
/* 1 pixel wide on top/left 2 on bottom/right */
|
||||
#define RBEV_RAISED2 2
|
||||
/* 2 pixel width */
|
||||
#define RBEV_RAISED3 3
|
||||
|
||||
enum {
|
||||
RHorizontalGradient = 2,
|
||||
RVerticalGradient = 3,
|
||||
RDiagonalGradient = 4
|
||||
};
|
||||
|
||||
/* for backwards compatibility */
|
||||
#define RGRD_HORIZONTAL RHorizontalGradient
|
||||
#define RGRD_VERTICAL RVerticalGradient
|
||||
#define RGRD_DIAGONAL RDiagonalGradient
|
||||
|
||||
|
||||
|
||||
/* error codes */
|
||||
#define RERR_NONE 0
|
||||
#define RERR_OPEN 1 /* cant open file */
|
||||
#define RERR_READ 2 /* error reading from file */
|
||||
#define RERR_WRITE 3 /* error writing to file */
|
||||
#define RERR_NOMEMORY 4 /* out of memory */
|
||||
#define RERR_NOCOLOR 5 /* out of color cells */
|
||||
#define RERR_BADIMAGEFILE 6 /* image file is corrupted or invalid */
|
||||
#define RERR_BADFORMAT 7 /* image file format is unknown */
|
||||
#define RERR_BADINDEX 8 /* no such image index in file */
|
||||
|
||||
#define RERR_BADVISUALID 16 /* invalid visual ID requested for context */
|
||||
|
||||
#define RERR_XERROR 127 /* internal X error */
|
||||
#define RERR_INTERNAL 128 /* should not happen */
|
||||
|
||||
|
||||
/*
|
||||
* Returns a NULL terminated array of strings containing the
|
||||
* supported formats, such as: TIFF, XPM, PNG, JPEG, PPM, GIF
|
||||
*/
|
||||
char **RSupportedFileFormats(void);
|
||||
|
||||
void RFreeStringList(char **list);
|
||||
|
||||
/*
|
||||
* Xlib contexts
|
||||
*/
|
||||
RContext *RCreateContext(Display * dpy, int screen_number,
|
||||
RContextAttributes * attribs);
|
||||
|
||||
void RDestroyContext(RContext * context);
|
||||
|
||||
Bool RGetClosestXColor(RContext * context, RColor * color, XColor * retColor);
|
||||
|
||||
/*
|
||||
* RImage creation
|
||||
*/
|
||||
RImage *RCreateImage(unsigned width, unsigned height, int alpha);
|
||||
|
||||
RImage *RCreateImageFromXImage(RContext * context, XImage * image, XImage * mask);
|
||||
|
||||
RImage *RCreateImageFromDrawable(RContext * context, Drawable drawable,
|
||||
Pixmap mask);
|
||||
|
||||
RImage *RLoadImage(RContext * context, char *file, int index);
|
||||
|
||||
|
||||
void RDestroyImage(RImage * image);
|
||||
|
||||
RImage *RGetImageFromXPMData(RContext * context, char **data);
|
||||
|
||||
/*
|
||||
* RImage storing
|
||||
*/
|
||||
Bool RSaveImage(RImage * image, char *filename, char *format);
|
||||
|
||||
/*
|
||||
* Area manipulation
|
||||
*/
|
||||
RImage *RCloneImage(RImage * image);
|
||||
|
||||
RImage *RGetSubImage(RImage * image, int x, int y, unsigned width,
|
||||
unsigned height);
|
||||
|
||||
void RCombineImageWithColor(RImage * image, RColor * color);
|
||||
|
||||
void RCombineImages(RImage * image, RImage * src);
|
||||
|
||||
void RCombineArea(RImage * image, RImage * src, int sx, int sy, unsigned width,
|
||||
unsigned height, int dx, int dy);
|
||||
|
||||
void RCombineImagesWithOpaqueness(RImage * image, RImage * src, int opaqueness);
|
||||
|
||||
void RCombineAreaWithOpaqueness(RImage * image, RImage * src, int sx, int sy,
|
||||
unsigned width, unsigned height, int dx, int dy,
|
||||
int opaqueness);
|
||||
|
||||
RImage *RScaleImage(RImage * image, unsigned new_width, unsigned new_height);
|
||||
|
||||
RImage *RMakeTiledImage(RImage * tile, unsigned width, unsigned height);
|
||||
|
||||
RImage *RMakeCenteredImage(RImage * image, unsigned width, unsigned height,
|
||||
RColor * color);
|
||||
|
||||
/*
|
||||
* Drawing
|
||||
*/
|
||||
Bool RGetPixel(RImage * image, int x, int y, RColor * color);
|
||||
|
||||
void RPutPixel(RImage * image, int x, int y, RColor * color);
|
||||
|
||||
void ROperatePixel(RImage * image, int operation, int x, int y, RColor * color);
|
||||
|
||||
void RPutPixels(RImage * image, RPoint * points, int npoints, int mode,
|
||||
RColor * color);
|
||||
|
||||
void ROperatePixels(RImage * image, int operation, RPoint * points,
|
||||
int npoints, int mode, RColor * color);
|
||||
|
||||
int RDrawLine(RImage * image, int x0, int y0, int x1, int y1, RColor * color);
|
||||
|
||||
int ROperateLine(RImage * image, int operation, int x0, int y0, int x1, int y1,
|
||||
RColor * color);
|
||||
|
||||
void RDrawLines(RImage * image, RPoint * points, int npoints, int mode,
|
||||
RColor * color);
|
||||
|
||||
void ROperateLines(RImage * image, int operation, RPoint * points, int npoints,
|
||||
int mode, RColor * color);
|
||||
|
||||
void RDrawSegments(RImage * image, RSegment * segs, int nsegs, RColor * color);
|
||||
|
||||
void ROperateSegments(RImage * image, int operation, RSegment * segs, int nsegs,
|
||||
RColor * color);
|
||||
|
||||
/*
|
||||
* Color convertion
|
||||
*/
|
||||
void RRGBtoHSV(RColor * color, RHSVColor * hsv);
|
||||
void RHSVtoRGB(RHSVColor * hsv, RColor * rgb);
|
||||
|
||||
/*
|
||||
* Painting
|
||||
*/
|
||||
void RClearImage(RImage * image, RColor * color);
|
||||
|
||||
void RBevelImage(RImage * image, int bevel_type);
|
||||
|
||||
RImage *RRenderGradient(unsigned width, unsigned height, RColor * from,
|
||||
RColor * to, int style);
|
||||
|
||||
|
||||
RImage *RRenderMultiGradient(unsigned width, unsigned height, RColor ** colors,
|
||||
int style);
|
||||
|
||||
/*
|
||||
* Convertion into X Pixmaps
|
||||
*/
|
||||
int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
|
||||
|
||||
int RConvertImageMask(RContext * context, RImage * image, Pixmap * pixmap,
|
||||
Pixmap * mask, int threshold);
|
||||
|
||||
|
||||
/*
|
||||
* misc. utilities
|
||||
*/
|
||||
RXImage *RCreateXImage(RContext * context, int depth,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
void RDestroyXImage(RContext * context, RXImage * ximage);
|
||||
|
||||
void RPutXImage(RContext * context, Drawable d, GC gc, RXImage * ximage,
|
||||
int src_x, int src_y, int dest_x, int dest_y,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
/* do not free the returned string! */
|
||||
const char *RMessageForError(int errorCode);
|
||||
|
||||
int RBlurImage(RImage * image);
|
||||
|
||||
/****** Global Variables *******/
|
||||
|
||||
extern int RErrorCode;
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/* WMGlobe 0.5.pre1 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com>
|
||||
/* WMGlobe 1.3 - All the Earth on a WMaker Icon
|
||||
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,8 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
***************************************************************************/
|
||||
|
||||
int zapnum[14][4] =
|
||||
{
|
||||
int zapnum[14][4] = {
|
||||
{90, 0, 10, 13},
|
||||
{0, 0, 10, 13},
|
||||
{10, 0, 10, 13},
|
||||
|
@ -54,27 +53,23 @@ int zapnum[14][4] =
|
|||
* };
|
||||
*/
|
||||
|
||||
int platd[4][2] =
|
||||
{
|
||||
int platd[4][2] = {
|
||||
{2, 12},
|
||||
{6, 12},
|
||||
{16, 12},
|
||||
{26, 12}
|
||||
};
|
||||
int platm[2][2] =
|
||||
{
|
||||
int platm[2][2] = {
|
||||
{42, 12},
|
||||
{52, 12}
|
||||
};
|
||||
int plongd[4][2] =
|
||||
{
|
||||
int plongd[4][2] = {
|
||||
{2, 36},
|
||||
{6, 36},
|
||||
{16, 36},
|
||||
{26, 36}
|
||||
};
|
||||
int plongm[2][2] =
|
||||
{
|
||||
int plongm[2][2] = {
|
||||
{42, 36},
|
||||
{52, 36}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.TH WMGlobe 1 "fevrier 1999"
|
||||
.TH WMGlobe 1.3 "august 2001"
|
||||
.SH NAME
|
||||
WMGlobe - The Whole Earth spinning on you desktop...
|
||||
as a dockable app for WindowMaker
|
||||
|
@ -14,7 +14,7 @@ rendered on a sphere by raytracing. Yes, for a 64x64 pixel result:-)
|
|||
.B \-v
|
||||
version. Currently, this should display :
|
||||
|
||||
WMGlobe v.0.5 6 fev 1999 <jerome.dumonteil@capway.com>
|
||||
WMGlobe v.1.3 12 aug 2001 <jerome.dumonteil@linuxfr.org>
|
||||
.TP
|
||||
.B \-h
|
||||
short help
|
||||
|
@ -28,11 +28,18 @@ the sun rotation. Accepted values in the form 45
|
|||
Default: the initial position is "under" the sun, and
|
||||
the point of view follows the sun.
|
||||
.TP
|
||||
.B \-sun
|
||||
The point of view follows the Sun (default).
|
||||
.TP
|
||||
.B \-moon
|
||||
The point of view follows the Moon (i.e. you see the Earth as you
|
||||
were on the Moon).
|
||||
.TP
|
||||
.B \-rand
|
||||
New random position at every refresh of screen.
|
||||
.TP
|
||||
.B \-map \fI map_file\fP
|
||||
Map used for the rendering. Can be JPEG, GIG, XPM
|
||||
Map used for the rendering. Can be JPEG, GIF, XPM
|
||||
PNM, TIFF but none BMP.
|
||||
Default: use internal map of earth.
|
||||
.TP
|
||||
|
@ -41,8 +48,9 @@ Map used for the dark side of the earth. Must be of
|
|||
the same width x height as the day side map.
|
||||
Default: if the default internal day map is used, use
|
||||
a default internal night file (see -nonimap option).
|
||||
If a custom day map is provided, and no night map, the
|
||||
dark side is computed via the -light option.
|
||||
.TP
|
||||
.B \-defnimap
|
||||
Use the default night map (with a custom map).
|
||||
.TP
|
||||
.B \-nonimap
|
||||
Don't use the default night map.
|
||||
|
@ -84,7 +92,7 @@ Default: 0.2
|
|||
.TP
|
||||
.B \-bord \fI border_num\fP
|
||||
0 1 or 2. There are 3 different borders for the icon.
|
||||
Default: 0
|
||||
Default: 2
|
||||
.TP
|
||||
.B \-accel \fI time_multi\fP
|
||||
Time warp factor. With -accel 24, the sun make a full
|
||||
|
@ -97,6 +105,13 @@ WMGlobe is Y2K compliant without changing system time.
|
|||
Negative values for dates before 1970 accepted.
|
||||
Default: not set, use current time.
|
||||
.TP
|
||||
.B \-mk \fI latitude longitude\fP
|
||||
Put a fixed marker at latitude/longitude.
|
||||
-mk sun : put a marker under the Sun position.
|
||||
-mk moon : put a marker under the Moon.
|
||||
5 markers can be defined simultaneously, so you can
|
||||
use wmglobe to predict when Moon will meet the Sun :-)
|
||||
.TP
|
||||
.B \-fun \fI dx dy\fP
|
||||
Move the earth image by dx dy pixels in the icon. See
|
||||
puzzle.sh to understand why.
|
||||
|
@ -104,6 +119,9 @@ puzzle.sh to understand why.
|
|||
.B \-oz
|
||||
Start in "austral" mode (for "down under" people)
|
||||
.TP
|
||||
.B \-stable
|
||||
Keep the globe from going over the poles.
|
||||
.TP
|
||||
.B \-d \fI display\fP
|
||||
Select another display
|
||||
.TP
|
||||
|
@ -147,7 +165,7 @@ dimensions.
|
|||
where to find the sources of wmglobe:
|
||||
the web page of WMGlobe (made by Sylvestre Taburet):
|
||||
|
||||
<http://www.capway.com/dumonte1/wm/wmg.html>
|
||||
<http://perso.linuxfr.org/jdumont/wmg/>
|
||||
|
||||
|
||||
where to find maps and similar softs:
|
||||
|
@ -173,7 +191,8 @@ By the way, you can use maps of Mars, Luna ... and text.
|
|||
.LP
|
||||
WMGlobe uses the setlocale(3) function, so you LANG environment need to be ok.
|
||||
|
||||
You need WindowMaker 0.20.3 or 0.51.0 installed to use WMGlobe.
|
||||
You need WindowMaker 0.62 or higher to use WMGlobe. (use WMGlobe 1.0 for
|
||||
older versions of WindowMaker).
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
The Window Maker User Guide
|
||||
|
@ -181,7 +200,7 @@ The Window Maker User Guide
|
|||
The Window Maker FAQ
|
||||
|
||||
.SH "AUTHOR"
|
||||
jerome dumonteil <jerome.dumonteil@capway.com>
|
||||
jerome dumonteil <jerome.dumonteil@linuxfr.org>
|
||||
|
||||
Patches, bug reports, and suggestions are welcome.
|
||||
|
||||
|
@ -192,7 +211,9 @@ Read the COPYING file for the complete GNU license.
|
|||
|
||||
Original idea, tests, logos:
|
||||
|
||||
Sylvestre Taburet <staburet@consort.fr>
|
||||
Sylvestre Taburet <Sylvestre.Taburet@free.fr>
|
||||
|
||||
WindowMaker 0.62 fix : Charles G Waldman <cgw@fnal.gov>
|
||||
|
||||
The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
|
||||
|
||||
|
@ -238,5 +259,6 @@ and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
|
|||
when the date go over year 2038. The expected result is wmglobe
|
||||
continuing smoothly from 1901.
|
||||
|
||||
Using WMGlobe at high speed through a LAN may induce some load on the net.
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 202 B |
BIN
wmglobe/wmgmap.jpeg
Normal file
BIN
wmglobe/wmgmap.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue