2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <intuition/intuition.h>
7 #include <graphics/gfx.h>
8 #include <cybergraphx/cybergraphics.h>
9 #include <proto/exec.h>
10 #include <proto/graphics.h>
11 #include <proto/intuition.h>
12 #include <proto/cybergraphics.h>
16 struct IntuitionBase
*IntuitionBase
;
17 struct GfxBase
*GfxBase
;
18 struct Library
*CyberGfxBase
;
22 #include "ilbmtoc_image.c"
24 UBYTE unpacked_image
[EARTHMAP_SMALL_WIDTH
* EARTHMAP_SMALL_HEIGHT
];
26 #define CONTINENT_RED 18
27 #define CONTINENT_GREEN 114
28 #define CONTINENT_BLUE 58
31 #define OCEAN_GREEN 18
32 #define OCEAN_BLUE 114
34 static unsigned char *unpack_byterun1(unsigned char *source
, unsigned char *dest
, LONG unpackedsize
)
41 c
= (signed char)(*source
++);
47 if (--unpackedsize
<= 0) return source
;
58 if (--unpackedsize
<= 0) return source
;
67 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 39);
68 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 39);
69 CyberGfxBase
= OpenLibrary("cybergraphics.library", 39);
71 if (IntuitionBase
&& GfxBase
&& CyberGfxBase
)
73 printf("All libraries opened\n");
75 win
= OpenWindowTags(0, WA_InnerWidth
, EARTHMAP_SMALL_WIDTH
,
76 WA_InnerHeight
, EARTHMAP_SMALL_HEIGHT
,
80 WA_IDCMP
, IDCMP_CLOSEWINDOW
,
86 unpack_byterun1(earthmap_small_data
, unpacked_image
, EARTHMAP_SMALL_WIDTH
* EARTHMAP_SMALL_HEIGHT
);
91 for(i
= 0; i
< EARTHMAP_SMALL_COLORS
; i
++)
93 ULONG rgb
= earthmap_small_pal
[i
];
94 ULONG red
= (rgb
& 0xFF0000) >> 16;
95 ULONG green
= (rgb
& 0x00FF00) >> 8;
96 ULONG blue
= (rgb
& 0x0000FF);
97 ULONG alpha
= (red
+ green
+ blue
) / 3;
99 red
= (alpha
* OCEAN_RED
+ (255 - alpha
) * CONTINENT_RED
) / 255;
100 green
= (alpha
* OCEAN_GREEN
+ (255 - alpha
) * CONTINENT_GREEN
) / 255;
101 blue
= (alpha
* OCEAN_BLUE
+ (255 - alpha
) * CONTINENT_BLUE
) / 255;
103 rgb
= (red
<< 16) + (green
<< 8) + blue
;
105 earthmap_small_pal
[i
] = rgb
;
110 WriteLUTPixelArray(unpacked_image
,
113 EARTHMAP_SMALL_WIDTH
,
118 EARTHMAP_SMALL_WIDTH
,
119 EARTHMAP_SMALL_HEIGHT
,
122 WaitPort(win
->UserPort
);