#include "lcconfig.h"#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include "lcstring.h"Go to the source code of this file.
Defines | |
| #define | LIBDIR DEFAULT_LIBDIR |
| #define | COLOUR_PAL_FILE "/colour.pal" |
| #define | FONTFILE "/opening/iso8859-1-8x8.raw" |
| #define | WINSTARTX 240 |
| #define | WINSTARTY ((14*16)-1) |
| #define | SWINSTARTX 56 |
| #define | SWINSTARTY 260 |
| #define | MAXIMAGESIZE 4 |
| #define | SIZEBUTTONX1x1 540 |
| #define | SIZEBUTTONY1x1 260 |
| #define | SIZEBUTTONX2x2 540 |
| #define | SIZEBUTTONY2x2 276 |
| #define | SIZEBUTTONX3x3 540 |
| #define | SIZEBUTTONY3x3 292 |
| #define | SIZEBUTTONX4x4 540 |
| #define | SIZEBUTTONY4x4 308 |
| #define | SIZEBUTTONSIZEX 32 |
| #define | SIZEBUTTONSIZEY 16 |
| #define | FOCUSWINX 40 |
| #define | FOCUSWINY 360 |
| #define | FOCUSWINSIZE 56 |
| #define | ZOOMBUTX 540 |
| #define | ZOOMBUTY 390 |
| #define | ZOOMBUTSIZEX 40 |
| #define | ZOOMBUTSIZEY 16 |
| #define | HALFBUTX 540 |
| #define | HALFBUTY 370 |
| #define | HALFBUTSIZEX 40 |
| #define | HALFBUTSIZEY 16 |
| #define | NORMBUTX 540 |
| #define | NORMBUTY 350 |
| #define | NORMBUTSIZEX 40 |
| #define | NORMBUTSIZEY 16 |
| #define | DOTBUTX 150 |
| #define | DOTBUTY 350 |
| #define | DOTBUTSIZEX 40 |
| #define | DOTBUTSIZEY 16 |
| #define | HFILBUTX 150 |
| #define | HFILBUTY 370 |
| #define | HFILBUTSIZEX 40 |
| #define | HFILBUTSIZEY 16 |
| #define | VFILBUTX 150 |
| #define | VFILBUTY 390 |
| #define | VFILBUTSIZEX 40 |
| #define | VFILBUTSIZEY 16 |
| #define | red(x) (32 + x) |
| #define | green(x) (64 + x) |
| #define | yellow(x) (96 + x) |
| #define | blue(x) (128 + x) |
| #define | magenta(x) (160 + x) |
| #define | cyan(x) (192 + x) |
| #define | white(x) (224 + x) |
| #define | FOCUSWINCOLOUR green(30) |
| #define | UNFOCUSWINCOLOUR magenta(20) |
| #define | XFOCUSWINCOLOUR red(15) |
| #define | Fgl_setpixel(a, b, c) gl_setpixel(a,b,c) |
| #define | Fgl_getpixel(a, b) gl_getpixel(a,b) |
| #define | Fgl_hline(a, b, c, d) gl_hline(a,b,c,d) |
| #define | Fgl_line(a, b, c, d, e) gl_line(a,b,c,d,e) |
| #define | Fgl_write(a, b, c) gl_write(a,b,c) |
| #define | Fgl_fillbox(a, b, c, d, e) gl_fillbox(a,b,c,d,e) |
| #define | Fgl_putbox(a, b, c, d, e) gl_putbox(a,b,c,d,e) |
| #define | Fgl_getbox(a, b, c, d, e) gl_getbox(a,b,c,d,e) |
Functions | |
| void | do_buttons (int, int) |
| void | draw_dot (void) |
| void | draw_hfill (void) |
| void | draw_vfill (void) |
| void | full_zoom (void) |
| void | half_zoom (void) |
| void | norm_zoom (void) |
| void | do_error (char *) |
| void | choose_colour (int, int) |
| void | fill_colour (int, int) |
| void | hfill (int, int) |
| void | vfill (int, int) |
| void | fill_colourzoom (int, int) |
| void | fill_colour1 (int, int) |
| void | fill_colour2 (int, int) |
| void | fill_colour3 (int, int) |
| void | fill_colour4 (int, int) |
| void | setcustompalette (void) |
| void | initfont (void) |
| void | save_image (void) |
| void | load_image (void) |
| void | setup (void) |
| void | draw_focus (void) |
| void | draw_swin (void) |
| void | draw_big_image (void) |
| void | draw_big_imagezoom (void) |
| void | draw_big_image1 (void) |
| void | draw_big_image2 (void) |
| void | draw_big_image3 (void) |
| void | draw_big_image4 (void) |
| void | change_imagesize (int) |
| void | change_focus (int, int) |
| void | hide_mouse (void) |
| void | reshow_mouse (void) |
| void | lincityrc () |
| int | main (int argc, char *argv[]) |
Variables | |
| unsigned char | mouse_pointer [] |
| unsigned char | under_mouse_pointer [8 *8] |
| unsigned char | last16 [16] |
| unsigned char | image [16 *MAXIMAGESIZE][16 *MAXIMAGESIZE] |
| char | imagefile [100] |
| int | colour = 0 mx my mox moy zoom_flag = 1 hfill_flag = 0 vfill_flag = 0 |
| int | imagesize |
| int | newimagesize |
| int | focus |
| int | focusx |
| int | focusy |
| int | old_focusx = 0 old_focusy = 0 stopflag lc_mouse_type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 1131 of file picedit.c. 01132 {
01133 if (x >= imagesize || y >= imagesize)
01134 return;
01135 focusx = x;
01136 focusy = y;
01137 draw_focus ();
01138 draw_big_image ();
01139 }
|
|
|
Definition at line 1116 of file picedit.c. 01117 {
01118 char s[50];
01119 imagesize = n;
01120 focus = 0;
01121 focusx = 0;
01122 focusy = 0;
01123 draw_swin ();
01124 draw_focus ();
01125 sprintf (s, "Image size %dx%d", n, n);
01126 Fgl_write (0, 480 - 20, s);
01127
01128 }
|
|
||||||||||||
|
Definition at line 504 of file picedit.c. 00505 {
00506 char s[100];
00507 int q, newcolour;
00508 newcolour = Fgl_getpixel (x - 1, y - 1);
00509 if (newcolour == colour)
00510 return;
00511 colour = newcolour;
00512 for (q = 15; q > 0; q--)
00513 last16[q] = last16[q - 1];
00514 last16[0] = colour;
00515 for (q = 0; q < 16; q++)
00516 {
00517 Fgl_fillbox (600, 14 * 16 + q * 16, 39, 15, (int) last16[q]);
00518 sprintf (s, "%d", (int) last16[q]);
00519 Fgl_write (600 + 3, 14 * 16 + q * 16 + 3, s);
00520 }
00521 }
|
|
||||||||||||
|
Definition at line 314 of file picedit.c. 00315 {
00316 int b, left = 0, right = 0;
00317 #ifdef LC_X11
00318 int dummy_int;
00319 Window dummy_win;
00320 if (mouse_button == Button1)
00321 left = 1;
00322 else if (mouse_button == Button3)
00323 right = 1;
00324 XQueryPointer (display.dpy, display.win, &dummy_win, &dummy_win
00325 ,&dummy_int, &dummy_int, &x, &y, (unsigned int *) &dummy_int);
00326 x -= borderx;
00327 y -= bordery;
00328 #else
00329 b = mouse_getbutton ();
00330 left = b & MOUSE_LEFTBUTTON;
00331 right = b & MOUSE_RIGHTBUTTON;
00332 #endif
00333 if (right != 0 && x < 560)
00334 choose_colour (x, y);
00335 if (left != 0)
00336 {
00337 if (y < 16 * 14 - 2)
00338 choose_colour (x, y);
00339 else if (x < WINSTARTX + 256 && x >= WINSTARTX
00340 && y < WINSTARTY + 256 && y > WINSTARTY)
00341 fill_colour (x, y);
00342 else if (x > SIZEBUTTONX1x1
00343 && x < SIZEBUTTONX1x1 + SIZEBUTTONSIZEX
00344 && y > SIZEBUTTONY1x1
00345 && y < SIZEBUTTONY1x1 + SIZEBUTTONSIZEY
00346 && imagesize != 1)
00347 change_imagesize (1);
00348 else if (x > SIZEBUTTONX2x2
00349 && x < SIZEBUTTONX2x2 + SIZEBUTTONSIZEX
00350 && y > SIZEBUTTONY2x2
00351 && y < SIZEBUTTONY2x2 + SIZEBUTTONSIZEY
00352 && imagesize != 2)
00353 change_imagesize (2);
00354 else if (x > SIZEBUTTONX3x3
00355 && x < SIZEBUTTONX3x3 + SIZEBUTTONSIZEX
00356 && y > SIZEBUTTONY3x3
00357 && y < SIZEBUTTONY3x3 + SIZEBUTTONSIZEY
00358 && imagesize != 3)
00359 change_imagesize (3);
00360 else if (x > SIZEBUTTONX4x4
00361 && x < SIZEBUTTONX4x4 + SIZEBUTTONSIZEX
00362 && y > SIZEBUTTONY4x4
00363 && y < SIZEBUTTONY4x4 + SIZEBUTTONSIZEY
00364 && imagesize != 4)
00365 change_imagesize (4);
00366 else if (x > FOCUSWINX && x < FOCUSWINX + FOCUSWINSIZE
00367 && y > FOCUSWINY && FOCUSWINY + FOCUSWINSIZE
00368 && zoom_flag == 1)
00369 change_focus ((x - FOCUSWINX) / (FOCUSWINSIZE / 4)
00370 ,(y - FOCUSWINY) / (FOCUSWINSIZE / 4));
00371 else if (x > ZOOMBUTX && x < ZOOMBUTX + ZOOMBUTSIZEX
00372 && y > ZOOMBUTY && y < ZOOMBUTY + ZOOMBUTSIZEY)
00373 full_zoom ();
00374 else if (x > HALFBUTX && x < HALFBUTX + HALFBUTSIZEX
00375 && y > HALFBUTY && y < HALFBUTY + HALFBUTSIZEY)
00376 half_zoom ();
00377 else if (x > NORMBUTX && x < NORMBUTX + NORMBUTSIZEX
00378 && y > NORMBUTY && y < NORMBUTY + NORMBUTSIZEY)
00379 norm_zoom ();
00380 else if (x > DOTBUTX && x < DOTBUTX + DOTBUTSIZEX
00381 && y > DOTBUTY && y < DOTBUTY + DOTBUTSIZEY)
00382 draw_dot ();
00383 else if (x > HFILBUTX && x < HFILBUTX + HFILBUTSIZEX
00384 && y > HFILBUTY && y < HFILBUTY + HFILBUTSIZEY)
00385 draw_hfill ();
00386 else if (x > VFILBUTX && x < VFILBUTX + VFILBUTSIZEX
00387 && y > VFILBUTY && y < VFILBUTY + VFILBUTSIZEY)
00388 draw_vfill ();
00389 }
00390 }
|
|
|
Definition at line 695 of file main.c. 00696 {
00697 #if defined (LC_X11) || defined (WIN32)
00698 HandleError (s, FATAL);
00699 #else
00700 vga_setmode (TEXT);
00701 printf ("%s\n", s);
00702 exit (1);
00703 #endif
00704 }
|
|
|
Definition at line 1049 of file picedit.c. 01050 {
01051 if (zoom_flag == 1)
01052 draw_big_imagezoom ();
01053 else if (zoom_flag == 2)
01054 draw_big_image2 ();
01055 else if (imagesize == 1)
01056 draw_big_image1 ();
01057 else if (imagesize == 2)
01058 draw_big_image2 ();
01059 else if (imagesize == 3)
01060 draw_big_image3 ();
01061 else if (imagesize == 4)
01062 draw_big_image4 ();
01063 }
|
|
|
Definition at line 1076 of file picedit.c. 01077 {
01078 int x, y;
01079 for (y = 0; y < 16; y++)
01080 for (x = 0; x < 16; x++)
01081 Fgl_fillbox (WINSTARTX + x * 16, (WINSTARTY) + y * 16, 16, 16
01082 ,image[x + focusx * 16][y + focusy * 16]);
01083 }
|
|
|
Definition at line 1086 of file picedit.c. 01087 {
01088 int x, y;
01089 for (y = 0; y < 32; y++)
01090 for (x = 0; x < 32; x++)
01091 Fgl_fillbox (WINSTARTX + x * 8, (WINSTARTY) + y * 8, 8, 8
01092 ,image[x + focusx * 16][y + focusy * 16]);
01093 }
|
|
|
Definition at line 1096 of file picedit.c. 01097 {
01098 int x, y;
01099 for (y = 0; y < 48; y++)
01100 for (x = 0; x < 48; x++)
01101 Fgl_fillbox (WINSTARTX + x * 5, (WINSTARTY) + y * 5, 5, 5
01102 ,image[x + focusx * 5][y + focusy * 5]);
01103 }
|
|
|
Definition at line 1106 of file picedit.c. 01107 {
01108 int x, y;
01109 for (y = 0; y < 64; y++)
01110 for (x = 0; x < 64; x++)
01111 Fgl_fillbox (WINSTARTX + x * 4, (WINSTARTY) + y * 4, 4, 4
01112 ,image[x + focusx * 4][y + focusy * 4]);
01113 }
|
|
|
Definition at line 1066 of file picedit.c. 01067 {
01068 int x, y;
01069 for (y = 0; y < 16; y++)
01070 for (x = 0; x < 16; x++)
01071 Fgl_fillbox (WINSTARTX + x * 16, (WINSTARTY) + y * 16, 15, 15
01072 ,image[x + focusx * 16][y + focusy * 16]);
01073 }
|
|
|
Definition at line 393 of file picedit.c. 00394 {
00395 Fgl_write (DOTBUTX - 10, DOTBUTY + 3, ">");
00396 Fgl_write (HFILBUTX - 10, HFILBUTY + 3, " ");
00397 Fgl_write (VFILBUTX - 10, VFILBUTY + 3, " ");
00398 hfill_flag = 0;
00399 vfill_flag = 0;
00400 }
|
|
|
Definition at line 988 of file picedit.c. 00989 {
00990 int x, y;
00991 hide_mouse ();
00992 for (y = 0; y < 4; y++)
00993 for (x = 0; x < 4; x++)
00994 {
00995 if (x == focusx && y == focusy)
00996 Fgl_fillbox (FOCUSWINX + (FOCUSWINSIZE / 4) * focusx
00997 ,FOCUSWINY + (FOCUSWINSIZE / 4) * focusy
00998 ,(FOCUSWINSIZE / 4) - 1
00999 ,(FOCUSWINSIZE / 4) - 1, FOCUSWINCOLOUR);
01000 else if (zoom_flag == 2)
01001 {
01002 if ((x == focusx + 1 && y == focusy)
01003 || (x == focusx && y == focusy + 1)
01004 || (x == focusx + 1 && y == focusy + 1))
01005 Fgl_fillbox (FOCUSWINX + (FOCUSWINSIZE / 4) * x
01006 ,FOCUSWINY + (FOCUSWINSIZE / 4) * y
01007 ,(FOCUSWINSIZE / 4) - 1
01008 ,(FOCUSWINSIZE / 4) - 1, FOCUSWINCOLOUR);
01009 }
01010 else if (x < imagesize && y < imagesize)
01011 Fgl_fillbox (FOCUSWINX + (FOCUSWINSIZE / 4) * x
01012 ,FOCUSWINY + (FOCUSWINSIZE / 4) * y
01013 ,(FOCUSWINSIZE / 4) - 1
01014 ,(FOCUSWINSIZE / 4) - 1, UNFOCUSWINCOLOUR);
01015 else
01016 Fgl_fillbox (FOCUSWINX + (FOCUSWINSIZE / 4) * x
01017 ,FOCUSWINY + (FOCUSWINSIZE / 4) * y
01018 ,(FOCUSWINSIZE / 4) - 1
01019 ,(FOCUSWINSIZE / 4) - 1, XFOCUSWINCOLOUR);
01020 }
01021 reshow_mouse ();
01022 }
|
|
|
Definition at line 403 of file picedit.c. 00404 {
00405 Fgl_write (DOTBUTX - 10, DOTBUTY + 3, " ");
00406 Fgl_write (HFILBUTX - 10, HFILBUTY + 3, ">");
00407 Fgl_write (VFILBUTX - 10, VFILBUTY + 3, " ");
00408 hfill_flag = 1;
00409 vfill_flag = 0;
00410 }
|
|
|
Definition at line 1025 of file picedit.c. 01026 {
01027 int x, y;
01028 Fgl_fillbox ((SWINSTARTX + 7) - 4 * 8, (SWINSTARTY + 7) - 4 * 8
01029 ,16 * 4 + 2, 16 * 4 + 2, 0);
01030 Fgl_hline ((SWINSTARTX + 7) - imagesize * 8, (SWINSTARTY + 7) - imagesize * 8
01031 ,((SWINSTARTX + 8) - imagesize * 8) + 16 * imagesize, 235);
01032 Fgl_hline ((SWINSTARTX + 7) - imagesize * 8
01033 ,((SWINSTARTY + 8) - imagesize * 8) + 16 * imagesize
01034 ,((SWINSTARTX + 8) - imagesize * 8) + 16 * imagesize, 235);
01035 Fgl_line ((SWINSTARTX + 7) - imagesize * 8, (SWINSTARTY + 7) - imagesize * 8
01036 ,(SWINSTARTX + 7) - imagesize * 8
01037 ,((SWINSTARTY + 8) - imagesize * 8) + 16 * imagesize, 235);
01038 Fgl_line (((SWINSTARTX + 8) - imagesize * 8) + 16 * imagesize
01039 ,(SWINSTARTY + 7) - imagesize * 8
01040 ,((SWINSTARTX + 8) - imagesize * 8) + 16 * imagesize
01041 ,((SWINSTARTY + 8) - imagesize * 8) + 16 * imagesize, 235);
01042 for (y = 0; y < 16 * imagesize; y++)
01043 for (x = 0; x < 16 * imagesize; x++)
01044 Fgl_setpixel (((SWINSTARTX + 8) - imagesize * 8) + x
01045 ,((SWINSTARTY + 8) - imagesize * 8) + y, image[x][y]);
01046 }
|
|
|
Definition at line 413 of file picedit.c. 00414 {
00415 Fgl_write (DOTBUTX - 10, DOTBUTY + 3, " ");
00416 Fgl_write (HFILBUTX - 10, HFILBUTY + 3, " ");
00417 Fgl_write (VFILBUTX - 10, VFILBUTY + 3, ">");
00418 vfill_flag = 1;
00419 hfill_flag = 0;
00420 }
|
|
||||||||||||
|
Definition at line 524 of file picedit.c. 00525 {
00526 if (hfill_flag != 0)
00527 hfill (x, y);
00528 else if (vfill_flag != 0)
00529 vfill (x, y);
00530 else if (zoom_flag == 1)
00531 fill_colourzoom (x, y);
00532 else if (zoom_flag == 2)
00533 fill_colour2 (x, y);
00534 else if (imagesize == 1)
00535 fill_colour1 (x, y);
00536 else if (imagesize == 2)
00537 fill_colour2 (x, y);
00538 else if (imagesize == 3)
00539 fill_colour3 (x, y);
00540 else if (imagesize == 4)
00541 fill_colour4 (x, y);
00542 }
|
|
||||||||||||
|
Definition at line 653 of file picedit.c. 00654 {
00655 int xx, yy;
00656 xx = (x - WINSTARTX) / 16;
00657 xx = WINSTARTX + (xx * 16);
00658 yy = (y - WINSTARTY) / 16;
00659 yy = WINSTARTY + (yy * 16);
00660 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00661 Fgl_fillbox (xx, yy, 16, 16, colour);
00662 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00663 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00664
00665 Fgl_setpixel ((SWINSTARTX) + ((x - WINSTARTX) / 16)
00666 + (focusx * 16)
00667 ,(SWINSTARTY) + ((y - (WINSTARTY)) / 16) + (focusy * 16)
00668 ,colour);
00669 image[((x - WINSTARTX) / 16) + (focusx * 16)]
00670 [((y - (WINSTARTY)) / 16) + (focusy * 16)] = colour;
00671 }
|
|
||||||||||||
|
Definition at line 674 of file picedit.c. 00675 {
00676 int xx, yy;
00677 xx = (x - WINSTARTX) / 8;
00678 xx = WINSTARTX + (xx * 8);
00679 yy = (y - WINSTARTY) / 8;
00680 yy = WINSTARTY + (yy * 8);
00681 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00682 Fgl_fillbox (xx, yy, 8, 8, colour);
00683 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00684 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00685
00686
00687 image[((x - WINSTARTX) / 8) + (focusx * 16)]
00688 [((y - (WINSTARTY)) / 8) + (focusy * 16)] = colour;
00689 draw_swin ();
00690 }
|
|
||||||||||||
|
Definition at line 693 of file picedit.c. 00694 {
00695 int xx, yy;
00696 xx = (x - WINSTARTX) / 5;
00697 if (xx > 47)
00698 return;
00699 xx = WINSTARTX + (xx * 5);
00700 yy = (y - WINSTARTY) / 5;
00701 if (yy > 47)
00702 return;
00703 yy = WINSTARTY + (yy * 5);
00704 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00705 Fgl_fillbox (xx, yy, 5, 5, colour);
00706 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00707 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00708
00709 Fgl_setpixel ((SWINSTARTX - 16) + ((x - WINSTARTX) / 5)
00710 + (focusx * 5)
00711 ,(SWINSTARTY - 16) + ((y - (WINSTARTY)) / 5) + (focusy * 5)
00712 ,colour);
00713 image[((x - WINSTARTX) / 5) + (focusx * 5)]
00714 [((y - (WINSTARTY)) / 5) + (focusy * 5)] = colour;
00715 }
|
|
||||||||||||
|
Definition at line 718 of file picedit.c. 00719 {
00720 int xx, yy;
00721 xx = (x - WINSTARTX) / 4;
00722 xx = WINSTARTX + (xx * 4);
00723 yy = (y - WINSTARTY) / 4;
00724 yy = WINSTARTY + (yy * 4);
00725 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00726 Fgl_fillbox (xx, yy, 4, 4, colour);
00727 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00728 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00729
00730 Fgl_setpixel ((SWINSTARTX - 24) + ((x - WINSTARTX) / 4)
00731 + (focusx * 4)
00732 ,(SWINSTARTY - 24) + ((y - (WINSTARTY)) / 4) + (focusy * 4)
00733 ,colour);
00734 image[((x - WINSTARTX) / 4) + (focusx * 4)]
00735 [((y - (WINSTARTY)) / 4) + (focusy * 4)] = colour;
00736 }
|
|
||||||||||||
|
Definition at line 632 of file picedit.c. 00633 {
00634 int xx, yy;
00635 xx = (x - WINSTARTX) / 16;
00636 xx = WINSTARTX + (xx * 16);
00637 yy = (y - WINSTARTY) / 16;
00638 yy = WINSTARTY + (yy * 16);
00639 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00640 Fgl_fillbox (xx, yy, 15, 15, colour);
00641 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00642 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00643
00644 Fgl_setpixel (((SWINSTARTX + 8) - imagesize * 8) + ((x - WINSTARTX) / 16)
00645 + (focusx * 16)
00646 ,((SWINSTARTY + 8) - imagesize * 8) + ((y - (WINSTARTY)) / 16) + (focusy * 16)
00647 ,colour);
00648 image[((x - WINSTARTX) / 16) + (focusx * 16)]
00649 [((y - (WINSTARTY)) / 16) + (focusy * 16)] = colour;
00650 }
|
|
|
Definition at line 424 of file picedit.c. 00425 {
00426 int y;
00427 if (zoom_flag == 0)
00428 return;
00429 Fgl_write (ZOOMBUTX - 10, ZOOMBUTY + 3, ">");
00430 Fgl_write (HALFBUTX - 10, HALFBUTY + 3, " ");
00431 Fgl_write (NORMBUTX - 10, NORMBUTY + 3, " ");
00432 if (imagesize == 3)
00433 {
00434 Fgl_fillbox (WINSTARTX - 1, WINSTARTY - 1
00435 ,258, 258, 0);
00436 Fgl_hline (WINSTARTX - 1, WINSTARTY - 1
00437 ,WINSTARTX + 240, 255);
00438 Fgl_hline (WINSTARTX - 1, WINSTARTY + 240
00439 ,WINSTARTX + 240, 255);
00440 Fgl_line (WINSTARTX - 1, WINSTARTY - 1, WINSTARTX - 1
00441 ,WINSTARTY + 240, 255);
00442 Fgl_line (WINSTARTX + 240, WINSTARTY - 1, WINSTARTX + 240
00443 ,WINSTARTY + 240, 255);
00444 }
00445 zoom_flag = 0;
00446 old_focusx = focusx;
00447 old_focusy = focusy;
00448 change_focus (0, 0);
00449
00450 draw_big_image ();
00451 }
|
|
|
Definition at line 454 of file picedit.c. 00455 {
00456 int y;
00457 if (zoom_flag == 2 || imagesize < 2)
00458 return;
00459 zoom_flag = 2;
00460 Fgl_write (ZOOMBUTX - 10, ZOOMBUTY + 3, " ");
00461 Fgl_write (HALFBUTX - 10, HALFBUTY + 3, ">");
00462 Fgl_write (NORMBUTX - 10, NORMBUTY + 3, " ");
00463 if (zoom_flag != 0)
00464 {
00465 old_focusx = focusx;
00466 old_focusy = focusy;
00467 }
00468 if (focusx >= (imagesize - 1))
00469 focusx = imagesize - 2;
00470 if (focusy >= (imagesize - 1))
00471 focusy = imagesize - 2;
00472 change_focus (focusx, focusy);
00473 draw_big_image ();
00474 }
|
|
||||||||||||
|
Definition at line 545 of file picedit.c. 00546 {
00547 int xx = 0, col, d;
00548 if (zoom_flag == 1)
00549 d = 16;
00550 else if (zoom_flag == 2)
00551 d = 8;
00552 else if (imagesize == 1)
00553 d = 16;
00554 else if (imagesize == 2)
00555 d = 8;
00556 else if (imagesize == 3)
00557 d = 5;
00558 else if (imagesize == 4)
00559 d = 4;
00560 col = image[((x - WINSTARTX) / d) + (focusx * 16)]
00561 [((y - (WINSTARTY)) / d) + (focusy * 16)];
00562
00563 while (((x - WINSTARTX) / d) + (focusx * 16) + xx < 16 * MAXIMAGESIZE
00564 && (image[((x - WINSTARTX) / d) + (focusx * 16) + xx]
00565 [((y - (WINSTARTY)) / d) + (focusy * 16)] == col))
00566 {
00567 image[((x - WINSTARTX) / d) + (focusx * 16) + xx]
00568 [((y - (WINSTARTY)) / d) + (focusy * 16)] = colour;
00569 xx++;
00570 }
00571 xx = -1;
00572 while (((x - WINSTARTX) / d) + (focusx * 16) + xx >= 0
00573 && (image[((x - WINSTARTX) / d) + (focusx * 16) + xx]
00574 [((y - (WINSTARTY)) / d) + (focusy * 16)] == col))
00575 {
00576 image[((x - WINSTARTX) / d) + (focusx * 16) + xx]
00577 [((y - (WINSTARTY)) / d) + (focusy * 16)] = colour;
00578 xx--;
00579 }
00580 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00581 draw_swin ();
00582 draw_big_image ();
00583 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00584 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00585 }
|
|
|
Definition at line 303 of file mouse.c. 00304 {
00305 mouse_hide_count++;
00306 if (mouse_hide_count == 1) {
00307 if (mouse_type == MOUSE_TYPE_SQUARE)
00308 hide_square_mouse ();
00309 else
00310 hide_normal_mouse ();
00311 }
00312 }
|
|
|
|
|
|
|
|
|
Definition at line 894 of file picedit.c. 00895 {
00896 int x, y, l;
00897 FILE *inf;
00898 if ((inf = fopen (imagefile, "rb")) == NULL)
00899 return;
00900 fseek (inf, 0L, SEEK_END);
00901 l = ftell (inf);
00902 fseek (inf, 0L, SEEK_SET);
00903 if (l == 256)
00904 newimagesize = 1;
00905 else if (l == 1024)
00906 newimagesize = 2;
00907 else if (l == 2304)
00908 newimagesize = 3;
00909 else if (l == 4096)
00910 newimagesize = 4;
00911 else
00912 {
00913 printf ("Can't load file %s, maybe wrong size %d\n"
00914 ,imagefile, l);
00915 exit (1);
00916 }
00917 for (y = 0; y < 16 * newimagesize; y++)
00918 for (x = 0; x < 16 * newimagesize; x++)
00919 image[x][y] = fgetc (inf);
00920 fclose (inf);
00921 }
|
|
||||||||||||
|
Definition at line 205 of file picedit.c. 00206 {
00207 int x, y, c, m, ox, oy;
00208 #ifdef LC_X11
00209 XEvent xev;
00210 char *geometry = NULL;
00211 #endif
00212 c = 0;
00213 stopflag = 0;
00214 newimagesize = 1;
00215
00216 #ifdef __EMX__
00217 strcpy(LIBDIR, __XOS2RedirRoot(OS2_DEFAULT_LIBDIR));
00218 #endif
00219
00220 #ifdef LC_X11
00221 borderx = BORDERX;
00222 bordery = BORDERY;
00223 parse_args (argc, argv, &geometry);
00224 printf ("Got past parse args\n");
00225 Create_Window (geometry);
00226 XSync (display.dpy, FALSE);
00227
00228 while (XPending (display.dpy) == 0);
00229 XNextEvent (display.dpy, &xev);
00230 HandleEvent (&xev);
00231
00232 printf ("Got past create window\n");
00233 #else
00234 lincityrc ();
00235 vga_init ();
00236 vga_setmode (G640x480x256);
00237 gl_setcontextvga (G640x480x256);
00238 #endif
00239
00240 setcustompalette ();
00241 initfont ();
00242 if (argc < 2)
00243 strcpy (imagefile, "imagefile.default");
00244 else
00245 {
00246 strcpy (imagefile, argv[1]);
00247 load_image ();
00248 }
00249 #ifndef LC_X11
00250 m = mouse_init ("/dev/mouse", lc_mouse_type, MOUSE_DEFAULTSAMPLERATE);
00251 mouse_setxrange (0, 640 - 1);
00252 mouse_setyrange (0, 480 - 1);
00253 mouse_setwrap (MOUSE_NOWRAP);
00254 #endif
00255 setup ();
00256 #ifdef LC_X11
00257 XSync (display.dpy, FALSE);
00258 #endif
00259 printf ("Got past setup\n");
00260 if (newimagesize != imagesize)
00261 change_imagesize (newimagesize);
00262 change_focus (0, 0);
00263 printf ("Got to do loop\n");
00264 do
00265 {
00266 #ifdef LC_X11
00267 if (XPending (display.dpy))
00268 {
00269 XNextEvent (display.dpy, &xev);
00270 HandleEvent (&xev);
00271 }
00272 if (mouse_button != 0)
00273 do_buttons (0, 0);
00274 #else
00275 c = vga_getkey ();
00276 mouse_waitforupdate ();
00277 mx = mouse_getx ();
00278 my = mouse_gety ();
00279 if (mx != mox || my != moy)
00280 {
00281 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00282 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00283 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00284 mox = mx;
00285 moy = my;
00286 }
00287 do_buttons (mx, my);
00288 #endif
00289 }
00290 while (c == 0 && stopflag == 0);
00291 printf ("Normal exit\n");
00292 #ifndef LC_X11
00293 mouse_close ();
00294 vga_setmode (TEXT);
00295 printf ("c=%d mouse %d\n", c, m);
00296 #endif
00297 save_image ();
00298 exit (0);
00299 }
|
|
|
Definition at line 478 of file picedit.c. 00479 {
00480 int y;
00481 if (zoom_flag == 1)
00482 return;
00483 Fgl_write (ZOOMBUTX - 10, ZOOMBUTY + 3, " ");
00484 Fgl_write (HALFBUTX - 10, HALFBUTY + 3, " ");
00485 Fgl_write (NORMBUTX - 10, NORMBUTY + 3, ">");
00486 Fgl_hline (WINSTARTX, WINSTARTY - 1, WINSTARTX + 256, 255);
00487 Fgl_hline (WINSTARTX, WINSTARTY + 256, WINSTARTX + 256, 255);
00488 Fgl_line (WINSTARTX - 1, WINSTARTY, WINSTARTX - 1, WINSTARTY + 256, 255);
00489 Fgl_line (WINSTARTX + 256, WINSTARTY
00490 ,WINSTARTX + 256, WINSTARTY + 256, 255);
00491 for (y = 0; y < 16; y++)
00492 {
00493 Fgl_hline (WINSTARTX, WINSTARTY + y * 16 + 15
00494 ,WINSTARTX + 255, 253);
00495 Fgl_line (WINSTARTX + y * 16 + 15, WINSTARTY, WINSTARTX + y * 16 + 15
00496 ,WINSTARTY + 255, 253);
00497 }
00498 zoom_flag = 1;
00499 change_focus (old_focusx, old_focusy);
00500 draw_big_image ();
00501 }
|
|
|
Definition at line 1148 of file picedit.c. 01149 {
01150 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
01151 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
01152 }
|
|
|
Definition at line 878 of file picedit.c. 00879 {
00880 int x, y;
00881 FILE *outf;
00882 if ((outf = fopen (imagefile, "wb")) == NULL)
00883 {
00884 printf ("Can't write image file %s \n", imagefile);
00885 return;
00886 }
00887 for (y = 0; y < 16 * imagesize; y++)
00888 for (x = 0; x < 16 * imagesize; x++)
00889 putc (image[x][y], outf);
00890 fclose (outf);
00891 }
|
|
|
Definition at line 259 of file lcsvga.c. 00260 {
00261 char s[100];
00262 int i, n, r, g, b, flag[256];
00263 FILE *inf;
00264 Palette pal;
00265 for (i = 0; i < 256; i++)
00266 flag[i] = 0;
00267 if ((inf = fopen (colour_pal_file, "r")) == 0)
00268 {
00269 printf ("The colour palette file <%s>... ", colour_pal_file);
00270 do_error ("Can't find it.");
00271 }
00272 while (feof (inf) == 0)
00273 {
00274 fgets (s, 99, inf);
00275 if (sscanf (s, "%d %d %d %d", &n, &r, &g, &b) == 4)
00276 {
00277 pal.color[n].red = r;
00278 pal.color[n].green = g;
00279 pal.color[n].blue = b;
00280 flag[n] = 1;
00281 }
00282 }
00283 fclose (inf);
00284 for (i = 0; i < 256; i++)
00285 {
00286 if (flag[i] == 0)
00287 {
00288 printf ("Colour %d not loaded\n", i);
00289 do_error ("Can't continue");
00290 }
00291 pal.color[i].red = (unsigned char) ((pal.color[i].red
00292 * (1 - gamma_correct_red)) + (64 * sin ((float) pal.color[i].red
00293 * M_PI / 128)) * gamma_correct_red);
00294
00295 pal.color[i].green = (unsigned char) ((pal.color[i].green
00296 * (1 - gamma_correct_green)) + (64 * sin ((float) pal.color[i].green
00297 * M_PI / 128)) * gamma_correct_green);
00298
00299 pal.color[i].blue = (unsigned char) ((pal.color[i].blue
00300 * (1 - gamma_correct_blue)) + (64 * sin ((float) pal.color[i].blue
00301 * M_PI / 128)) * gamma_correct_blue);
00302 }
00303 gl_setpalette (&pal);
00304 }
|
|
|
Definition at line 927 of file picedit.c. 00928 {
00929 char s[50];
00930 short x, y;
00931 Fgl_hline (WINSTARTX, WINSTARTY - 1, WINSTARTX + 256, 255);
00932 Fgl_hline (WINSTARTX, WINSTARTY + 256, WINSTARTX + 256, 255);
00933 Fgl_line (WINSTARTX - 1, WINSTARTY, WINSTARTX - 1, WINSTARTY + 256, 255);
00934 Fgl_line (WINSTARTX + 256, WINSTARTY, WINSTARTX + 256, WINSTARTY + 256, 255);
00935 for (y = 0; y < 16; y++)
00936 {
00937 Fgl_hline (WINSTARTX, WINSTARTY + y * 16 + 15, WINSTARTX + 255, 253);
00938 Fgl_line (WINSTARTX + y * 16 + 15, WINSTARTY, WINSTARTX + y * 16 + 15
00939 ,WINSTARTY + 255, 253);
00940 for (x = 0; x < 16; x++)
00941 {
00942 Fgl_fillbox (x * 40, y * 14, 38, 12, y * 16 + x);
00943 sprintf (s, "%d", y * 16 + x);
00944 Fgl_write (x * 40, y * 14, s);
00945 }
00946 }
00947 change_imagesize (1);
00948 Fgl_fillbox (SIZEBUTTONX1x1, SIZEBUTTONY1x1, SIZEBUTTONSIZEX - 1
00949 ,SIZEBUTTONSIZEY - 1, 240);
00950 Fgl_write (SIZEBUTTONX1x1 + 3, SIZEBUTTONY1x1 + 3, "1x1");
00951 Fgl_fillbox (SIZEBUTTONX2x2, SIZEBUTTONY2x2, SIZEBUTTONSIZEX - 1
00952 ,SIZEBUTTONSIZEY - 1, 240);
00953 Fgl_write (SIZEBUTTONX2x2 + 3, SIZEBUTTONY2x2 + 3, "2x2");
00954 Fgl_fillbox (SIZEBUTTONX3x3, SIZEBUTTONY3x3, SIZEBUTTONSIZEX - 1
00955 ,SIZEBUTTONSIZEY - 1, 240);
00956 Fgl_write (SIZEBUTTONX3x3 + 3, SIZEBUTTONY3x3 + 3, "3x3");
00957 Fgl_fillbox (SIZEBUTTONX4x4, SIZEBUTTONY4x4, SIZEBUTTONSIZEX - 1
00958 ,SIZEBUTTONSIZEY - 1, 240);
00959 Fgl_write (SIZEBUTTONX4x4 + 3, SIZEBUTTONY4x4 + 3, "4x4");
00960 /* this is the focus change window */
00961 Fgl_fillbox (FOCUSWINX - 1, FOCUSWINY - 1, FOCUSWINSIZE + 1, FOCUSWINSIZE + 1, 240);
00962 draw_focus ();
00963 /* this is the zoom button */
00964 Fgl_fillbox (ZOOMBUTX, ZOOMBUTY, ZOOMBUTSIZEX, ZOOMBUTSIZEY, 240);
00965 Fgl_write (ZOOMBUTX + 3, ZOOMBUTY + 3, "ZOOM");
00966 /* this is the half zoom button */
00967 Fgl_fillbox (HALFBUTX, HALFBUTY, HALFBUTSIZEX, HALFBUTSIZEY, 240);
00968 Fgl_write (HALFBUTX + 3, HALFBUTY + 3, "HALF");
00969 /* this is the normal zoom button */
00970 Fgl_fillbox (NORMBUTX, NORMBUTY, NORMBUTSIZEX, NORMBUTSIZEY, 240);
00971 Fgl_write (NORMBUTX + 3, NORMBUTY + 3, "NORM");
00972 /* this is the dot button */
00973 Fgl_fillbox (DOTBUTX, DOTBUTY, DOTBUTSIZEX, DOTBUTSIZEY, 240);
00974 Fgl_write (DOTBUTX + 3, DOTBUTY + 3, "DOT");
00975 /* this id the hline button */
00976 Fgl_fillbox (HFILBUTX, HFILBUTY, HFILBUTSIZEX, HFILBUTSIZEY, 240);
00977 Fgl_write (HFILBUTX + 3, HFILBUTY + 3, "HFIL");
00978 /* this is the vline button */
00979 Fgl_fillbox (VFILBUTX, VFILBUTY, VFILBUTSIZEX, VFILBUTSIZEY, 240);
00980 Fgl_write (VFILBUTX + 3, VFILBUTY + 3, "VFIL");
00981 Fgl_write (0, 480 - 9, imagefile);
00982 Fgl_write (0, 423, " q - to save and quit...");
00983 Fgl_write (0, 433, " - (then move the mouse)");
00984 Fgl_write (0, 448, "^C - to quit without saving");
00985 }
|
|
||||||||||||
|
Definition at line 588 of file picedit.c. 00589 {
00590 int yy = 0, col, d;
00591 if (zoom_flag == 1)
00592 d = 16;
00593 else if (zoom_flag == 2)
00594 d = 8;
00595 else if (imagesize == 1)
00596 d = 16;
00597 else if (imagesize == 2)
00598 d = 8;
00599 else if (imagesize == 3)
00600 d = 5;
00601 else if (imagesize == 4)
00602 d = 4;
00603 col = image[((x - WINSTARTX) / d) + (focusx * 16)]
00604 [((y - (WINSTARTY)) / d) + (focusy * 16)];
00605
00606 while (((y - WINSTARTY) / d) + (focusy * 16) + yy < 16 * MAXIMAGESIZE
00607 && (image[((x - WINSTARTX) / d) + (focusx * 16)]
00608 [((y - (WINSTARTY)) / d) + (focusy * 16) + yy] == col))
00609 {
00610 image[((x - WINSTARTX) / d) + (focusx * 16)]
00611 [((y - (WINSTARTY)) / d) + (focusy * 16) + yy] = colour;
00612 yy++;
00613 }
00614 yy = -1;
00615 while (((y - WINSTARTY) / d) + (focusy * 16) + yy >= 0
00616 && (image[((x - WINSTARTX) / d) + (focusx * 16)]
00617 [((y - (WINSTARTY)) / d) + (focusy * 16) + yy] == col))
00618 {
00619 image[((x - WINSTARTX) / d) + (focusx * 16)]
00620 [((y - (WINSTARTY)) / d) + (focusy * 16) + yy] = colour;
00621 yy--;
00622 }
00623 Fgl_putbox (mox, moy, 8, 8, under_mouse_pointer);
00624 draw_swin ();
00625 draw_big_image ();
00626 Fgl_getbox (mx, my, 8, 8, under_mouse_pointer);
00627 Fgl_putbox (mx, my, 8, 8, mouse_pointer);
00628 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Initial value:
{
255, 255, 255, 255, 1, 1, 1, 1,
255, 1, 1, 1, 255, 255, 1, 1,
255, 1, 255, 255, 255, 1, 255, 1,
255, 1, 255, 1, 1, 255, 1, 1,
1, 255, 255, 1, 1, 1, 255, 1,
1, 255, 1, 255, 1, 1, 1, 1,
1, 1, 255, 1, 255, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1}
|
|
|
|
|
|
|
|
|
|
1.3.9.1