preferences, registry

This commit is contained in:
nothings.org 2007-06-30 19:21:21 +00:00
parent 914b3290bf
commit 1ea6375d82
5 changed files with 534 additions and 34 deletions

264
imv.c
View File

@ -30,6 +30,7 @@
#include "stb.h" /* http://nothings.org/stb.h */
#include "stb_image.c" /* http://nothings.org/stb_image.c */
#include "resource.h"
// all programs get the version number from the same place: version.bat
#define set static char *
@ -153,6 +154,7 @@ typedef struct
int stride; // distance between rows in bytes
int frame; // does this image have a frame (border)?
uint8 *pixels; // pointer to (0,0)th pixel
int had_alpha; // did this have alpha and we statically overwrote it?
} Image;
enum
@ -299,6 +301,12 @@ void *diskload_task(void *p)
}
}
static unsigned char alpha_background[2][3] =
{
{ 200,40,200 },
{ 150,30,150 },
};
// given raw decoded data from stbi_load, make it into a proper Image (e.g. creating a
// windows-compatible bitmap with 4-byte aligned rows and BGR color order)
void make_image(Image *z, int image_x, int image_y, uint8 *image_data, int image_n)
@ -309,6 +317,7 @@ void make_image(Image *z, int image_x, int image_y, uint8 *image_data, int image
z->y = image_y;
z->stride = image_x*BPP;
z->frame = 0;
z->had_alpha = (image_n==4);
for (j=0; j < image_y; ++j) {
for (i=0; i < image_x; ++i) {
@ -323,13 +332,13 @@ void make_image(Image *z, int image_x, int image_y, uint8 *image_data, int image
unsigned char *p = image_data+k;
int a = (255-p[3]);
if ((i ^ j) & 8) {
p[0] += (((200 - (int) p[0])*a)>>8);
p[1] += ((( 40 - (int) p[1])*a)>>8);
p[2] += (((200 - (int) p[2])*a)>>8);
p[0] += (((alpha_background[0][2] - (int) p[0])*a)>>8);
p[1] += (((alpha_background[0][1] - (int) p[1])*a)>>8);
p[2] += (((alpha_background[0][0] - (int) p[2])*a)>>8);
} else {
p[0] += (((150 - (int) p[0])*a)>>8);
p[1] += ((( 30 - (int) p[1])*a)>>8);
p[2] += (((150 - (int) p[2])*a)>>8);
p[0] += (((alpha_background[1][2] - (int) p[0])*a)>>8);
p[1] += (((alpha_background[1][1] - (int) p[1])*a)>>8);
p[2] += (((alpha_background[1][0] - (int) p[2])*a)>>8);
}
}
#endif
@ -459,6 +468,7 @@ Image *bmp_alloc(int x, int y)
i->stride += (-i->stride) & 3;
i->pixels = malloc(i->stride * i->y);
i->frame = 0;
i->had_alpha = 0;
if (i->pixels == NULL) { free(i); return NULL; }
return i;
}
@ -533,18 +543,18 @@ char helptext_center[88] =
char helptext_left[] =
"\n\n\n\n"
"ESC: exit\n"
"ALT-ENTER: toggle size\n"
"CTRL-PLUS: zoom in\n"
" ESC: exit\n"
" ALT-ENTER: toggle size\n"
" CTRL-PLUS: zoom in\n"
"CTRL-MINUS: zoom out\n"
"RIGHT, SPACE: next image\n"
"LEFT, BACKSPACE: previous image\n"
"CTRL-O: open image\n"
"F: toggle frame\n"
"C: toggle resize quality\n"
" CTRL-O: open image\n"
" P: change preferences\n"
" F: toggle frame\n"
"SHIFT-F: toggle white stripe in frame\n"
"CTRL-F: toggle both\n"
"L: toggle filename label\n"
" L: toggle filename label\n"
"F1, H, ?: help"
;
@ -1302,26 +1312,31 @@ void advance(int dir)
// set this file to new value
fileinfo[cur_loc].lru = ++lru_stamp;
// make sure there's room for new images
flush_cache(FALSE);
// we're mucking with the cache like mad, so grab the mutex; it doubles
// as a dc_shared mutex, so don't release until we're done with dc_shared
stb_mutex_begin(cache_mutex);
dc.num_files = 0;
queue_disk_command(&dc, cur_loc, 1); // first thing to load: this file
if (dir) {
queue_disk_command(&dc, wrap(cur_loc+dir), 0); // second thing to load: the next file (preload)
queue_disk_command(&dc, wrap(cur_loc-dir), 0); // last thing to load: the previous file (in case it got skipped when they went fast)
}
filename = fileinfo[cur_loc].filename;
if (dc.num_files) {
dc_shared = dc;
for (i=0; i < dc.num_files; ++i)
assert(dc.files[i]->filedata == NULL);
// wake up the disk thread if needed
stb_sem_release(disk_command_queue);
// we're mucking with the cache like mad, so grab the mutex; it doubles
// as a mutex on dc_shared, so don't release until we're done with dc_shared
stb_mutex_begin(cache_mutex);
{
dc.num_files = 0;
queue_disk_command(&dc, cur_loc, 1); // first thing to load: this file
if (dir) {
queue_disk_command(&dc, wrap(cur_loc+dir), 0); // second thing to load: the next file (preload)
queue_disk_command(&dc, wrap(cur_loc-dir), 0); // last thing to load: the previous file (in case it got skipped when they went fast)
}
filename = fileinfo[cur_loc].filename;
if (dc.num_files) {
dc_shared = dc;
for (i=0; i < dc.num_files; ++i)
assert(dc.files[i]->filedata == NULL);
// wake up the disk thread if needed
stb_sem_release(disk_command_queue);
}
}
stb_mutex_end(cache_mutex);
// tell disk loader not to bother with older files
for (i=0; i < MAX_CACHED_IMAGES; ++i)
if (cache[i].lru < lru_stamp-1)
@ -1427,8 +1442,8 @@ enum
#define ismode(x) (dragmode == x)
#define anymode() !ismode(MODE_none)
static int ex,ey; // original mousedown location for snapping to that
static int ex2,ey2; // original mousedown location relative to bottom right
static int ex,ey; // mousedown location relative to top left
static int ex2,ey2; // mousedown location relative to bottom right
static int wx,wy;
static int rx,ry,rx2,ry2;
@ -1541,6 +1556,178 @@ void mouse(UINT ev, int x, int y)
}
}
static unsigned int physmem;
char *reg_root = "Software\\SilverSpaceship\\imv";
int reg_get(char *str, void *data, int len)
{
static char buffer[128];
int result=0;
HKEY z=0;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_root, 0, KEY_READ, &z))
{
unsigned int type;
if (ERROR_SUCCESS == RegQueryValueEx(z, str, 0, &type, data, &len))
if (type == REG_BINARY)
result = 1;
}
if (z)
RegCloseKey(z);
return result;
}
int reg_set(char *str, void *data, int len)
{
int result = 0;
HKEY z=0;
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_LOCAL_MACHINE, reg_root, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &z, NULL))
{
if (ERROR_SUCCESS == RegSetValueEx(z, str, 0, REG_BINARY, data, len))
result = 1;
}
if (z)
RegCloseKey(z);
return result;
}
void reg_save(void)
{
int temp = max_cache_bytes >> 20;
reg_set("ac", &alpha_background, 6);
reg_set("up", &upsample_cubic, 4);
reg_set("cache", &temp, 4);
}
void reg_load(void)
{
int temp;
reg_get("ac", &alpha_background, 6);
reg_get("up", &upsample_cubic, 4);
if (reg_get("cache", &temp, 4))
max_cache_bytes = temp << 20;
}
static HWND dialog;
static LRESULT send_dialog(int id, UINT msg, WPARAM p1, LPARAM p2)
{
return SendMessage(GetDlgItem(dialog,id),msg,p1,p2);
}
static void set_dialog_number(int id, int value)
{
char buffer[16];
sprintf(buffer, "%d", value);
SetWindowText(GetDlgItem(dialog, id), buffer);
}
static int get_dialog_number(int id)
{
char buffer[32];
int n = GetWindowText(GetDlgItem(dialog,id), buffer, sizeof(buffer)-1);
buffer[n] = 0;
return atoi(buffer);
}
static void dialog_clamp(int id, int low, int high)
{
int x = get_dialog_number(id);
if (x < low) x = low;
else if (x > high) x = high;
else return;
set_dialog_number(id,x);
}
extern unsigned char *rom_images[];
BOOL CALLBACK PrefDlgProc(HWND hdlg, UINT imsg, WPARAM wparam, LPARAM lparam)
{
static Image *pref_image;
int i;
dialog = hdlg;
switch(imsg)
{
case WM_INITDIALOG: {
int n = ((rand() >> 6) % 3);
{
int x,y,i,j,k;
uint8 *data = stbi_load_from_memory(rom_images[n],2000,&x,&y,NULL,1);
pref_image = bmp_alloc(x,y);
for (j=0; j < y; ++j)
for (i=0; i < x; ++i)
for (k=0; k < 3; ++k)
pref_image->pixels[pref_image->stride*j + BPP*i + k] = data[j*x+i];
}
send_dialog(DIALOG_upsample, BM_SETCHECK, upsample_cubic, 0);
for (i=0; i < 6; ++i)
set_dialog_number(DIALOG_r1+i, alpha_background[0][i]);
set_dialog_number(DIALOG_cachesize, max_cache_bytes >> 20);
return TRUE;
}
case WM_PAINT: {
RECT z;
int x,y;
HWND pic = GetDlgItem(hdlg, DIALOG_image);
GetWindowRect(pic,&z);
InvalidateRect(pic,NULL,TRUE);
UpdateWindow(pic);
x = (z.right - z.left - pref_image->x) >> 1;
y = (z.bottom - z.top - pref_image->y) >> 1;
platformDrawBitmap(GetDC(pic), x,y,pref_image->pixels,pref_image->x,pref_image->y,pref_image->stride,0);
break;
}
case WM_COMMAND: {
int k = LOWORD(wparam);
int n = HIWORD(wparam);
switch(k) {
// validate the dialog entries
case DIALOG_r1: case DIALOG_g1: case DIALOG_b1:
case DIALOG_r2: case DIALOG_g2: case DIALOG_b2:
if (n == EN_KILLFOCUS) dialog_clamp(k,0,255);
break;
case DIALOG_cachesize:
if (n == EN_KILLFOCUS) dialog_clamp(k,1,(physmem>>22)*3); // 3/4 of phys mem
break;
case IDOK: {
unsigned char cur[6];
int up = upsample_cubic;
memcpy(cur, alpha_background, 6);
// load the settings back out of the dialog box
for (i=0; i < 6; ++i)
alpha_background[0][i] = get_dialog_number(DIALOG_r1+i);
max_cache_bytes = get_dialog_number(DIALOG_cachesize) << 20;
upsample_cubic = send_dialog(DIALOG_upsample, BM_GETCHECK,0,0) == BST_CHECKED;
if (memcmp(alpha_background, cur, 6)) {
stb_mutex_begin(cache_mutex);
for (i=0; i < MAX_CACHED_IMAGES; ++i) {
if (cache[i].status == LOAD_available) {
if (cache[i].image->had_alpha) {
stb_sdict_remove(file_cache, cache[i].filename, NULL);
free(cache[i].filename);
imfree(cache[i].image);
cache[i].status = LOAD_unused;
cache[i].image = NULL;
cache[i].filename = NULL;
}
}
}
stb_mutex_end(cache_mutex);
advance(0);
}
reg_save();
/* FALL THROUGH */
}
case IDCANCEL:
imfree(pref_image);
pref_image = NULL;
EndDialog(hdlg,0);
return TRUE;
}
break;
}
}
return FALSE;
}
#ifndef VK_OEM_PLUS
#define VK_OEM_PLUS 0xbb
#define VK_OEM_MINUS 0xbd
@ -1549,6 +1736,7 @@ void mouse(UINT ev, int x, int y)
#define VK_SLASH 0xbf
#endif
HINSTANCE inst;
int WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -1708,6 +1896,11 @@ int WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (cur) frame(cur);
break;
case 'P':
case 'P' | MY_CTRL:
DialogBox(inst, MAKEINTRESOURCE(IDD_pref), hWnd, PrefDlgProc);
break;
case MY_CTRL | VK_OEM_PLUS:
case MY_CTRL | MY_SHIFT | VK_OEM_PLUS:
resize(1);
@ -1728,7 +1921,6 @@ int WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
case WM_DESTROY:
PostQuitMessage (0);
break;
@ -1760,12 +1952,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
MSG msg;
WNDCLASSEX wndclass;
HWND hWnd;
int physmem;
int image_x, image_y;
unsigned char *image_data;
int image_n;
inst = hInstance;
resize_threads = stb_processor_count();
if (resize_threads > MAX_RESIZE) resize_threads = MAX_RESIZE;
@ -1775,10 +1968,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
#endif
GlobalMemoryStatus(&mem);
if (mem.dwTotalPhys == 0) --mem.dwTotalPhys;
physmem = mem.dwTotalPhys;
max_cache_bytes = physmem / 6;
if (max_cache_bytes > 256 << 20) max_cache_bytes = 256 << 20;
reg_load();
strcat(helptext_center, VERSION);
/* Register the frame class */
@ -1811,7 +2007,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
label_font = CreateFontIndirect(&lf);
}
srand(time(NULL));
if (argc < 1) {
OPENFILENAME o;

BIN
imv.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

179
pics.c Normal file
View File

@ -0,0 +1,179 @@
static unsigned char img_0[] =
{
255,216,255,224,0,16,74,70,73,70,0,1,2,0,0,100,0,100,
0,0,255,236,0,17,68,117,99,107,121,0,1,0,4,0,0,0,
21,0,0,255,238,0,14,65,100,111,98,101,0,100,192,0,0,0,
1,255,219,0,132,0,18,14,14,14,15,14,20,15,15,20,29,19,
17,19,29,34,25,20,20,25,34,34,24,24,26,24,24,34,38,29,
33,32,32,33,29,38,38,45,47,50,47,45,38,60,60,65,65,60,
60,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,1,19,
19,19,22,24,22,27,23,23,27,26,21,25,21,26,32,26,28,28,
26,32,47,32,32,35,32,32,47,61,44,38,38,38,38,44,61,54,
58,50,50,50,58,54,65,65,61,61,65,65,65,65,65,65,65,65,
65,65,65,65,65,65,65,65,65,255,192,0,17,8,0,48,0,48,
3,1,34,0,2,17,1,3,17,1,255,196,0,105,0,0,3,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,3,5,6,4,0,
1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
16,0,2,1,3,2,4,5,3,3,5,0,0,0,0,0,0,1,
2,3,0,17,4,33,18,49,65,81,5,97,129,34,50,19,145,177,
20,161,66,82,113,98,35,67,21,17,1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,255,218,0,12,3,1,0,2,17,
3,17,0,63,0,73,182,142,152,204,69,199,62,23,28,232,159,9,
121,89,16,123,125,205,112,2,211,158,221,135,28,196,41,98,193,61,
205,123,110,127,15,1,64,175,27,180,145,43,54,64,6,194,234,164,
105,115,192,216,86,211,218,225,145,79,183,112,2,194,214,111,162,133,
170,36,196,141,79,220,154,14,78,42,17,107,88,242,52,17,57,152,
239,134,196,178,217,126,191,122,85,46,67,57,176,225,87,25,152,95,
147,137,44,45,123,129,161,227,126,156,122,84,17,66,142,84,235,110,
99,194,130,147,31,32,25,164,59,125,32,22,191,247,53,148,125,47,
78,34,252,120,164,73,68,34,73,139,144,172,61,91,86,225,61,35,
202,228,212,178,74,205,233,143,82,109,186,171,187,125,191,226,36,168,
133,229,248,245,176,187,18,73,26,121,80,50,252,168,228,198,18,20,
7,117,238,167,219,199,111,62,85,155,15,34,57,225,255,0,28,63,
13,154,197,77,197,192,211,157,30,8,227,79,141,97,4,194,20,46,
214,22,32,121,209,231,142,53,141,157,6,160,92,17,210,128,12,145,
178,48,36,174,227,231,122,136,239,157,189,96,144,74,134,225,143,169,
122,30,162,171,241,211,230,18,180,198,202,61,40,60,88,86,46,239,
133,19,96,17,43,110,113,191,99,243,63,31,2,126,148,17,109,112,
110,56,141,69,85,118,28,183,126,216,194,41,66,79,137,163,6,27,
129,66,218,95,200,254,134,144,231,44,69,198,195,175,238,2,133,137,
147,46,44,229,225,82,225,212,164,177,15,246,70,220,70,156,250,80,
95,75,38,108,96,168,117,121,46,21,84,174,213,36,245,214,181,78,
203,30,52,134,103,17,170,175,173,201,178,139,243,165,112,119,140,12,
124,113,145,155,41,249,147,208,99,40,203,46,245,26,130,173,251,191,
74,151,239,93,247,39,187,72,16,143,139,25,13,210,17,173,207,242,
115,204,253,168,59,184,119,236,169,167,101,195,118,143,21,88,52,107,
97,118,43,166,227,253,122,86,102,204,238,57,236,34,146,70,112,77,
246,141,20,112,228,57,105,64,142,22,114,21,6,231,110,2,156,44,
81,224,193,125,12,135,137,31,200,242,160,255,217,
};
static unsigned char img_1[] =
{
255,216,255,224,0,16,74,70,73,70,0,1,2,0,0,100,0,100,
0,0,255,236,0,17,68,117,99,107,121,0,1,0,4,0,0,0,
20,0,0,255,238,0,14,65,100,111,98,101,0,100,192,0,0,0,
1,255,219,0,132,0,18,14,14,14,16,14,21,16,16,21,30,19,
17,19,30,35,26,21,21,26,35,34,24,24,26,24,24,34,39,30,
34,33,33,34,30,39,39,46,48,51,48,46,39,62,62,65,65,62,
62,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,1,20,
19,19,22,25,22,27,23,23,27,26,22,26,22,26,33,26,29,29,
26,33,49,33,33,36,33,33,49,62,45,39,39,39,39,45,62,56,
59,51,51,51,59,56,65,65,62,62,65,65,65,65,65,65,65,65,
65,65,65,65,65,65,65,65,65,255,192,0,17,8,0,59,0,64,
3,1,34,0,2,17,1,3,17,1,255,196,0,111,0,0,3,1,
1,1,0,0,0,0,0,0,0,0,0,0,0,3,4,5,2,6,
1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,16,0,2,1,2,4,4,3,7,1,9,0,0,0,0,0,0,
1,2,3,0,17,33,49,18,4,65,81,34,5,97,145,19,113,129,
50,66,82,130,20,52,161,177,193,225,98,114,146,51,67,17,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,218,0,
12,3,1,0,2,17,3,17,0,63,0,173,219,246,242,164,3,242,
18,52,184,26,34,69,0,70,191,73,191,26,115,211,143,232,95,33,
74,237,247,104,54,105,36,131,73,11,114,163,133,111,105,189,143,114,
196,12,8,200,80,48,34,143,232,95,33,90,244,163,250,23,252,69,
16,41,24,138,34,163,182,54,160,18,237,226,181,202,47,144,172,180,
49,47,202,167,237,20,75,89,136,226,51,20,29,211,132,143,32,117,
27,99,64,158,233,3,186,70,137,101,63,17,1,84,97,204,218,146,
158,109,163,147,12,83,164,37,48,37,151,11,139,124,214,170,13,52,
141,26,143,78,223,24,39,144,2,215,161,109,54,91,17,37,218,49,
33,44,6,166,234,234,115,203,42,8,79,190,146,61,161,22,12,168,
166,228,15,138,135,217,215,185,201,60,91,171,218,45,88,173,180,244,
242,28,235,217,87,213,153,32,219,70,88,31,212,88,27,91,216,220,
253,181,74,73,63,26,56,196,48,50,152,85,173,118,212,88,176,177,
225,133,7,69,173,52,7,189,148,226,9,166,21,213,116,139,224,115,
242,174,103,105,44,207,182,95,80,130,69,192,55,241,166,142,234,66,
154,91,167,27,220,99,65,69,166,219,153,22,69,110,166,96,10,182,
3,150,30,84,156,179,72,196,172,140,128,134,185,210,109,165,61,180,
180,140,178,232,179,178,184,193,191,168,80,101,128,171,172,45,125,12,
46,139,170,218,72,206,254,24,208,15,123,221,70,201,17,11,25,222,
206,74,175,87,196,69,142,28,5,111,182,119,56,119,81,188,91,67,
105,172,24,107,178,148,97,153,20,180,141,183,217,247,19,43,189,142,
130,44,49,35,27,139,138,62,219,99,12,147,54,254,59,15,89,15,
0,160,5,240,241,160,216,223,25,36,116,7,85,184,210,219,205,220,
139,96,70,28,234,54,211,122,82,121,1,55,177,207,158,54,163,111,
55,143,186,117,11,134,129,99,142,116,24,29,218,65,184,34,231,64,
22,176,187,31,112,21,82,45,255,0,171,24,49,46,182,192,18,72,
192,249,138,231,32,38,45,203,62,119,233,110,126,234,181,12,18,177,
26,7,73,196,252,159,190,129,232,191,32,245,201,40,140,112,85,34,
254,116,159,113,220,152,10,144,75,23,190,44,111,149,21,246,206,214,
215,26,54,156,181,51,26,79,185,69,49,68,178,168,64,72,33,124,
112,20,8,203,184,87,138,81,46,50,234,30,159,142,119,199,133,169,
254,213,190,146,41,63,28,182,184,164,184,211,112,202,44,9,194,164,
75,19,36,164,21,197,154,226,252,112,254,116,231,103,129,158,111,88,
158,136,215,164,127,125,2,27,153,109,186,145,135,253,24,182,25,103,
194,137,20,173,112,195,58,74,91,234,76,242,240,213,159,26,52,89,
113,160,56,12,210,168,39,78,163,109,86,38,215,170,209,52,134,64,
125,82,47,211,169,198,62,234,153,23,234,98,190,172,240,215,150,71,
43,113,246,213,188,61,17,125,57,124,215,254,20,5,8,64,33,220,
176,60,248,121,80,119,50,34,70,14,157,69,152,0,47,199,134,117,
168,45,165,185,95,199,79,187,141,3,123,254,137,61,148,18,100,101,
99,174,246,96,236,161,135,194,116,129,251,41,206,203,34,133,148,41,
58,108,166,199,229,108,111,82,142,98,218,190,223,96,202,245,71,179,
91,211,151,237,207,223,65,255,217,
};
static unsigned char img_2[] =
{
255,216,255,224,0,16,74,70,73,70,0,1,2,0,0,100,0,100,
0,0,255,236,0,17,68,117,99,107,121,0,1,0,4,0,0,0,
23,0,0,255,238,0,14,65,100,111,98,101,0,100,192,0,0,0,
1,255,219,0,132,0,18,13,13,13,15,13,19,15,15,19,28,18,
16,18,28,33,24,19,19,24,33,34,23,23,25,23,23,34,36,29,
32,31,31,32,29,36,36,43,44,47,44,43,36,57,57,62,62,57,
57,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,1,19,
18,18,21,23,21,25,22,22,25,25,20,23,20,25,31,25,26,26,
25,31,46,31,31,34,31,31,46,58,42,36,36,36,36,42,58,52,
56,47,47,47,56,52,64,64,58,58,64,64,65,65,65,65,65,65,
65,65,65,65,65,65,65,65,65,255,192,0,17,8,0,64,0,64,
3,1,34,0,2,17,1,3,17,1,255,196,0,110,0,0,3,1,
1,1,1,0,0,0,0,0,0,0,0,0,0,4,5,6,3,7,
2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,16,0,2,1,3,3,3,1,5,7,5,0,0,0,0,
0,0,1,2,3,0,17,4,33,18,5,49,65,81,34,97,113,145,
19,6,129,161,50,82,98,35,20,177,66,178,36,21,17,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,218,0,12,
3,1,0,2,17,3,17,0,63,0,73,50,62,128,155,129,208,120,
170,174,3,147,131,47,21,112,39,0,74,137,176,41,252,50,70,5,
191,167,90,159,124,126,224,18,43,126,29,86,46,74,6,123,128,26,
218,254,173,5,64,55,55,199,193,129,154,96,129,203,161,80,196,30,
169,187,251,126,20,172,155,85,103,213,56,50,60,169,146,6,229,218,
16,145,219,110,186,212,172,137,102,181,81,137,52,227,128,193,200,200,
105,165,142,86,130,56,128,14,235,237,237,110,244,183,31,22,108,153,
150,8,20,188,143,162,168,171,158,35,141,159,143,226,36,130,109,162,
87,44,236,1,189,129,22,235,246,80,67,102,55,251,14,47,184,2,
117,181,175,88,138,51,146,199,49,206,118,250,151,243,142,134,131,20,
29,28,192,228,5,40,128,13,73,54,251,168,89,227,194,12,46,0,
148,11,129,211,165,109,62,126,35,29,178,71,117,161,156,241,132,168,
218,87,173,137,212,143,141,65,43,63,39,157,60,223,58,89,152,184,
208,91,210,0,247,10,213,32,254,124,18,72,130,249,48,141,206,138,
63,28,125,55,40,29,199,122,195,58,17,14,92,177,169,186,6,37,
15,233,58,138,249,133,149,38,30,84,121,49,155,52,102,246,242,59,
138,161,231,210,88,121,41,150,217,38,63,218,40,209,179,157,44,218,
29,7,94,213,94,117,30,124,214,88,175,12,144,36,176,0,35,144,
111,27,69,135,170,181,168,17,243,156,100,114,194,100,81,101,65,208,
120,246,84,102,94,40,130,77,170,225,197,175,126,149,209,57,41,18,
60,41,75,234,8,176,30,218,132,202,113,38,132,122,175,215,200,160,
176,147,137,137,67,56,4,145,222,247,161,31,14,39,147,93,52,233,
236,21,66,122,121,161,167,70,44,21,80,93,186,159,20,17,220,230,
16,141,82,101,34,227,210,192,120,236,105,53,235,161,101,241,184,243,
194,201,42,131,112,117,238,46,45,80,89,88,210,99,78,240,72,44,
200,109,127,35,177,30,250,162,139,233,78,84,41,255,0,159,51,122,
88,222,2,123,55,117,251,106,182,185,116,110,200,202,200,108,202,110,
8,236,69,116,46,39,59,249,216,81,204,79,238,15,76,150,252,226,
131,207,56,241,167,27,41,114,22,227,210,79,230,30,61,181,3,44,
234,196,129,168,236,105,239,213,28,160,153,142,16,4,124,150,59,205,
238,165,135,74,155,80,13,238,108,123,15,52,29,53,179,177,7,89,
71,222,107,211,100,192,21,95,117,195,104,8,5,186,251,133,74,199,
202,76,88,110,212,169,189,238,214,248,94,152,142,87,39,104,244,147,
229,64,211,226,106,3,179,185,24,226,136,132,86,119,36,104,85,173,
107,235,219,197,78,115,255,0,196,202,68,200,131,114,186,104,219,212,
165,193,237,168,237,69,100,230,230,176,33,99,4,176,190,154,88,82,
217,179,102,82,86,88,236,218,104,192,55,249,41,160,93,143,143,36,
210,172,113,174,231,109,0,21,95,197,32,226,176,207,207,184,146,70,
210,31,78,235,244,189,36,131,62,81,40,49,5,82,69,141,149,0,
248,109,31,26,96,38,115,18,252,193,36,165,58,19,26,184,54,177,
213,181,189,80,7,59,197,176,156,205,1,47,243,206,226,157,89,75,
107,219,173,45,139,139,201,252,110,21,20,92,157,230,221,41,243,242,
18,35,52,201,8,98,5,175,181,14,223,112,26,138,87,54,126,91,
204,102,216,10,145,111,150,241,134,79,129,22,160,255,217,
};
unsigned char *rom_images[] = { img_0, img_1, img_2 };

113
pref.rc Normal file
View File

@ -0,0 +1,113 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_pref DIALOG DISCARDABLE 0, 0, 161, 141
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "imv(stb) preferences"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,23,119,50,14
PUSHBUTTON "Cancel",IDCANCEL,83,119,50,14
CONTROL "High-quality resizing",DIALOG_upsample,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,24,86,76,10
EDITTEXT DIALOG_r1,57,50,19,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT DIALOG_g1,79,50,19,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT DIALOG_b1,101,50,19,12,ES_RIGHT | ES_AUTOHSCROLL
RTEXT "Color 1",IDC_STATIC,28,53,25,12
RTEXT "Color 2",IDC_STATIC,28,65,25,13
GROUPBOX "Background color for transparent images",IDC_STATIC,5,
40,147,42
EDITTEXT DIALOG_r2,57,63,19,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT DIALOG_g2,79,63,19,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT DIALOG_b2,101,63,19,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT DIALOG_cachesize,11,100,21,13,ES_AUTOHSCROLL
LTEXT "Size of image cache in megabytes",IDC_STATIC,36,102,107,
8
LTEXT "",DIALOG_image,45,7,70,28
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_pref, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 154
TOPMARGIN, 7
BOTTOMMARGIN, 134
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -124,6 +124,10 @@ SOURCE=..\imv.c
# End Source File
# Begin Source File
SOURCE=..\imv.ico
# End Source File
# Begin Source File
SOURCE=..\notes.txt
!IF "$(CFG)" == "stb_imv - Win32 Release"
@ -144,6 +148,14 @@ SOURCE=..\notes.txt
# End Source File
# Begin Source File
SOURCE=..\pics.c
# End Source File
# Begin Source File
SOURCE=..\pref.rc
# End Source File
# Begin Source File
SOURCE=..\stb.h
# End Source File
# Begin Source File