├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── LICENSE
├── Makefile
├── Makefile.mk
├── README.md
├── configure
├── man
├── man1
│ ├── mlx.1
│ ├── mlx_loop.1
│ ├── mlx_new_image.1
│ ├── mlx_new_window.1
│ └── mlx_pixel_put.1
└── man3
│ ├── mlx.3
│ ├── mlx_loop.3
│ ├── mlx_new_image.3
│ ├── mlx_new_window.3
│ └── mlx_pixel_put.3
├── mlx.h
├── mlx_clear_window.c
├── mlx_destroy_display.c
├── mlx_destroy_image.c
├── mlx_destroy_window.c
├── mlx_expose_hook.c
├── mlx_ext_randr.c
├── mlx_flush_event.c
├── mlx_get_color_value.c
├── mlx_get_data_addr.c
├── mlx_hook.c
├── mlx_init.c
├── mlx_int.h
├── mlx_int_anti_resize_win.c
├── mlx_int_do_nothing.c
├── mlx_int_get_visual.c
├── mlx_int_param_event.c
├── mlx_int_set_win_event_mask.c
├── mlx_int_str_to_wordtab.c
├── mlx_int_wait_first_expose.c
├── mlx_key_hook.c
├── mlx_lib_xpm.c
├── mlx_loop.c
├── mlx_loop_hook.c
├── mlx_mouse.c
├── mlx_mouse_hook.c
├── mlx_new_image.c
├── mlx_new_window.c
├── mlx_pixel_put.c
├── mlx_put_image_to_window.c
├── mlx_rgb.c
├── mlx_screen_size.c
├── mlx_set_font.c
├── mlx_string_put.c
├── mlx_xpm.c
├── mlx_xpm.c.ok
├── rgb2c.pl
└── test
├── Makefile.mk
├── main.c
├── new_win.c
├── open.xpm
├── open24.xpm
├── open30.xpm
└── run_tests.sh
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ${{ matrix.os }}
13 | env:
14 | DISPLAY: ":99"
15 | strategy:
16 | fail-fast: false
17 | matrix:
18 | os: [ubuntu-latest, macos-latest]
19 |
20 | timeout-minutes: 20
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Install mlx dependencies
24 | run: |
25 | set -x
26 | if [ "$RUNNER_OS" == "Linux" ]; then
27 | sudo apt-get update -qq
28 | sudo apt-get install -y -qq gcc make xorg libxext-dev libbsd-dev
29 | elif [ "$RUNNER_OS" == "macOS" ]; then
30 | brew install xquartz
31 | echo "/usr/X11/bin" >> $GITHUB_PATH
32 | else
33 | echo "$RUNNER_OS not supported"
34 | exit 1
35 | fi
36 | - name: Setup x11 headless testing environment
37 | run: |
38 | set -x
39 | if [ "$RUNNER_OS" == "Linux" ]; then
40 | sudo apt-get install xvfb xdotool valgrind
41 | Xvfb $DISPLAY -screen 0 1280x1024x24 &
42 | elif [ "$RUNNER_OS" == "macOS" ]; then
43 | brew install xdotool
44 | defaults write org.x.X11 enable_test_extensions -boolean true
45 | sudo Xvfb $DISPLAY -screen 0 1280x1024x24 &
46 | else
47 | echo "$RUNNER_OS not supported"
48 | exit 1
49 | fi
50 | - name: Run ./configure
51 | run: ./configure
52 |
53 | - name: make check Linux
54 | if: matrix.os == 'ubuntu-latest'
55 | run: make -f Makefile.gen check
56 | - name: make check MacOS
57 | continue-on-error: true
58 | if: matrix.os == 'macos-latest'
59 | run: make -f Makefile.gen check
60 | # Didn't find a way to simulate inputs on Macos. libxdo seem to no longer work on macos.
61 | # It can be partially fixed writing proper unit-tests, thus avoiding the need of libxdo.
62 |
63 | - name: Check leaks from binary "test/mlx-test"
64 | run: |
65 | cd test
66 | if [ "$RUNNER_OS" == "Linux" ]; then
67 | echo "Info: Still reachable doesn't matter. Valgrind will return success on thoses reports.
68 | It is fine, we searching for lost pointers. Valgrind will return exit status 42 if any block is lost."
69 | valgrind --leak-check=full --show-leak-kinds=definite,indirect,possible --errors-for-leak-kinds=definite,indirect,possible --error-exitcode=42 ./mlx-test > /dev/null &
70 | PID=$!
71 | sleep 30
72 | xdotool search --name Title3 windowfocus key Escape
73 | xdotool search --name Title2 windowfocus key Escape
74 | wait $PID
75 | elif [ "$RUNNER_OS" == "macOS" ]; then
76 | MallocStackLoggingNoCompact=1
77 | ./mlx-test &
78 | sleep 30
79 | leaks mlx-test
80 | pkill mlx-test
81 | fi
82 |
83 | - name: Norminette, just for fun
84 | continue-on-error: true
85 | run: |
86 | pip3 install Norminette
87 | norminette *.c *.h
88 | norminette --version
89 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Mlx related
2 | Makefile.gen
3 | /test/mlx-test
4 |
5 | ## Editor
6 | .vscode/*
7 | *~
8 | \#*\#
9 |
10 | ## Other
11 | .DS_STORE
12 |
13 |
14 |
15 | ## Template from https://github.com/github/gitignore
16 | # Prerequisites
17 | *.d
18 |
19 | # Object files
20 | *.o
21 | *.ko
22 | *.obj
23 | *.elf
24 |
25 | # Linker output
26 | *.ilk
27 | *.map
28 | *.exp
29 |
30 | # Precompiled Headers
31 | *.gch
32 | *.pch
33 |
34 | # Libraries
35 | *.lib
36 | *.a
37 | *.la
38 | *.lo
39 |
40 | # Shared objects (inc. Windows DLLs)
41 | *.dll
42 | *.so
43 | *.so.*
44 | *.dylib
45 |
46 | # Executables
47 | *.exe
48 | *.out
49 | *.app
50 | *.i*86
51 | *.x86_64
52 | *.hex
53 |
54 | # Debug files
55 | *.dSYM/
56 | *.su
57 | *.idb
58 | *.pdb
59 |
60 | # Kernel Module Compile Results
61 | *.mod*
62 | *.cmd
63 | .tmp_versions/
64 | modules.order
65 | Module.symvers
66 | Mkfile.old
67 | dkms.conf
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2021, Ecole 42
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ##
2 | ## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
3 | ##
4 | ## Made by Olivier Crouzet
5 | ## Login
6 | ##
7 | ## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
8 | ## Last update Tue May 15 15:44:41 2007 Olivier Crouzet
9 | ##
10 |
11 | ## Please use configure script
12 |
13 |
14 | all : do_configure
15 |
16 | do_configure :
17 | ./configure
18 |
19 | clean :
20 | ./configure clean
21 |
22 | re : clean all
23 |
--------------------------------------------------------------------------------
/Makefile.mk:
--------------------------------------------------------------------------------
1 | ##
2 | ## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
3 | ##
4 | ## Made by Olivier Crouzet
5 | ## Login
6 | ##
7 | ## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
8 | ## Last update Tue May 15 15:41:20 2007 Olivier Crouzet
9 | ##
10 |
11 | ## Please use configure script
12 |
13 |
14 | INC =%%%%
15 |
16 | UNAME = $(shell uname)
17 | CC = gcc
18 | ifeq ($(UNAME),FreeBSD)
19 | CC = clang
20 | endif
21 |
22 | NAME = libmlx.a
23 | NAME_UNAME = libmlx_$(UNAME).a
24 |
25 | SRC = mlx_init.c mlx_new_window.c mlx_pixel_put.c mlx_loop.c \
26 | mlx_mouse_hook.c mlx_key_hook.c mlx_expose_hook.c mlx_loop_hook.c \
27 | mlx_int_anti_resize_win.c mlx_int_do_nothing.c \
28 | mlx_int_wait_first_expose.c mlx_int_get_visual.c \
29 | mlx_flush_event.c mlx_string_put.c mlx_set_font.c \
30 | mlx_new_image.c mlx_get_data_addr.c \
31 | mlx_put_image_to_window.c mlx_get_color_value.c mlx_clear_window.c \
32 | mlx_xpm.c mlx_int_str_to_wordtab.c mlx_destroy_window.c \
33 | mlx_int_param_event.c mlx_int_set_win_event_mask.c mlx_hook.c \
34 | mlx_rgb.c mlx_destroy_image.c mlx_mouse.c mlx_screen_size.c \
35 | mlx_destroy_display.c
36 |
37 | OBJ_DIR = obj
38 | OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:%.c=%.o))
39 | CFLAGS = -O3 -I$(INC)
40 |
41 | all : $(NAME)
42 |
43 | $(OBJ_DIR)/%.o: %.c
44 | @mkdir -p $(OBJ_DIR)
45 | $(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
46 |
47 | $(NAME) : $(OBJ)
48 | ar -r $(NAME) $(OBJ)
49 | ranlib $(NAME)
50 | cp $(NAME) $(NAME_UNAME)
51 |
52 | check: all
53 | @test/run_tests.sh
54 |
55 | show:
56 | @printf "NAME : $(NAME)\n"
57 | @printf "NAME_UNAME : $(NAME_UNAME)\n"
58 | @printf "CC : $(CC)\n"
59 | @printf "CFLAGS : $(CFLAGS)\n"
60 | @printf "SRC :\n $(SRC)\n"
61 | @printf "OBJ :\n $(OBJ)\n"
62 |
63 | clean :
64 | rm -rf $(OBJ_DIR)/ $(NAME) $(NAME_UNAME) *~ core *.core
65 |
66 | .PHONY: all check show clean
67 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/42Paris/minilibx-linux/actions/workflows/ci.yml)
2 |
3 | This is the MinilibX, a simple X-Window (X11R6) programming API
4 | in C, designed for students, suitable for X-beginners.
5 |
6 |
7 | Contents
8 |
9 | - source code in C to create the mlx library
10 | - man pages (in man/ directory)
11 | - a test program (in test/ directory) is built
12 | with the library
13 | - a public include file mlx.h
14 | - a tiny configure script to generate an appropriate Makefile.gen
15 |
16 | Requirements for Linux
17 |
18 | - MinilibX only support TrueColor visual type (8,15,16,24 or 32 bits depth)
19 | - gcc
20 | - make
21 | - X11 include files (package xorg)
22 | - XShm extension must be present (package libxext-dev)
23 | - Utility functions from BSD systems - development files (package libbsd-dev)
24 | - **e.g. _sudo apt-get install gcc make xorg libxext-dev libbsd-dev_ (Debian/Ubuntu)**
25 |
26 | Requirements for MacOS
27 | - [Xquartz](https://www.xquartz.org/)
28 |
29 | ```bash
30 | ➜ ~ Brew install Xquartz
31 | ➜ ~ reboot
32 | ➜ ~ xeyes # run an hello world X11 app
33 | ```
34 |
35 | MlX Color Opacity / Transparency / Alpha (32 bits depth)
36 | - 0xFF (fully transparent) or 0x00 (fully opaque)
37 |
38 | Compile MinilibX
39 |
40 | - run ./configure or make
41 | both will make a few tests, create Makefile.gen
42 | and then automatically run make on this generated Makefile.gen .
43 | libmlx.a and libmlx_$(HOSTTYPE).a are created.
44 | test/mlx-test binary is also created.
45 |
46 |
47 | Install MinilibX
48 |
49 | - no installation script is provided. You may want to install
50 | - libmlx.a and/or libmlx_$(HOSTTYPE).a in /usr/X11/lib or /usr/local/lib
51 | - mlx.h in /usr/X11/include or /usr/local/include
52 | - man/man3/mlx*.1 in /usr/X11/man/man3 or /usr/local/man/man3
53 |
54 |
55 | Olivier CROUZET - 2014-01-06 -
56 |
--------------------------------------------------------------------------------
/configure:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | set -e
4 |
5 | BOLD="\033[1m"
6 | RESET="\033[0m"
7 | LIGHT_RED="\033[91m"
8 | LIGHT_GREEN="\033[92m"
9 | LIGHT_CYAN="\033[96m"
10 |
11 | logging(){
12 | local type=$1; shift
13 | printf "${LIGHT_CYAN}${BOLD}configure${RESET} [%b] : %b\n" "$type" "$*"
14 | }
15 | log_info(){
16 | logging "${LIGHT_GREEN}info${RESET}" "$@"
17 | }
18 | log_error(){
19 | logging "${LIGHT_RED}error${RESET}" "$@" >&2
20 | }
21 |
22 | # find and print x11 header path
23 | get_xlib_include_path(){
24 | local result=""
25 |
26 | for inc in \
27 | /usr/X11/include \
28 | /usr/X11R6/include \
29 | /usr/X11R5/include \
30 | /usr/X11R4/include \
31 | \
32 | /usr/include \
33 | /usr/include/X11 \
34 | /usr/include/X11R6 \
35 | /usr/include/X11R5 \
36 | /usr/include/X11R4 \
37 | \
38 | /usr/local/X11/include \
39 | /usr/local/X11R6/include \
40 | /usr/local/X11R5/include \
41 | /usr/local/X11R4/include \
42 | \
43 | /usr/local/include/X11 \
44 | /usr/local/include/X11R6 \
45 | /usr/local/include/X11R5 \
46 | /usr/local/include/X11R4 \
47 | \
48 | /usr/X386/include \
49 | /usr/x386/include \
50 | /usr/XFree86/include/X11 \
51 | \
52 | /usr/local/include \
53 | /usr/athena/include \
54 | /usr/local/x11r5/include \
55 | /usr/lpp/Xamples/include \
56 | \
57 | /usr/openwin/include \
58 | /usr/openwin/share/include
59 | do
60 | if [ -f "$inc/X11/Xlib.h" -a -f "$inc/X11/extensions/XShm.h" ]; then
61 | result=$inc
62 | break
63 | fi
64 | done
65 | echo $result
66 | }
67 |
68 | show_help(){
69 | cat < Makefile.gen
115 | cat Makefile.mk | grep -v %%%% >> Makefile.gen
116 | log_info 'Generate "test/makefile.gen" from template "test/makefile.mk"'
117 | echo "INC=$xlib_inc" > test/Makefile.gen
118 | cat test/Makefile.mk | grep -v %%%% >> test/Makefile.gen
119 |
120 | log_info 'Execute "make all" from file "makefile.gen"'
121 | ${MAKE} -f Makefile.gen all
122 | log_info 'Execute "make all" from file "test/makefile.gen"'
123 | (cd test ; ${MAKE} -f Makefile.gen all )
124 | }
125 |
126 | main "$@"
127 |
--------------------------------------------------------------------------------
/man/man1/mlx.1:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Simple X-Window Interface Library for students
4 | .SH SYNOPSYS
5 | #include
6 |
7 | .nf
8 | .I void *
9 | .fi
10 | .B mlx_init
11 | ();
12 |
13 | .SH DESCRIPTION
14 | MiniLibX is an easy way to create graphical software,
15 | without any X-Window programming knowledge. It provides
16 | simple window creation, a drawing tool, image and basic events
17 | management.
18 |
19 | .SH X-WINDOW CONCEPT
20 |
21 | X-Window is a network-oriented graphical system for Unix.
22 | It is based on two main parts:
23 | .br
24 | On one side, your software wants to draw something on the screen and/or
25 | get keyboard & mouse entries.
26 | .br
27 | On the other side, the X-Server manages the screen, keyboard and mouse
28 | (It is often refered to as a "display").
29 | .br
30 | A network connection must be established between these two entities to send
31 | drawing orders (from the software to the X-Server), and keyboard/mouse
32 | events (from the X-Server to the software).
33 |
34 | .SH INCLUDE FILE
35 | .B mlx.h
36 | should be included for a correct use of the MiniLibX API.
37 | It only contains function prototypes, no structure is needed.
38 |
39 | .SH LIBRARY FUNCTIONS
40 | .P
41 | First of all, you need to initialize the connection
42 | between your software and the display.
43 | Once this connection is established, you'll be able to
44 | use other MiniLibX functions to send the X-Server messages,
45 | like "I want to draw a yellow pixel in this window" or "did the
46 | user hit a key?".
47 | .P
48 | The
49 | .B mlx_init
50 | function will create this connection. No parameters are needed, ant it will
51 | return a
52 | .I "void *"
53 | identifier, used for further calls to the library routines.
54 | .P
55 | All other MiniLibX functions are described in the following man pages:
56 |
57 | .TP 20
58 | .B mlx_new_window
59 | : manage windows
60 | .TP 20
61 | .B mlx_pixel_put
62 | : draw inside window
63 | .TP 20
64 | .B mlx_new_image
65 | : manipulate images
66 | .TP 20
67 | .B mlx_loop
68 | : handle keyboard or mouse events
69 |
70 | .SH LINKING MiniLibX
71 | To use MiniLibX functions, you'll need to link
72 | your software with several libraries, including the MiniLibX library itself.
73 | To do this, simply add the following arguments at linking time:
74 |
75 | .B -lmlx -lXext -lX11
76 |
77 | You may also need to specify the path to these libraries, using
78 | the
79 | .B -L
80 | flag.
81 |
82 |
83 | .SH RETURN VALUES
84 | If
85 | .B mlx_init()
86 | fails to set up the connection to the X server, it will return NULL, otherwise
87 | a non-null pointer is returned as a connection identifier.
88 |
89 | .SH SEE ALSO
90 | mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
91 |
92 | .SH AUTHOR
93 | Copyright ol@ - 2002-2014 - Olivier Crouzet
94 |
--------------------------------------------------------------------------------
/man/man1/mlx_loop.1:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Handle events
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I int
8 | .fi
9 | .B mlx_loop
10 | (
11 | .I void *mlx_ptr
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_key_hook
18 | (
19 | .I void *win_ptr, int (*funct_ptr)(), void *param
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_mouse_hook
26 | (
27 | .I void *win_ptr, int (*funct_ptr)(), void *param
28 | );
29 |
30 | .nf
31 | .I int
32 | .fi
33 | .B mlx_expose_hook
34 | (
35 | .I void *win_ptr, int (*funct_ptr)(), void *param
36 | );
37 |
38 | .nf
39 | .I int
40 | .fi
41 | .B mlx_loop_hook
42 | (
43 | .I void *mlx_ptr, int (*funct_ptr)(), void *param
44 | );
45 |
46 | .SH X-WINDOW EVENTS
47 |
48 | The X-Window system is bi-directionnal. On one hand, the program sends orders to
49 | the screen to display pixels, images, and so on. On the other hand,
50 | it can get information from the keyboard and mouse associated to
51 | the screen. To do so, the program receives "events" from the keyboard or the
52 | mouse.
53 |
54 | .SH DESCRIPTION
55 |
56 | To receive events, you must use
57 | .B mlx_loop
58 | (). This function never returns. It is an infinite loop that waits for
59 | an event, and then calls a user-defined function associated with this event.
60 | A single parameter is needed, the connection identifier
61 | .I mlx_ptr
62 | (see the
63 | .B mlx manual).
64 |
65 | You can assign different functions to the three following events:
66 | .br
67 | - A key is pressed
68 | .br
69 | - The mouse button is pressed
70 | .br
71 | - A part of the window should be re-drawn
72 | (this is called an "expose" event, and it is your program's job to handle it).
73 | .br
74 |
75 | Each window can define a different function for the same event.
76 |
77 | The three functions
78 | .B mlx_key_hook
79 | (),
80 | .B mlx_mouse_hook
81 | () and
82 | .B mlx_expose_hook
83 | () work exactly the same way.
84 | .I funct_ptr
85 | is a pointer to the function you want to be called
86 | when an event occurs. This assignment is specific to the window defined by the
87 | .I win_ptr
88 | identifier. The
89 | .I param
90 | adress will be passed to the function everytime it is called, and should be
91 | used to store the parameters it might need.
92 |
93 | The syntax for the
94 | .B mlx_loop_hook
95 | () function is identical to the previous ones, but the given function will be
96 | called when no event occurs.
97 |
98 | When it catches an event, the MiniLibX calls the corresponding function
99 | with fixed parameters:
100 | .nf
101 |
102 | expose_hook(void *param);
103 | key_hook(int keycode,void *param);
104 | mouse_hook(int button,int x,int y,void *param);
105 | loop_hook(void *param);
106 |
107 | .fi
108 | These function names are arbitrary. They here are used to distinguish
109 | parameters according to the event. These functions are NOT part of the
110 | MiniLibX.
111 |
112 | .I param
113 | is the address specified in the mlx_*_hook calls. This address is never
114 | used nor modified by the MiniLibX. On key and mouse events, additional
115 | information is passed:
116 | .I keycode
117 | tells you which key is pressed (look for the X11 include file "keysymdef.h"),
118 | (
119 | .I x
120 | ,
121 | .I y
122 | ) are the coordinates of the mouse click in the window, and
123 | .I button
124 | tells you which mouse button was pressed.
125 |
126 | .SH GOING FURTHER WITH EVENTS
127 | The MiniLibX provides a much generic access to all X-Window events. The
128 | .I mlx.h
129 | include define
130 | .B mlx_hook()
131 | in the same manner mlx_*_hook functions work. The event and mask values
132 | will be taken from the X11 include file "X.h".
133 |
134 | See source code of mlx_int_param_event.c to find out how the MiniLibX will
135 | call your own function for a specific event.
136 |
137 | .SH SEE ALSO
138 | mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3)
139 |
140 | .SH AUTHOR
141 | Copyright ol@ - 2002-2014 - Olivier Crouzet
142 |
--------------------------------------------------------------------------------
/man/man1/mlx_new_image.1:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Manipulating images
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I void *
8 | .fi
9 | .B mlx_new_image
10 | (
11 | .I void *mlx_ptr, int width, int height
12 | );
13 |
14 | .nf
15 | .I char *
16 | .fi
17 | .B mlx_get_data_addr
18 | (
19 | .I void *img_ptr, int *bits_per_pixel, int *size_line, int *endian
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_put_image_to_window
26 | (
27 | .I void *mlx_ptr, void *win_ptr, void *img_ptr, int x, int y
28 | );
29 |
30 | .nf
31 | .I unsigned int
32 | .fi
33 | .B mlx_get_color_value
34 | (
35 | .I void *mlx_ptr, int color
36 | );
37 |
38 | .nf
39 | .I void *
40 | .fi
41 | .B mlx_xpm_to_image
42 | (
43 | .I void *mlx_ptr, char **xpm_data, int *width, int *height
44 | );
45 |
46 | .nf
47 | .I void *
48 | .fi
49 | .B mlx_xpm_file_to_image
50 | (
51 | .I void *mlx_ptr, char *filename, int *width, int *height
52 | );
53 |
54 | .nf
55 | .I int
56 | .fi
57 | .B mlx_destroy_image
58 | (
59 | .I void *mlx_ptr, void *img_ptr
60 | );
61 |
62 |
63 | .SH DESCRIPTION
64 |
65 | .B mlx_new_image
66 | () creates a new image in memory. It returns a
67 | .I void *
68 | identifier needed to manipulate this image later. It only needs
69 | the size of the image to be created, using the
70 | .I width
71 | and
72 | .I height
73 | parameters, and the
74 | .I mlx_ptr
75 | connection identifier (see the
76 | .B mlx
77 | manual).
78 |
79 | The user can draw inside the image (see below), and
80 | can dump the image inside a specified window at any time to
81 | display it on the screen. This is done using
82 | .B mlx_put_image_to_window
83 | (). Three identifiers are needed here, for the connection to the
84 | display, the window to use, and the image (respectively
85 | .I mlx_ptr
86 | ,
87 | .I win_ptr
88 | and
89 | .I img_ptr
90 | ). The (
91 | .I x
92 | ,
93 | .I y
94 | ) coordinates define where the image should be placed in the window.
95 |
96 | .B mlx_get_data_addr
97 | () returns information about the created image, allowing a user
98 | to modify it later. The
99 | .I img_ptr
100 | parameter specifies the image to use. The three next parameters should
101 | be the addresses of three different valid integers.
102 | .I bits_per_pixel
103 | will be filled with the number of bits needed to represent a pixel color
104 | (also called the depth of the image).
105 | .I size_line
106 | is the number of bytes used to store one line of the image in memory.
107 | This information is needed to move from one line to another in the image.
108 | .I endian
109 | tells you wether the pixel color in the image needs to be stored in
110 | little endian (
111 | .I endian
112 | == 0), or big endian (
113 | .I endian
114 | == 1).
115 |
116 | .B mlx_get_data_addr
117 | returns a
118 | .I char *
119 | address that represents the begining of the memory area where the image
120 | is stored. From this adress, the first
121 | .I bits_per_pixel
122 | bits represent the color of the first pixel in the first line of
123 | the image. The second group of
124 | .I bits_per_pixel
125 | bits represent the second pixel of the first line, and so on.
126 | Add
127 | .I size_line
128 | to the adress to get the begining of the second line. You can reach any
129 | pixels of the image that way.
130 |
131 | .B mlx_destroy_image
132 | destroys the given image (
133 | .I img_ptr
134 | ).
135 |
136 | .SH STORING COLOR INSIDE IMAGES
137 |
138 | Depending on the display, the number of bits used to store a pixel color
139 | can change. The user usually represents a color in RGB mode, using
140 | one byte for each component (see
141 | .B mlx_pixel_put
142 | manual). This must be translated to fit the
143 | .I bits_per_pixel
144 | requirement of the image, and make the color understandable to the X-Server.
145 | That is the purpose of the
146 | .B mlx_get_color_value
147 | () function. It takes a standard RGB
148 | .I color
149 | parameter, and returns an
150 | .I unsigned int
151 | value.
152 | The
153 | .I bits_per_pixel
154 | least significant bits of this value can be stored in the image.
155 |
156 | Keep in mind that the least significant bits position depends on the local
157 | computer's endian. If the endian of the image (in fact the endian of
158 | the X-Server's computer) differs from the local endian, then the value should
159 | be transformed before being used.
160 |
161 | .SH XPM IMAGES
162 |
163 | The
164 | .B mlx_xpm_to_image
165 | () and
166 | .B mlx_xpm_file_to_image
167 | () functions will create a new image the same way.
168 | They will fill it using the specified
169 | .I xpm_data
170 | or
171 | .I filename
172 | , depending on which function is used.
173 | Note that MiniLibX does not use the standard
174 | Xpm library to deal with xpm images. You may not be able to
175 | read all types of xpm images. It however handles transparency.
176 |
177 | .SH RETURN VALUES
178 | The three functions that create images,
179 | .B mlx_new_image()
180 | ,
181 | .B mlx_xpm_to_image()
182 | and
183 | .B mlx_xpm_file_to_image()
184 | , will return NULL if an error occurs. Otherwise they return a non-null pointer
185 | as an image identifier.
186 |
187 |
188 | .SH SEE ALSO
189 | mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_loop(3)
190 |
191 | .SH AUTHOR
192 | Copyright ol@ - 2002-2014 - Olivier Crouzet
193 |
--------------------------------------------------------------------------------
/man/man1/mlx_new_window.1:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Managing windows
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I void *
8 | .fi
9 | .B mlx_new_window
10 | (
11 | .I void *mlx_ptr, int size_x, int size_y, char *title
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_clear_window
18 | (
19 | .I void *mlx_ptr, void *win_ptr
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_destroy_window
26 | (
27 | .I void *mlx_ptr, void *win_ptr
28 | );
29 |
30 |
31 | .SH DESCRIPTION
32 | The
33 | .B mlx_new_window
34 | () function creates a new window on the screen, using the
35 | .I size_x
36 | and
37 | .I size_y
38 | parameters to determine its size, and
39 | .I title
40 | as the text that should be displayed in the window's title bar.
41 | The
42 | .I mlx_ptr
43 | parameter is the connection identifier returned by
44 | .B mlx_init
45 | () (see the
46 | .B mlx
47 | man page).
48 | .B mlx_new_window
49 | () returns a
50 | .I void *
51 | window identifier that can be used by other MiniLibX calls.
52 | Note that the MiniLibX
53 | can handle an arbitrary number of separate windows.
54 |
55 | .B mlx_clear_window
56 | () and
57 | .B mlx_destroy_window
58 | () respectively clear (in black) and destroy the given window. They both have
59 | the same parameters:
60 | .I mlx_ptr
61 | is the screen connection identifier, and
62 | .I win_ptr
63 | is a window identifier.
64 |
65 | .SH RETURN VALUES
66 | If
67 | .B mlx_new_window()
68 | fails to create a new window (for wathever reason), it will return NULL,
69 | otherwise a non-null pointer is returned as a window identifier.
70 | .B mlx_clear_window
71 | and
72 | .B mlx_destroy_window
73 | right now return nothing.
74 |
75 | .SH SEE ALSO
76 | mlx(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
77 |
78 | .SH AUTHOR
79 | Copyright ol@ - 2002-2014 - Olivier Crouzet
80 |
--------------------------------------------------------------------------------
/man/man1/mlx_pixel_put.1:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Drawing inside windows
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I int
8 | .fi
9 | .B mlx_pixel_put
10 | (
11 | .I void *mlx_ptr, void *win_ptr, int x, int y, int color
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_string_put
18 | (
19 | .I void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string
20 | );
21 |
22 |
23 | .SH DESCRIPTION
24 | The
25 | .B mlx_pixel_put
26 | () function draws a defined pixel in the window
27 | .I win_ptr
28 | using the (
29 | .I x
30 | ,
31 | .I y
32 | ) coordinates, and the specified
33 | .I color
34 | \&. The origin (0,0) is the upper left corner of the window, the x and y axis
35 | respectively pointing right and down. The connection
36 | identifier,
37 | .I mlx_ptr
38 | , is needed (see the
39 | .B mlx
40 | man page).
41 |
42 | Parameters for
43 | .B mlx_string_put
44 | () have the same meaning. Instead of a simple pixel, the specified
45 | .I string
46 | will be displayed at (
47 | .I x
48 | ,
49 | .I y
50 | ).
51 |
52 | In both functions, it is impossible to display anything outside the
53 | specified window, nor display in another window in front of the selected one.
54 |
55 | .SH COLOR MANAGEMENT
56 | The
57 | .I color
58 | parameter has an integer type. The displayed color needs to be encoded
59 | in this integer, following a defined scheme. All displayable colors
60 | can be split in 3 basic colors: red, green and blue. Three associated
61 | values, in the 0-255 range, represent how much of each color is mixed up
62 | to create the original color. Theses three values must be set inside the
63 | integer to display the right color. The three least significant bytes of
64 | this integer are filled as shown in the picture below:
65 |
66 | .TS
67 | allbox;
68 | c s s s s
69 | r c c c c.
70 | Color Integer
71 | Interpretation \[*a] R G B
72 | Bit numbers 31..24 23..16 15..8 7..0
73 | .TE
74 |
75 | While filling the integer, make sure you avoid endian problems. Remember
76 | that the "blue" byte should always be the least significant one.
77 |
78 |
79 | .SH SEE ALSO
80 | mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3)
81 |
82 |
83 | .SH AUTHOR
84 | Copyright ol@ - 2002-2014 - Olivier Crouzet
85 |
--------------------------------------------------------------------------------
/man/man3/mlx.3:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Simple X-Window Interface Library for students
4 | .SH SYNOPSYS
5 | #include
6 |
7 | .nf
8 | .I void *
9 | .fi
10 | .B mlx_init
11 | ();
12 |
13 | .SH DESCRIPTION
14 | MiniLibX is an easy way to create graphical software,
15 | without any X-Window programming knowledge. It provides
16 | simple window creation, a drawing tool, image and basic events
17 | management.
18 |
19 | .SH X-WINDOW CONCEPT
20 |
21 | X-Window is a network-oriented graphical system for Unix.
22 | It is based on two main parts:
23 | .br
24 | On one side, your software wants to draw something on the screen and/or
25 | get keyboard & mouse entries.
26 | .br
27 | On the other side, the X-Server manages the screen, keyboard and mouse
28 | (It is often refered to as a "display").
29 | .br
30 | A network connection must be established between these two entities to send
31 | drawing orders (from the software to the X-Server), and keyboard/mouse
32 | events (from the X-Server to the software).
33 |
34 | .SH INCLUDE FILE
35 | .B mlx.h
36 | should be included for a correct use of the MiniLibX API.
37 | It only contains function prototypes, no structure is needed.
38 |
39 | .SH LIBRARY FUNCTIONS
40 | .P
41 | First of all, you need to initialize the connection
42 | between your software and the display.
43 | Once this connection is established, you'll be able to
44 | use other MiniLibX functions to send the X-Server messages,
45 | like "I want to draw a yellow pixel in this window" or "did the
46 | user hit a key?".
47 | .P
48 | The
49 | .B mlx_init
50 | function will create this connection. No parameters are needed, ant it will
51 | return a
52 | .I "void *"
53 | identifier, used for further calls to the library routines.
54 | .P
55 | All other MiniLibX functions are described in the following man pages:
56 |
57 | .TP 20
58 | .B mlx_new_window
59 | : manage windows
60 | .TP 20
61 | .B mlx_pixel_put
62 | : draw inside window
63 | .TP 20
64 | .B mlx_new_image
65 | : manipulate images
66 | .TP 20
67 | .B mlx_loop
68 | : handle keyboard or mouse events
69 |
70 | .SH LINKING MiniLibX
71 | To use MiniLibX functions, you'll need to link
72 | your software with several libraries, including the MiniLibX library itself.
73 | To do this, simply add the following arguments at linking time:
74 |
75 | .B -lmlx -lXext -lX11
76 |
77 | You may also need to specify the path to these libraries, using
78 | the
79 | .B -L
80 | flag.
81 |
82 |
83 | .SH RETURN VALUES
84 | If
85 | .B mlx_init()
86 | fails to set up the connection to the X server, it will return NULL, otherwise
87 | a non-null pointer is returned as a connection identifier.
88 |
89 | .SH SEE ALSO
90 | mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
91 |
92 | .SH AUTHOR
93 | Copyright ol@ - 2002-2014 - Olivier Crouzet
94 |
--------------------------------------------------------------------------------
/man/man3/mlx_loop.3:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Handle events
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I int
8 | .fi
9 | .B mlx_loop
10 | (
11 | .I void *mlx_ptr
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_key_hook
18 | (
19 | .I void *win_ptr, int (*funct_ptr)(), void *param
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_mouse_hook
26 | (
27 | .I void *win_ptr, int (*funct_ptr)(), void *param
28 | );
29 |
30 | .nf
31 | .I int
32 | .fi
33 | .B mlx_expose_hook
34 | (
35 | .I void *win_ptr, int (*funct_ptr)(), void *param
36 | );
37 |
38 | .nf
39 | .I int
40 | .fi
41 | .B mlx_loop_hook
42 | (
43 | .I void *mlx_ptr, int (*funct_ptr)(), void *param
44 | );
45 |
46 | .SH X-WINDOW EVENTS
47 |
48 | The X-Window system is bi-directionnal. On one hand, the program sends orders to
49 | the screen to display pixels, images, and so on. On the other hand,
50 | it can get information from the keyboard and mouse associated to
51 | the screen. To do so, the program receives "events" from the keyboard or the
52 | mouse.
53 |
54 | .SH DESCRIPTION
55 |
56 | To receive events, you must use
57 | .B mlx_loop
58 | (). This function never returns. It is an infinite loop that waits for
59 | an event, and then calls a user-defined function associated with this event.
60 | A single parameter is needed, the connection identifier
61 | .I mlx_ptr
62 | (see the
63 | .B mlx manual).
64 |
65 | You can assign different functions to the three following events:
66 | .br
67 | - A key is pressed
68 | .br
69 | - The mouse button is pressed
70 | .br
71 | - A part of the window should be re-drawn
72 | (this is called an "expose" event, and it is your program's job to handle it).
73 | .br
74 |
75 | Each window can define a different function for the same event.
76 |
77 | The three functions
78 | .B mlx_key_hook
79 | (),
80 | .B mlx_mouse_hook
81 | () and
82 | .B mlx_expose_hook
83 | () work exactly the same way.
84 | .I funct_ptr
85 | is a pointer to the function you want to be called
86 | when an event occurs. This assignment is specific to the window defined by the
87 | .I win_ptr
88 | identifier. The
89 | .I param
90 | adress will be passed to the function everytime it is called, and should be
91 | used to store the parameters it might need.
92 |
93 | The syntax for the
94 | .B mlx_loop_hook
95 | () function is identical to the previous ones, but the given function will be
96 | called when no event occurs.
97 |
98 | When it catches an event, the MiniLibX calls the corresponding function
99 | with fixed parameters:
100 | .nf
101 |
102 | expose_hook(void *param);
103 | key_hook(int keycode,void *param);
104 | mouse_hook(int button,int x,int y,void *param);
105 | loop_hook(void *param);
106 |
107 | .fi
108 | These function names are arbitrary. They here are used to distinguish
109 | parameters according to the event. These functions are NOT part of the
110 | MiniLibX.
111 |
112 | .I param
113 | is the address specified in the mlx_*_hook calls. This address is never
114 | used nor modified by the MiniLibX. On key and mouse events, additional
115 | information is passed:
116 | .I keycode
117 | tells you which key is pressed (look for the X11 include file "keysymdef.h"),
118 | (
119 | .I x
120 | ,
121 | .I y
122 | ) are the coordinates of the mouse click in the window, and
123 | .I button
124 | tells you which mouse button was pressed.
125 |
126 | .SH GOING FURTHER WITH EVENTS
127 | The MiniLibX provides a much generic access to all X-Window events. The
128 | .I mlx.h
129 | include define
130 | .B mlx_hook()
131 | in the same manner mlx_*_hook functions work. The event and mask values
132 | will be taken from the X11 include file "X.h".
133 |
134 | See source code of mlx_int_param_event.c to find out how the MiniLibX will
135 | call your own function for a specific event.
136 |
137 | .SH SEE ALSO
138 | mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3)
139 |
140 | .SH AUTHOR
141 | Copyright ol@ - 2002-2014 - Olivier Crouzet
142 |
--------------------------------------------------------------------------------
/man/man3/mlx_new_image.3:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Manipulating images
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I void *
8 | .fi
9 | .B mlx_new_image
10 | (
11 | .I void *mlx_ptr, int width, int height
12 | );
13 |
14 | .nf
15 | .I char *
16 | .fi
17 | .B mlx_get_data_addr
18 | (
19 | .I void *img_ptr, int *bits_per_pixel, int *size_line, int *endian
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_put_image_to_window
26 | (
27 | .I void *mlx_ptr, void *win_ptr, void *img_ptr, int x, int y
28 | );
29 |
30 | .nf
31 | .I unsigned int
32 | .fi
33 | .B mlx_get_color_value
34 | (
35 | .I void *mlx_ptr, int color
36 | );
37 |
38 | .nf
39 | .I void *
40 | .fi
41 | .B mlx_xpm_to_image
42 | (
43 | .I void *mlx_ptr, char **xpm_data, int *width, int *height
44 | );
45 |
46 | .nf
47 | .I void *
48 | .fi
49 | .B mlx_xpm_file_to_image
50 | (
51 | .I void *mlx_ptr, char *filename, int *width, int *height
52 | );
53 |
54 | .nf
55 | .I int
56 | .fi
57 | .B mlx_destroy_image
58 | (
59 | .I void *mlx_ptr, void *img_ptr
60 | );
61 |
62 |
63 | .SH DESCRIPTION
64 |
65 | .B mlx_new_image
66 | () creates a new image in memory. It returns a
67 | .I void *
68 | identifier needed to manipulate this image later. It only needs
69 | the size of the image to be created, using the
70 | .I width
71 | and
72 | .I height
73 | parameters, and the
74 | .I mlx_ptr
75 | connection identifier (see the
76 | .B mlx
77 | manual).
78 |
79 | The user can draw inside the image (see below), and
80 | can dump the image inside a specified window at any time to
81 | display it on the screen. This is done using
82 | .B mlx_put_image_to_window
83 | (). Three identifiers are needed here, for the connection to the
84 | display, the window to use, and the image (respectively
85 | .I mlx_ptr
86 | ,
87 | .I win_ptr
88 | and
89 | .I img_ptr
90 | ). The (
91 | .I x
92 | ,
93 | .I y
94 | ) coordinates define where the image should be placed in the window.
95 |
96 | .B mlx_get_data_addr
97 | () returns information about the created image, allowing a user
98 | to modify it later. The
99 | .I img_ptr
100 | parameter specifies the image to use. The three next parameters should
101 | be the addresses of three different valid integers.
102 | .I bits_per_pixel
103 | will be filled with the number of bits needed to represent a pixel color
104 | (also called the depth of the image).
105 | .I size_line
106 | is the number of bytes used to store one line of the image in memory.
107 | This information is needed to move from one line to another in the image.
108 | .I endian
109 | tells you wether the pixel color in the image needs to be stored in
110 | little endian (
111 | .I endian
112 | == 0), or big endian (
113 | .I endian
114 | == 1).
115 |
116 | .B mlx_get_data_addr
117 | returns a
118 | .I char *
119 | address that represents the begining of the memory area where the image
120 | is stored. From this adress, the first
121 | .I bits_per_pixel
122 | bits represent the color of the first pixel in the first line of
123 | the image. The second group of
124 | .I bits_per_pixel
125 | bits represent the second pixel of the first line, and so on.
126 | Add
127 | .I size_line
128 | to the adress to get the begining of the second line. You can reach any
129 | pixels of the image that way.
130 |
131 | .B mlx_destroy_image
132 | destroys the given image (
133 | .I img_ptr
134 | ).
135 |
136 | .SH STORING COLOR INSIDE IMAGES
137 |
138 | Depending on the display, the number of bits used to store a pixel color
139 | can change. The user usually represents a color in RGB mode, using
140 | one byte for each component (see
141 | .B mlx_pixel_put
142 | manual). This must be translated to fit the
143 | .I bits_per_pixel
144 | requirement of the image, and make the color understandable to the X-Server.
145 | That is the purpose of the
146 | .B mlx_get_color_value
147 | () function. It takes a standard RGB
148 | .I color
149 | parameter, and returns an
150 | .I unsigned int
151 | value.
152 | The
153 | .I bits_per_pixel
154 | least significant bits of this value can be stored in the image.
155 |
156 | Keep in mind that the least significant bits position depends on the local
157 | computer's endian. If the endian of the image (in fact the endian of
158 | the X-Server's computer) differs from the local endian, then the value should
159 | be transformed before being used.
160 |
161 | .SH XPM IMAGES
162 |
163 | The
164 | .B mlx_xpm_to_image
165 | () and
166 | .B mlx_xpm_file_to_image
167 | () functions will create a new image the same way.
168 | They will fill it using the specified
169 | .I xpm_data
170 | or
171 | .I filename
172 | , depending on which function is used.
173 | Note that MiniLibX does not use the standard
174 | Xpm library to deal with xpm images. You may not be able to
175 | read all types of xpm images. It however handles transparency.
176 |
177 | .SH RETURN VALUES
178 | The three functions that create images,
179 | .B mlx_new_image()
180 | ,
181 | .B mlx_xpm_to_image()
182 | and
183 | .B mlx_xpm_file_to_image()
184 | , will return NULL if an error occurs. Otherwise they return a non-null pointer
185 | as an image identifier.
186 |
187 |
188 | .SH SEE ALSO
189 | mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_loop(3)
190 |
191 | .SH AUTHOR
192 | Copyright ol@ - 2002-2014 - Olivier Crouzet
193 |
--------------------------------------------------------------------------------
/man/man3/mlx_new_window.3:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Managing windows
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I void *
8 | .fi
9 | .B mlx_new_window
10 | (
11 | .I void *mlx_ptr, int size_x, int size_y, char *title
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_clear_window
18 | (
19 | .I void *mlx_ptr, void *win_ptr
20 | );
21 |
22 | .nf
23 | .I int
24 | .fi
25 | .B mlx_destroy_window
26 | (
27 | .I void *mlx_ptr, void *win_ptr
28 | );
29 |
30 |
31 | .SH DESCRIPTION
32 | The
33 | .B mlx_new_window
34 | () function creates a new window on the screen, using the
35 | .I size_x
36 | and
37 | .I size_y
38 | parameters to determine its size, and
39 | .I title
40 | as the text that should be displayed in the window's title bar.
41 | The
42 | .I mlx_ptr
43 | parameter is the connection identifier returned by
44 | .B mlx_init
45 | () (see the
46 | .B mlx
47 | man page).
48 | .B mlx_new_window
49 | () returns a
50 | .I void *
51 | window identifier that can be used by other MiniLibX calls.
52 | Note that the MiniLibX
53 | can handle an arbitrary number of separate windows.
54 |
55 | .B mlx_clear_window
56 | () and
57 | .B mlx_destroy_window
58 | () respectively clear (in black) and destroy the given window. They both have
59 | the same parameters:
60 | .I mlx_ptr
61 | is the screen connection identifier, and
62 | .I win_ptr
63 | is a window identifier.
64 |
65 | .SH RETURN VALUES
66 | If
67 | .B mlx_new_window()
68 | fails to create a new window (for wathever reason), it will return NULL,
69 | otherwise a non-null pointer is returned as a window identifier.
70 | .B mlx_clear_window
71 | and
72 | .B mlx_destroy_window
73 | right now return nothing.
74 |
75 | .SH SEE ALSO
76 | mlx(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
77 |
78 | .SH AUTHOR
79 | Copyright ol@ - 2002-2014 - Olivier Crouzet
80 |
--------------------------------------------------------------------------------
/man/man3/mlx_pixel_put.3:
--------------------------------------------------------------------------------
1 | .TH MiniLibX 3 "September 19, 2002"
2 | .SH NAME
3 | MiniLibX - Drawing inside windows
4 | .SH SYNOPSYS
5 |
6 | .nf
7 | .I int
8 | .fi
9 | .B mlx_pixel_put
10 | (
11 | .I void *mlx_ptr, void *win_ptr, int x, int y, int color
12 | );
13 |
14 | .nf
15 | .I int
16 | .fi
17 | .B mlx_string_put
18 | (
19 | .I void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string
20 | );
21 |
22 |
23 | .SH DESCRIPTION
24 | The
25 | .B mlx_pixel_put
26 | () function draws a defined pixel in the window
27 | .I win_ptr
28 | using the (
29 | .I x
30 | ,
31 | .I y
32 | ) coordinates, and the specified
33 | .I color
34 | \&. The origin (0,0) is the upper left corner of the window, the x and y axis
35 | respectively pointing right and down. The connection
36 | identifier,
37 | .I mlx_ptr
38 | , is needed (see the
39 | .B mlx
40 | man page).
41 |
42 | Parameters for
43 | .B mlx_string_put
44 | () have the same meaning. Instead of a simple pixel, the specified
45 | .I string
46 | will be displayed at (
47 | .I x
48 | ,
49 | .I y
50 | ).
51 |
52 | In both functions, it is impossible to display anything outside the
53 | specified window, nor display in another window in front of the selected one.
54 |
55 | .SH COLOR MANAGEMENT
56 | The
57 | .I color
58 | parameter has an integer type. The displayed color needs to be encoded
59 | in this integer, following a defined scheme. All displayable colors
60 | can be split in 3 basic colors: red, green and blue. Three associated
61 | values, in the 0-255 range, represent how much of each color is mixed up
62 | to create the original color. Theses three values must be set inside the
63 | integer to display the right color. The three least significant bytes of
64 | this integer are filled as shown in the picture below:
65 |
66 | .nf
67 | | 0 | R | G | B | color integer
68 | +---+---+---+---+
69 | .fi
70 |
71 |
72 | While filling the integer, make sure you avoid endian problems. Remember
73 | that the "blue" byte should always be the least significant one.
74 |
75 |
76 | .SH SEE ALSO
77 | mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3)
78 |
79 |
80 | .SH AUTHOR
81 | Copyright ol@ - 2002-2014 - Olivier Crouzet
82 |
--------------------------------------------------------------------------------
/mlx.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx.h for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 16:37:50 2000 Charlie Root
8 | ** Last update Tue May 15 16:23:28 2007 Olivier Crouzet
9 | */
10 |
11 | /*
12 | ** MinilibX - Please report bugs
13 | */
14 |
15 |
16 | /*
17 | ** FR msg - FR msg - FR msg
18 | **
19 | ** La MinilibX utilise 2 librairies supplementaires qu'il
20 | ** est necessaire de rajouter a la compilation :
21 | ** -lmlx -lXext -lX11
22 | **
23 | ** La MinilibX permet le chargement des images de type Xpm.
24 | ** Notez que cette implementation est incomplete.
25 | ** Merci de communiquer tout probleme de chargement d'image
26 | ** de ce type.
27 | */
28 |
29 |
30 | #ifndef MLX_H
31 |
32 | #define MLX_H
33 |
34 |
35 | void *mlx_init();
36 | /*
37 | ** needed before everything else.
38 | ** return (void *)0 if failed
39 | */
40 |
41 |
42 | /*
43 | ** Basic actions
44 | */
45 |
46 | void *mlx_new_window(void *mlx_ptr, int size_x, int size_y, char *title);
47 | /*
48 | ** return void *0 if failed
49 | */
50 | int mlx_clear_window(void *mlx_ptr, void *win_ptr);
51 | int mlx_pixel_put(void *mlx_ptr, void *win_ptr, int x, int y, int color);
52 | /*
53 | ** origin for x & y is top left corner of the window
54 | ** y down is positive
55 | ** color is 0x00RRGGBB
56 | */
57 |
58 |
59 | /*
60 | ** Image stuff
61 | */
62 |
63 | void *mlx_new_image(void *mlx_ptr,int width,int height);
64 | /*
65 | ** return void *0 if failed
66 | ** obsolete : image2 data is stored using bit planes
67 | ** void *mlx_new_image2(void *mlx_ptr,int width,int height);
68 | */
69 | char *mlx_get_data_addr(void *img_ptr, int *bits_per_pixel,
70 | int *size_line, int *endian);
71 | /*
72 | ** endian : 0 = sever X is little endian, 1 = big endian
73 | ** for mlx_new_image2, 2nd arg of mlx_get_data_addr is number_of_planes
74 | */
75 | int mlx_put_image_to_window(void *mlx_ptr, void *win_ptr, void *img_ptr,
76 | int x, int y);
77 | int mlx_get_color_value(void *mlx_ptr, int color);
78 |
79 |
80 | /*
81 | ** dealing with Events
82 | */
83 |
84 | int mlx_mouse_hook (void *win_ptr, int (*funct_ptr)(), void *param);
85 | int mlx_key_hook (void *win_ptr, int (*funct_ptr)(), void *param);
86 | int mlx_expose_hook (void *win_ptr, int (*funct_ptr)(), void *param);
87 |
88 | int mlx_loop_hook (void *mlx_ptr, int (*funct_ptr)(), void *param);
89 | int mlx_loop (void *mlx_ptr);
90 | int mlx_loop_end (void *mlx_ptr);
91 |
92 | /*
93 | ** hook funct are called as follow :
94 | **
95 | ** expose_hook(void *param);
96 | ** key_hook(int keycode, void *param);
97 | ** mouse_hook(int button, int x,int y, void *param);
98 | ** loop_hook(void *param);
99 | **
100 | */
101 |
102 |
103 | /*
104 | ** Usually asked...
105 | */
106 |
107 | int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color,
108 | char *string);
109 | void mlx_set_font(void *mlx_ptr, void *win_ptr, char *name);
110 | void *mlx_xpm_to_image(void *mlx_ptr, char **xpm_data,
111 | int *width, int *height);
112 | void *mlx_xpm_file_to_image(void *mlx_ptr, char *filename,
113 | int *width, int *height);
114 | int mlx_destroy_window(void *mlx_ptr, void *win_ptr);
115 |
116 | int mlx_destroy_image(void *mlx_ptr, void *img_ptr);
117 |
118 | int mlx_destroy_display(void *mlx_ptr);
119 |
120 | /*
121 | ** generic hook system for all events, and minilibX functions that
122 | ** can be hooked. Some macro and defines from X11/X.h are needed here.
123 | */
124 |
125 | int mlx_hook(void *win_ptr, int x_event, int x_mask,
126 | int (*funct)(), void *param);
127 |
128 | int mlx_do_key_autorepeatoff(void *mlx_ptr);
129 | int mlx_do_key_autorepeaton(void *mlx_ptr);
130 | int mlx_do_sync(void *mlx_ptr);
131 |
132 | int mlx_mouse_get_pos(void *mlx_ptr, void *win_ptr, int *x, int *y);
133 | int mlx_mouse_move(void *mlx_ptr, void *win_ptr, int x, int y);
134 | int mlx_mouse_hide(void *mlx_ptr, void *win_ptr);
135 | int mlx_mouse_show(void *mlx_ptr, void *win_ptr);
136 |
137 | int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey);
138 |
139 | #endif /* MLX_H */
140 |
--------------------------------------------------------------------------------
/mlx_clear_window.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_clear_window.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Sep 7 19:46:15 2000 Charlie Root
8 | ** Last update Tue Sep 25 17:11:19 2001 Charlie Root
9 | */
10 |
11 |
12 |
13 | #include "mlx_int.h"
14 |
15 |
16 | int mlx_clear_window(t_xvar *xvar,t_win_list *win)
17 | {
18 | XClearWindow(xvar->display,win->window);
19 | if (xvar->do_flush)
20 | XFlush(xvar->display);
21 | }
22 |
--------------------------------------------------------------------------------
/mlx_destroy_display.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* mlx_destroy_display.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: mg +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2020/10/03 18:56:35 by mg #+# #+# */
9 | /* Updated: 2020/10/04 01:55:35 by mg ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include "mlx_int.h"
14 |
15 | int mlx_destroy_display(t_xvar *xvar)
16 | {
17 | XCloseDisplay(xvar->display);
18 | }
19 |
--------------------------------------------------------------------------------
/mlx_destroy_image.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_destroy_image.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Mar 12 10:25:15 2002 Charlie Root
8 | ** Last update Tue May 15 16:45:54 2007 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 | int mlx_destroy_image(t_xvar *xvar, t_img *img)
16 | {
17 | if (img->type == MLX_TYPE_SHM_PIXMAP ||
18 | img->type == MLX_TYPE_SHM)
19 | {
20 | XShmDetach(xvar->display, &(img->shm));
21 | shmdt(img->shm.shmaddr);
22 | /* shmctl IPC_RMID already done */
23 | }
24 | XDestroyImage(img->image); /* For image & shm-image. Also free img->data */
25 | XFreePixmap(xvar->display, img->pix);
26 | if (img->gc)
27 | XFreeGC(xvar->display, img->gc);
28 | free(img);
29 | if (xvar->do_flush)
30 | XFlush(xvar->display);
31 | }
32 |
--------------------------------------------------------------------------------
/mlx_destroy_window.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_destroy_window.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Mar 12 10:25:15 2002 Charlie Root
8 | ** Last update Tue May 15 16:46:08 2007 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 | int mlx_destroy_window(t_xvar *xvar,t_win_list *win)
16 | {
17 | t_win_list *w;
18 | t_win_list *prev;
19 | t_win_list first;
20 |
21 | first.next = xvar->win_list;
22 | prev = &first;
23 | w = prev->next;
24 | while (w)
25 | {
26 | if (w==win)
27 | prev->next = w->next;
28 | else
29 | prev = w;
30 | w = w->next;
31 | }
32 | xvar->win_list = first.next;
33 | XDestroyWindow(xvar->display,win->window);
34 | XFreeGC(xvar->display,win->gc);
35 | free(win);
36 | if (xvar->do_flush)
37 | XFlush(xvar->display);
38 | }
39 |
--------------------------------------------------------------------------------
/mlx_expose_hook.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_expose_hook.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:07:42 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_expose_hook(t_win_list *win,int (*funct)(),void *param)
18 | {
19 | win->hooks[Expose].hook = funct;
20 | win->hooks[Expose].param = param;
21 | win->hooks[Expose].mask = ExposureMask;
22 | }
23 |
--------------------------------------------------------------------------------
/mlx_ext_randr.c:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #include "mlx_int.h"
5 |
6 | #include
7 | #include
8 |
9 | /* global for independant extension */
10 |
11 | RRMode saved_mode = 0;
12 |
13 |
14 | int mlx_ext_fullscreen(t_xvar *xvar, t_win_list *win, int fullscreen)
15 | {
16 | XWindowAttributes watt;
17 | int i;
18 | int j;
19 | XRRScreenResources *res;
20 | XRROutputInfo *o_info;
21 | XRRCrtcInfo *crtc;
22 | RRMode mode_candidate;
23 | int idx_output;
24 | int idx_candidate;
25 |
26 | if (!XGetWindowAttributes(xvar->display, win->window, &watt))
27 | return (0);
28 |
29 | res = XRRGetScreenResources(xvar->display, xvar->root);
30 | o_info = NULL;
31 | idx_output = -1;
32 | i = res->noutput;
33 | while (i--)
34 | {
35 | o_info = XRRGetOutputInfo(xvar->display, res, res->outputs[i]);
36 | if (o_info->connection == RR_Connected)
37 | {
38 | idx_output = i;
39 | i = 0;
40 | }
41 | else
42 | XRRFreeOutputInfo(o_info);
43 | }
44 | if (!o_info)
45 | {
46 | XRRFreeScreenResources(res);
47 | return (0);
48 | }
49 |
50 | idx_candidate = -1;
51 | i = o_info->nmode;
52 | while (i--)
53 | {
54 | j = res->nmode;
55 | while (j--)
56 | if (res->modes[j].id == o_info->modes[i])
57 | if (res->modes[j].width >= watt.width && res->modes[j].height >= watt.height &&
58 | (idx_candidate == -1 || res->modes[idx_candidate].width > res->modes[j].width ||
59 | res->modes[idx_candidate].height > res->modes[j].height) )
60 | idx_candidate = i;
61 | }
62 | if (idx_candidate < 0)
63 | {
64 | XRRFreeOutputInfo(o_info);
65 | XRRFreeScreenResources(res);
66 | return (0);
67 | }
68 | if (!fullscreen && saved_mode == -1)
69 | idx_candidate = 0; /* if no clue, uses first mode, usually part of npreferred */
70 | mode_candidate = o_info->modes[idx_candidate];
71 | if (!fullscreen)
72 | mode_candidate = saved_mode;
73 |
74 | crtc = XRRGetCrtcInfo(xvar->display, res, o_info->crtc);
75 | saved_mode = crtc->mode;
76 |
77 | i = XRRSetCrtcConfig(xvar->display, res, o_info->crtc, CurrentTime, 0, 0, mode_candidate,
78 | crtc->rotation, &res->outputs[idx_output], 1);
79 | if (fullscreen)
80 | printf("found mode : %d x %d\n Status %d\n", res->modes[idx_candidate].width, res->modes[idx_candidate].height, i);
81 | else
82 | printf("back previous mode\n");
83 |
84 | XMoveWindow(xvar->display, win->window, 0, 0);
85 | XMapRaised(xvar->display, win->window);
86 |
87 | if (fullscreen)
88 | {
89 | // XGrabPointer(xvar->display, win->window, True, 0, GrabModeAsync, GrabModeAsync, win->window, 0L, CurrentTime);
90 | XGrabKeyboard(xvar->display, win->window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
91 | }
92 | else
93 | {
94 | XUngrabPointer(xvar->display, CurrentTime);
95 | XUngrabKeyboard(xvar->display, CurrentTime);
96 | }
97 |
98 | XSync(xvar->display, False);
99 | sleep(1);
100 |
101 | XRRFreeCrtcInfo(crtc);
102 | XRRFreeOutputInfo(o_info);
103 | XRRFreeScreenResources(res);
104 | }
105 |
--------------------------------------------------------------------------------
/mlx_flush_event.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_flush_event.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Wed Aug 2 18:58:11 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:08:48 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_flush_event(t_xvar *xvar)
18 | {
19 | XEvent ev;
20 |
21 | while (XPending(xvar->display))
22 | {
23 | XNextEvent(xvar->display,&ev);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/mlx_get_color_value.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_get_color_value.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 19:01:33 2000 Charlie Root
8 | ** Last update Thu Oct 4 15:04:13 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 | int mlx_get_color_value(t_xvar *xvar,int color)
16 | {
17 | return(mlx_int_get_good_color(xvar,color));
18 | }
19 |
20 | int mlx_int_get_good_color(t_xvar *xvar,int color)
21 | {
22 | XColor xc;
23 |
24 | if (xvar->depth>=24)
25 | return (color);
26 | xc.red = (color>>8)&0xFF00;
27 | xc.green = color&0xFF00;
28 | xc.blue = (color<<8)&0xFF00;
29 | xc.pixel = ((xc.red>>(16-xvar->decrgb[1]))<decrgb[0])+
30 | ((xc.green>>(16-xvar->decrgb[3]))<decrgb[2])+
31 | ((xc.blue>>(16-xvar->decrgb[5]))<decrgb[4]);
32 | return (xc.pixel);
33 | }
34 |
--------------------------------------------------------------------------------
/mlx_get_data_addr.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_get_data_addr.c for MiniLibX in raytraceur
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Aug 14 15:45:57 2000 Charlie Root
8 | ** Last update Thu Sep 27 19:05:25 2001 Charlie Root
9 | */
10 |
11 |
12 |
13 | #include "mlx_int.h"
14 |
15 |
16 | char *mlx_get_data_addr(t_img *img,int *bits_per_pixel,
17 | int *size_line,int *endian)
18 | {
19 | *bits_per_pixel = img->bpp;
20 | *size_line = img->size_line;
21 | *endian = img->image->byte_order;
22 | return (img->data);
23 | }
24 |
--------------------------------------------------------------------------------
/mlx_hook.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_hook.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Jan 28 17:05:28 2005 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_hook(t_win_list *win, int x_event, int x_mask,
18 | int (*funct)(),void *param)
19 | {
20 | win->hooks[x_event].hook = funct;
21 | win->hooks[x_event].param = param;
22 | win->hooks[x_event].mask = x_mask;
23 | }
24 |
25 |
26 | int mlx_do_key_autorepeatoff(t_xvar *xvar)
27 | {
28 | XAutoRepeatOff(xvar->display);
29 | }
30 |
31 | int mlx_do_key_autorepeaton(t_xvar *xvar)
32 | {
33 | XAutoRepeatOn(xvar->display);
34 | }
35 |
36 |
37 | int mlx_do_sync(t_xvar *xvar)
38 | {
39 | XSync(xvar->display, False);
40 | }
41 |
--------------------------------------------------------------------------------
/mlx_init.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_init.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 16:52:42 2000 Charlie Root
8 | ** Last update Fri Jan 28 17:05:09 2005 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 | void *mlx_init()
17 | {
18 | t_xvar *xvar;
19 |
20 | if (!(xvar = malloc(sizeof(*xvar))))
21 | return ((void*)0);
22 | if ((xvar->display = XOpenDisplay("")) == 0)
23 | {
24 | free(xvar);
25 | return ((void*)0);
26 | }
27 | xvar->screen = DefaultScreen(xvar->display);
28 | xvar->root = DefaultRootWindow(xvar->display);
29 | xvar->cmap = DefaultColormap(xvar->display,xvar->screen);
30 | xvar->depth = DefaultDepth(xvar->display,xvar->screen);
31 | if (mlx_int_get_visual(xvar)==-1)
32 | {
33 | printf(ERR_NO_TRUECOLOR);
34 | exit(1);
35 | }
36 | xvar->win_list = 0;
37 | xvar->loop_hook = 0;
38 | xvar->loop_param = (void *)0;
39 | xvar->do_flush = 1;
40 | xvar->wm_delete_window = XInternAtom (xvar->display, "WM_DELETE_WINDOW", False);
41 | xvar->wm_protocols = XInternAtom (xvar->display, "WM_PROTOCOLS", False);
42 | mlx_int_deal_shm(xvar);
43 | if (xvar->private_cmap)
44 | xvar->cmap = XCreateColormap(xvar->display,xvar->root,
45 | xvar->visual,AllocNone);
46 | mlx_int_rgb_conversion(xvar);
47 | xvar->end_loop = 0;
48 | return (xvar);
49 | }
50 |
51 |
52 | /*
53 | ** pshm_format of -1 : Not XYBitmap|XYPixmap|ZPixmap
54 | ** alpha libX need a check of the DISPLAY env var, or shm is allowed
55 | ** in remote Xserver connections.
56 | */
57 |
58 | int mlx_int_deal_shm(t_xvar *xvar)
59 | {
60 | int use_pshm;
61 | int bidon;
62 | char *dpy;
63 | char buff[33];
64 |
65 | xvar->use_xshm = XShmQueryVersion(xvar->display,&bidon,&bidon,&(use_pshm));
66 | if (xvar->use_xshm && use_pshm)
67 | xvar->pshm_format = XShmPixmapFormat(xvar->display);
68 | else
69 | xvar->pshm_format = -1;
70 | gethostname(buff,32);
71 | dpy = getenv(ENV_DISPLAY);
72 | if (dpy && strlen(dpy) && *dpy!=':' && strncmp(dpy,buff,strlen(buff)) &&
73 | strncmp(dpy,LOCALHOST,strlen(LOCALHOST)) )
74 | {
75 | xvar->pshm_format = -1;
76 | xvar->use_xshm = 0;
77 | }
78 | }
79 |
80 | /*
81 | ** TrueColor Visual is needed to have *_mask correctly set
82 | */
83 |
84 | int mlx_int_rgb_conversion(t_xvar *xvar)
85 | {
86 | bzero(xvar->decrgb,sizeof(int)*6);
87 | while (!(xvar->visual->red_mask&1))
88 | { xvar->visual->red_mask >>= 1; xvar->decrgb[0] ++; }
89 | while (xvar->visual->red_mask&1)
90 | { xvar->visual->red_mask >>= 1; xvar->decrgb[1] ++; }
91 | while (!(xvar->visual->green_mask&1))
92 | { xvar->visual->green_mask >>= 1; xvar->decrgb[2] ++; }
93 | while (xvar->visual->green_mask&1)
94 | { xvar->visual->green_mask >>= 1; xvar->decrgb[3] ++; }
95 | while (!(xvar->visual->blue_mask&1))
96 | { xvar->visual->blue_mask >>= 1; xvar->decrgb[4] ++; }
97 | while (xvar->visual->blue_mask&1)
98 | { xvar->visual->blue_mask >>= 1; xvar->decrgb[5] ++; }
99 | }
100 |
--------------------------------------------------------------------------------
/mlx_int.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int.h for mlx in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 16:45:48 2000 Charlie Root
8 | ** Last update Wed May 25 16:44:16 2011 Olivier Crouzet
9 | */
10 |
11 |
12 |
13 | /*
14 | ** Internal settings for MiniLibX
15 | */
16 |
17 | #ifndef MLX_INT_H
18 |
19 | # define MLX_INT_H
20 |
21 | # include
22 | # include
23 | # include
24 | # include
25 | # include
26 | # include
27 | # include
28 | # include
29 | # include
30 | # include
31 | # include
32 | # include
33 | /* #include */
34 |
35 |
36 | # define MLX_TYPE_SHM_PIXMAP 3
37 | # define MLX_TYPE_SHM 2
38 | # define MLX_TYPE_XIMAGE 1
39 |
40 | # define MLX_MAX_EVENT LASTEvent
41 |
42 |
43 | # define ENV_DISPLAY "DISPLAY"
44 | # define LOCALHOST "localhost"
45 | # define ERR_NO_TRUECOLOR "MinilibX Error : No TrueColor Visual available.\n"
46 | # define WARN_SHM_ATTACH "MinilibX Warning : X server can't attach shared memory.\n"
47 |
48 |
49 | typedef struct s_xpm_col
50 | {
51 | int name;
52 | int col;
53 | } t_xpm_col;
54 |
55 |
56 | struct s_col_name
57 | {
58 | char *name;
59 | int color;
60 | };
61 |
62 | typedef struct s_event_list
63 | {
64 | int mask;
65 | int (*hook)();
66 | void *param;
67 | } t_event_list;
68 |
69 |
70 | typedef struct s_win_list
71 | {
72 | Window window;
73 | GC gc;
74 | struct s_win_list *next;
75 | int (*mouse_hook)();
76 | int (*key_hook)();
77 | int (*expose_hook)();
78 | void *mouse_param;
79 | void *key_param;
80 | void *expose_param;
81 | t_event_list hooks[MLX_MAX_EVENT];
82 | } t_win_list;
83 |
84 |
85 | typedef struct s_img
86 | {
87 | XImage *image;
88 | Pixmap pix;
89 | GC gc;
90 | int size_line;
91 | int bpp;
92 | int width;
93 | int height;
94 | int type;
95 | int format;
96 | char *data;
97 | XShmSegmentInfo shm;
98 | } t_img;
99 |
100 | typedef struct s_xvar
101 | {
102 | Display *display;
103 | Window root;
104 | int screen;
105 | int depth;
106 | Visual *visual;
107 | Colormap cmap;
108 | int private_cmap;
109 | t_win_list *win_list;
110 | int (*loop_hook)();
111 | void *loop_param;
112 | int use_xshm;
113 | int pshm_format;
114 | int do_flush;
115 | int decrgb[6];
116 | Atom wm_delete_window;
117 | Atom wm_protocols;
118 | int end_loop;
119 | } t_xvar;
120 |
121 |
122 | int mlx_int_do_nothing();
123 | int mlx_get_color_value();
124 | int mlx_int_get_good_color();
125 | int mlx_int_find_in_pcm();
126 | int mlx_int_anti_resize_win();
127 | int mlx_int_wait_first_expose();
128 | int mlx_int_rgb_conversion();
129 | int mlx_int_deal_shm();
130 | void *mlx_int_new_xshm_image();
131 | char **mlx_int_str_to_wordtab();
132 | void *mlx_new_image();
133 | int shm_att_pb();
134 | int mlx_int_get_visual(t_xvar *xvar);
135 | int mlx_int_set_win_event_mask(t_xvar *xvar);
136 | int mlx_int_str_str_cote(char *str,char *find,int len);
137 | int mlx_int_str_str(char *str,char *find,int len);
138 |
139 |
140 | #endif
141 |
--------------------------------------------------------------------------------
/mlx_int_anti_resize_win.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_anti_resize_win.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Aug 8 14:31:05 2000 Charlie Root
8 | ** Last update Tue Sep 25 15:56:58 2001 Charlie Root
9 | */
10 |
11 | #include "mlx_int.h"
12 |
13 |
14 | int mlx_int_anti_resize_win(t_xvar *xvar,Window win,int w,int h)
15 | {
16 | XSizeHints hints;
17 | long toto;
18 |
19 | XGetWMNormalHints(xvar->display,win,&hints,&toto);
20 | hints.width = w;
21 | hints.height = h;
22 | hints.min_width = w;
23 | hints.min_height = h;
24 | hints.max_width = w;
25 | hints.max_height = h;
26 | hints.flags = PPosition | PSize | PMinSize | PMaxSize;
27 | XSetWMNormalHints(xvar->display,win,&hints);
28 | }
29 |
--------------------------------------------------------------------------------
/mlx_int_do_nothing.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_do_nothing.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Aug 8 12:58:24 2000 Charlie Root
8 | ** Last update Tue Sep 25 15:56:22 2001 Charlie Root
9 | */
10 |
11 |
12 |
13 | int mlx_int_do_nothing(void *param)
14 | {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/mlx_int_get_visual.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_get_visual.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Wed Oct 3 17:01:51 2001 Charlie Root
8 | ** Last update Thu Oct 4 15:00:45 2001 Charlie Root
9 | */
10 |
11 |
12 |
13 | #include "mlx_int.h"
14 |
15 |
16 | /*
17 | ** We need a private colormap for non-default Visual.
18 | */
19 |
20 |
21 | int mlx_int_get_visual(t_xvar *xvar)
22 | {
23 | XVisualInfo *vi;
24 | XVisualInfo template;
25 | int nb_item;
26 |
27 | xvar->private_cmap = 0;
28 | xvar->visual = DefaultVisual(xvar->display,xvar->screen);
29 | if (xvar->visual->class == TrueColor)
30 | return (0);
31 | template.class = TrueColor;
32 | template.depth = xvar->depth;
33 | if (!(vi = XGetVisualInfo(xvar->display,VisualDepthMask|VisualClassMask,
34 | &template,&nb_item)) )
35 | return (-1);
36 | xvar->visual = vi->visual;
37 | xvar->private_cmap = 1;
38 | return (0);
39 | }
40 |
--------------------------------------------------------------------------------
/mlx_int_param_event.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_param_event.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 16:37:50 2000 Charlie Root
8 | ** Last update Wed Oct 6 13:14:52 2004 Olivier Crouzet
9 | */
10 |
11 | #include "mlx_int.h"
12 |
13 | int mlx_int_param_undef()
14 | {
15 | }
16 |
17 | int mlx_int_param_KeyPress(t_xvar *xvar, XEvent *ev, t_win_list *win)
18 | {
19 | win->hooks[KeyPress].hook(XkbKeycodeToKeysym(xvar->display,
20 | ev->xkey.keycode, 0, 0),
21 | win->hooks[KeyPress].param);
22 | }
23 |
24 | int mlx_int_param_KeyRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)
25 | {
26 | win->hooks[KeyRelease].hook(XkbKeycodeToKeysym(xvar->display,
27 | ev->xkey.keycode, 0, 0),
28 | win->hooks[KeyRelease].param);
29 | }
30 |
31 | int mlx_int_param_ButtonPress(t_xvar *xvar, XEvent *ev, t_win_list *win)
32 | {
33 | win->hooks[ButtonPress].hook(ev->xbutton.button,ev->xbutton.x,ev->xbutton.y,
34 | win->hooks[ButtonPress].param);
35 | }
36 |
37 | int mlx_int_param_ButtonRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)
38 | {
39 | win->hooks[ButtonRelease].hook(ev->xbutton.button,
40 | ev->xbutton.x, ev->xbutton.y,
41 | win->hooks[ButtonRelease].param);
42 | }
43 |
44 | int mlx_int_param_MotionNotify(t_xvar *xvar, XEvent *ev, t_win_list *win)
45 | {
46 | win->hooks[MotionNotify].hook(ev->xbutton.x,ev->xbutton.y,
47 | win->hooks[MotionNotify].param);
48 | }
49 |
50 | int mlx_int_param_Expose(t_xvar *xvar, XEvent *ev, t_win_list *win)
51 | {
52 | if (!ev->xexpose.count)
53 | win->hooks[Expose].hook(win->hooks[Expose].param);
54 | }
55 |
56 |
57 | int mlx_int_param_generic(t_xvar *xvar, XEvent *ev, t_win_list *win)
58 | {
59 | win->hooks[ev->type].hook(win->hooks[ev->type].param);
60 | }
61 |
62 | int (*(mlx_int_param_event[]))() =
63 | {
64 | mlx_int_param_undef, /* 0 */
65 | mlx_int_param_undef,
66 | mlx_int_param_KeyPress,
67 | mlx_int_param_KeyRelease, /* 3 */
68 | mlx_int_param_ButtonPress,
69 | mlx_int_param_ButtonRelease,
70 | mlx_int_param_MotionNotify, /* 6 */
71 | mlx_int_param_generic,
72 | mlx_int_param_generic,
73 | mlx_int_param_generic,
74 | mlx_int_param_generic,
75 | mlx_int_param_generic,
76 | mlx_int_param_Expose, /* 12 */
77 | mlx_int_param_generic,
78 | mlx_int_param_generic,
79 | mlx_int_param_generic,
80 | mlx_int_param_generic,
81 | mlx_int_param_generic,
82 | mlx_int_param_generic,
83 | mlx_int_param_generic,
84 | mlx_int_param_generic,
85 | mlx_int_param_generic,
86 | mlx_int_param_generic,
87 | mlx_int_param_generic,
88 | mlx_int_param_generic,
89 | mlx_int_param_generic,
90 | mlx_int_param_generic,
91 | mlx_int_param_generic,
92 | mlx_int_param_generic,
93 | mlx_int_param_generic,
94 | mlx_int_param_generic,
95 | mlx_int_param_generic,
96 | mlx_int_param_generic,
97 | mlx_int_param_generic,
98 | mlx_int_param_generic,
99 | mlx_int_param_generic
100 | };
101 |
--------------------------------------------------------------------------------
/mlx_int_set_win_event_mask.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_set_win_event_mask.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:07:42 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_int_set_win_event_mask(t_xvar *xvar)
18 | {
19 | t_win_list *win;
20 | int mask;
21 | int i;
22 | XSetWindowAttributes xwa;
23 |
24 | win = xvar->win_list;
25 | while (win)
26 | {
27 | xwa.event_mask = 0;
28 | i = MLX_MAX_EVENT;
29 | while (i--)
30 | xwa.event_mask |= win->hooks[i].mask;
31 | XChangeWindowAttributes(xvar->display, win->window, CWEventMask, &xwa);
32 | win = win->next;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/mlx_int_str_to_wordtab.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_int_str_to_wordtab.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Wed Sep 13 11:36:09 2000 Charlie Root
8 | ** Last update Fri Dec 14 11:02:09 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 | int mlx_int_str_str(char *str,char *find,int len)
16 | {
17 | int len_f;
18 | int pos;
19 | char *s;
20 | char *f;
21 |
22 | len_f = strlen(find);
23 | if (len_f>len)
24 | return (-1);
25 | pos = 0;
26 | while (*(str+len_f-1))
27 | {
28 | s = str;
29 | f = find;
30 | while (*(f++) == *(s++))
31 | if (!*f)
32 | return (pos);
33 | str ++;
34 | pos ++;
35 | }
36 | return (-1);
37 | }
38 |
39 |
40 |
41 | int mlx_int_str_str_cote(char *str,char *find,int len)
42 | {
43 | int len_f;
44 | int pos;
45 | char *s;
46 | char *f;
47 | int cote;
48 |
49 | len_f = strlen(find);
50 | if (len_f>len)
51 | return (-1);
52 | cote = 0;
53 | pos = 0;
54 | while (*(str+len_f-1))
55 | {
56 | if (*str=='"')
57 | cote = 1-cote;
58 | if (!cote)
59 | {
60 | s = str;
61 | f = find;
62 | while (*(f++) == *(s++))
63 | if (!*f)
64 | return (pos);
65 | }
66 | str ++;
67 | pos ++;
68 | }
69 | return (-1);
70 | }
71 |
72 |
73 | char **mlx_int_str_to_wordtab(char *str)
74 | {
75 | char **tab;
76 | int pos;
77 | int nb_word;
78 | int len;
79 |
80 | len = strlen(str);
81 | nb_word = 0;
82 | pos = 0;
83 | while (pos
6 | **
7 | ** Started on Tue Oct 17 09:26:45 2000 olivier crouzet
8 | ** Last update Fri Feb 23 17:27:10 2001 Charlie Root
9 | */
10 |
11 |
12 |
13 | #include "mlx_int.h"
14 |
15 |
16 |
17 | int mlx_int_wait_first_expose(t_xvar *xvar,Window win)
18 | {
19 | XEvent ev;
20 |
21 | XWindowEvent(xvar->display,win,ExposureMask,&ev);
22 | XPutBackEvent(xvar->display,&ev);
23 | }
24 |
--------------------------------------------------------------------------------
/mlx_key_hook.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_key_hook.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:10:09 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_key_hook(t_win_list *win,int (*funct)(),void *param)
18 | {
19 | win->hooks[KeyRelease].hook = funct;
20 | win->hooks[KeyRelease].param = param;
21 | win->hooks[KeyRelease].mask = KeyReleaseMask;
22 | }
23 |
--------------------------------------------------------------------------------
/mlx_lib_xpm.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_xpm.c for minilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Fri Dec 8 11:07:24 2000 Charlie Root
8 | ** Last update Thu Oct 4 16:00:22 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | void *mlx_int_xpm_f_image(t_xvar *xvar,int *width,int *height,
18 | int (*xpm_func)(),void *param)
19 | {
20 | XImage *img1;
21 | XImage *img2;
22 | t_img *im2;
23 | XpmAttributes xpm_att;
24 |
25 | xpm_att.visual = xvar->visual;
26 | xpm_att.colormap = xvar->cmap;
27 | xpm_att.depth = xvar->depth;
28 | xpm_att.bitmap_format = ZPixmap;
29 | xpm_att.valuemask = XpmDepth|XpmBitmapFormat|XpmVisual|XpmColormap;
30 | if (xpm_func(xvar->display,param,&img1,&img2,&xpm_att))
31 | return ((void *)0);
32 | if (img2)
33 | XDestroyImage(img2);
34 |
35 | if (!(im2 = (void *)mlx_new_image(xvar,img1->width,img1->height)))
36 | {
37 | XDestroyImage(img1);
38 | return ((void *)0);
39 | }
40 | *width = img1->width;
41 | *height = img1->height;
42 | if (mlx_int_egal_img(im2->image,img1))
43 | {
44 | bcopy(img1->data,im2->data,img1->height*img1->bytes_per_line);
45 | XDestroyImage(img1);
46 | return (im2);
47 | }
48 | if (im2->type==MLX_TYPE_SHM_PIXMAP)
49 | {
50 | XFreePixmap(xvar->display,im2->pix);
51 | im2->pix = XCreatePixmap(xvar->display,xvar->root,
52 | *width,*height,xvar->depth);
53 | }
54 | if (im2->type>MLX_TYPE_XIMAGE)
55 | {
56 | XShmDetach(xvar->display,&(im2->shm));
57 | shmdt(im2->data);
58 | }
59 | XDestroyImage(im2->image);
60 | im2->image = img1;
61 | im2->data = img1->data;
62 | im2->type = MLX_TYPE_XIMAGE;
63 | im2->size_line = img1->bytes_per_line;
64 | im2->bpp = img1->bits_per_pixel;
65 | return (im2);
66 | }
67 |
68 |
69 | int mlx_int_egal_img(XImage *img1,XImage *img2)
70 | {
71 | if (img1->width!=img2->width || img1->height!=img2->height ||
72 | img1->xoffset!=img2->xoffset || img1->format!=img2->format ||
73 | img1->byte_order!=img2->byte_order ||
74 | img1->bitmap_unit!=img2->bitmap_unit ||
75 | img1->bitmap_bit_order!=img2->bitmap_bit_order ||
76 | img1->bitmap_pad!=img2->bitmap_pad || img1->depth!=img2->depth ||
77 | img1->bytes_per_line!=img2->bytes_per_line ||
78 | img1->bits_per_pixel!=img2->bits_per_pixel ||
79 | img1->red_mask!=img2->red_mask || img1->green_mask!=img2->green_mask ||
80 | img1->blue_mask!=img2->blue_mask )
81 | return (0);
82 | return (1);
83 | }
84 |
85 |
86 | void *mlx_xpm_file_to_image(t_xvar *xvar,char *filename,
87 | int *width,int *height)
88 | {
89 | return (mlx_int_xpm_f_image(xvar,width,height,XpmReadFileToImage,filename));
90 | }
91 |
92 |
93 | void *mlx_xpm_to_image(t_xvar *xvar,char **data,int *width,int *height)
94 | {
95 | return (mlx_int_xpm_f_image(xvar,width,height,XpmCreateImageFromData,(void *)data));
96 | }
97 |
--------------------------------------------------------------------------------
/mlx_loop.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_loop.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Wed Aug 2 18:58:11 2000 Charlie Root
8 | ** Last update Fri Sep 30 14:47:41 2005 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 | extern int (*(mlx_int_param_event[]))();
15 |
16 | static int win_count(t_xvar *xvar)
17 | {
18 | int i;
19 | t_win_list *win;
20 |
21 | i = 0;
22 | win = xvar->win_list;
23 | while (win)
24 | {
25 | win = win->next;
26 | ++i;
27 | }
28 | return (i);
29 | }
30 |
31 | int mlx_loop_end(t_xvar *xvar)
32 | {
33 | xvar->end_loop = 1;
34 | return (1);
35 | }
36 |
37 | int mlx_loop(t_xvar *xvar)
38 | {
39 | XEvent ev;
40 | t_win_list *win;
41 |
42 | mlx_int_set_win_event_mask(xvar);
43 | xvar->do_flush = 0;
44 | while (win_count(xvar) && !xvar->end_loop)
45 | {
46 | while (!xvar->end_loop && (!xvar->loop_hook || XPending(xvar->display)))
47 | {
48 | XNextEvent(xvar->display,&ev);
49 | win = xvar->win_list;
50 | while (win && (win->window!=ev.xany.window))
51 | win = win->next;
52 |
53 | if (win && ev.type == ClientMessage && ev.xclient.message_type == xvar->wm_protocols && ev.xclient.data.l[0] == xvar->wm_delete_window && win->hooks[DestroyNotify].hook)
54 | win->hooks[DestroyNotify].hook(win->hooks[DestroyNotify].param);
55 | if (win && ev.type < MLX_MAX_EVENT && win->hooks[ev.type].hook)
56 | mlx_int_param_event[ev.type](xvar, &ev, win);
57 | }
58 | XSync(xvar->display, False);
59 | if (xvar->loop_hook)
60 | xvar->loop_hook(xvar->loop_param);
61 | }
62 | return (0);
63 | }
64 |
--------------------------------------------------------------------------------
/mlx_loop_hook.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_loop_hook.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:11:39 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_loop_hook(t_xvar *xvar,int (*funct)(),void *param)
18 | {
19 | xvar->loop_hook = funct;
20 | xvar->loop_param = param;
21 | }
22 |
--------------------------------------------------------------------------------
/mlx_mouse.c:
--------------------------------------------------------------------------------
1 | #include "mlx_int.h"
2 |
3 | int mlx_mouse_move(t_xvar *xvar, t_win_list *win, int x, int y)
4 | {
5 | XWarpPointer(xvar->display, None, win->window, 0, 0, 0, 0, x, y);
6 | return (0);
7 | }
8 |
9 | int mlx_mouse_hide(t_xvar *xvar, t_win_list *win)
10 | {
11 | static char data[1] = {0};
12 | Cursor cursor;
13 | Pixmap blank;
14 | XColor dummy;
15 |
16 | blank = XCreateBitmapFromData(xvar->display, win->window, data, 1, 1);
17 | cursor = XCreatePixmapCursor(xvar->display, blank, blank, &dummy, &dummy, 0, 0);
18 | XDefineCursor(xvar->display, win->window, cursor);
19 | XFreePixmap(xvar->display, blank);
20 | XFreeCursor(xvar->display, cursor);
21 | }
22 |
23 | int mlx_mouse_show(t_xvar *xvar, t_win_list *win)
24 | {
25 | XUndefineCursor(xvar->display, win->window);
26 | }
27 |
28 | /*
29 | ** Queries the position of the mouse pointer relative to the origin of the
30 | ** specified window and saves it to the provided location.
31 | **
32 | ** If the pointer is not on the same screen as the specified window, both
33 | ** win_x_return and win_y_return are set to zero and the function returns 0.
34 | */
35 |
36 | int mlx_mouse_get_pos(t_xvar *xvar, t_win_list *win, \
37 | int *win_x_return, int *win_y_return)
38 | {
39 | Window root_return;
40 | Window child_return;
41 | int root_x_return;
42 | int root_y_return;
43 | unsigned mask_return;
44 |
45 | return (XQueryPointer(xvar->display, win->window, \
46 | &root_return, &child_return, &root_x_return, &root_y_return, \
47 | win_x_return, win_y_return, &mask_return));
48 | }
49 |
--------------------------------------------------------------------------------
/mlx_mouse_hook.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_mouse_hook.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Thu Aug 3 11:49:06 2000 Charlie Root
8 | ** Last update Fri Feb 23 17:11:05 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 |
17 | int mlx_mouse_hook(t_win_list *win,int (*funct)(),void *param)
18 | {
19 | win->hooks[ButtonPress].hook = funct;
20 | win->hooks[ButtonPress].param = param;
21 | win->hooks[ButtonPress].mask = ButtonPressMask;
22 | }
23 |
--------------------------------------------------------------------------------
/mlx_new_image.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_new_image.c for MiniLibX in raytraceur
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Aug 14 15:29:14 2000 Charlie Root
8 | ** Last update Wed May 25 16:46:31 2011 Olivier Crouzet
9 | */
10 |
11 |
12 |
13 |
14 | #include "mlx_int.h"
15 |
16 | /*
17 | ** To handle X errors
18 | */
19 |
20 | #define X_ShmAttach 1
21 |
22 | int mlx_X_error;
23 |
24 | int shm_att_pb(Display *d,XErrorEvent *ev)
25 | {
26 | if (ev->request_code==146 && ev->minor_code==X_ShmAttach)
27 | write(2,WARN_SHM_ATTACH,strlen(WARN_SHM_ATTACH));
28 | mlx_X_error = 1;
29 | }
30 |
31 |
32 | /*
33 | ** Data malloc : width+32 ( bitmap_pad=32 ), *4 = *32 / 8bit
34 | */
35 |
36 |
37 | void *mlx_int_new_xshm_image(t_xvar *xvar,int width,int height,int format)
38 | {
39 | t_img *img;
40 | int (*save_handler)();
41 |
42 | if (!(img = malloc(sizeof(*img))))
43 | return ((void *)0);
44 | bzero(img,sizeof(*img));
45 | img->data = 0;
46 | img->image = XShmCreateImage(xvar->display,xvar->visual,xvar->depth,
47 | format,img->data,&(img->shm),width,height);
48 | if (!img->image)
49 | {
50 | free(img);
51 | return ((void *)0);
52 | }
53 | img->width = width;
54 | img->height = height;
55 | img->size_line = img->image->bytes_per_line;
56 | img->bpp = img->image->bits_per_pixel;
57 | img->format = format;
58 | img->shm.shmid = shmget(IPC_PRIVATE,(width+32)*height*4,IPC_CREAT|0777);
59 | if (img->shm.shmid==-1)
60 | {
61 | XDestroyImage(img->image);
62 | free(img);
63 | return ((void *)0);
64 | }
65 | img->data = img->shm.shmaddr = img->image->data = shmat(img->shm.shmid,0,0);
66 | if (img->data==(void *)-1)
67 | {
68 | shmctl(img->shm.shmid,IPC_RMID,0);
69 | XDestroyImage(img->image);
70 | free(img);
71 | return ((void *)0);
72 | }
73 | img->shm.readOnly = False;
74 | mlx_X_error = 0;
75 | save_handler = XSetErrorHandler(shm_att_pb);
76 | if (!XShmAttach(xvar->display,&(img->shm)) ||
77 | 0&XSync(xvar->display,False) || mlx_X_error)
78 | {
79 | XSetErrorHandler(save_handler);
80 | shmdt(img->data);
81 | shmctl(img->shm.shmid,IPC_RMID,0);
82 | XDestroyImage(img->image);
83 | free(img);
84 | return ((void *)0);
85 | }
86 | XSetErrorHandler(save_handler);
87 | shmctl(img->shm.shmid,IPC_RMID,0);
88 | if (xvar->pshm_format==format)
89 | {
90 | img->pix = XShmCreatePixmap(xvar->display,xvar->root,img->shm.shmaddr,
91 | &(img->shm),width,height,xvar->depth);
92 | img->type = MLX_TYPE_SHM_PIXMAP;
93 | }
94 | else
95 | {
96 | img->pix = XCreatePixmap(xvar->display,xvar->root,
97 | width,height,xvar->depth);
98 | img->type = MLX_TYPE_SHM;
99 | }
100 | if (xvar->do_flush)
101 | XFlush(xvar->display);
102 | return (img);
103 | }
104 |
105 |
106 |
107 | void *mlx_int_new_image(t_xvar *xvar,int width, int height,int format)
108 | {
109 | t_img *img;
110 |
111 | if (!(img = malloc(sizeof(*img))))
112 | return ((void *)0);
113 | if (!(img->data = malloc((width+32)*height*4)))
114 | {
115 | free(img);
116 | return ((void *)0);
117 | }
118 | bzero(img->data,(width+32)*height*4);
119 | img->image = XCreateImage(xvar->display,xvar->visual,xvar->depth,format,0,
120 | img->data,width,height,32,0);
121 | if (!img->image)
122 | {
123 | free(img->data);
124 | free(img);
125 | return ((void *)0);
126 | }
127 | img->gc = 0;
128 | img->size_line = img->image->bytes_per_line;
129 | img->bpp = img->image->bits_per_pixel;
130 | img->width = width;
131 | img->height = height;
132 | img->pix = XCreatePixmap(xvar->display,xvar->root,width,height,xvar->depth);
133 | img->format = format;
134 | img->type = MLX_TYPE_XIMAGE;
135 | if (xvar->do_flush)
136 | XFlush(xvar->display);
137 | return (img);
138 | }
139 |
140 |
141 | void *mlx_new_image(t_xvar *xvar,int width, int height)
142 | {
143 | t_img *img;
144 |
145 | if (xvar->use_xshm)
146 | if (img = mlx_int_new_xshm_image(xvar,width,height,ZPixmap))
147 | return (img);
148 | return (mlx_int_new_image(xvar,width,height,ZPixmap));
149 | }
150 |
151 | void *mlx_new_image2(t_xvar *xvar,int width, int height)
152 | {
153 | t_img *img;
154 |
155 | if (xvar->use_xshm)
156 | if (img = mlx_int_new_xshm_image(xvar,width,height,XYPixmap))
157 | return (img);
158 | return (mlx_int_new_image(xvar,width,height,XYPixmap));
159 | }
160 |
--------------------------------------------------------------------------------
/mlx_new_window.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_new_window.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 17:29:02 2000 Charlie Root
8 | ** Last update Thu Oct 4 15:44:43 2001 Charlie Root
9 | */
10 |
11 |
12 | /*
13 | ** We do not use White/BlackPixel macro, TrueColor Visual make sure
14 | ** 0 is black & -1 is white
15 | **
16 | ** With mlx_int_wait_first_expose, no flush is needed.
17 | */
18 |
19 | #include "mlx_int.h"
20 |
21 |
22 | void *mlx_new_window(t_xvar *xvar,int size_x,int size_y,char *title)
23 | {
24 | t_win_list *new_win;
25 | XSetWindowAttributes xswa;
26 | XGCValues xgcv;
27 |
28 | xswa.background_pixel = 0;
29 | xswa.border_pixel = -1;
30 | xswa.colormap = xvar->cmap;
31 | /*
32 | xswa.event_mask = ButtonPressMask | ButtonReleaseMask | ExposureMask |
33 | KeyPressMask | KeyReleaseMask | StructureNotifyMask;
34 | */
35 | /* xswa.event_mask = ExposureMask; */
36 | xswa.event_mask = 0xFFFFFF; /* all events */
37 | if (!(new_win = malloc(sizeof(*new_win))))
38 | return ((void *)0);
39 | new_win->window = XCreateWindow(xvar->display,xvar->root,0,0,size_x,size_y,
40 | 0,CopyFromParent,InputOutput,xvar->visual,
41 | CWEventMask|CWBackPixel|CWBorderPixel|
42 | CWColormap,&xswa);
43 | mlx_int_anti_resize_win(xvar,new_win->window,size_x,size_y);
44 | XStoreName(xvar->display,new_win->window,title);
45 | XSetWMProtocols(xvar->display, new_win->window, &(xvar->wm_delete_window), 1);
46 | xgcv.foreground = -1;
47 | xgcv.function = GXcopy;
48 | xgcv.plane_mask = AllPlanes;
49 | new_win->gc = XCreateGC(xvar->display,new_win->window,
50 | GCFunction|GCPlaneMask|GCForeground,&xgcv);
51 | new_win->next = xvar->win_list;
52 | xvar->win_list = new_win;
53 | /*
54 | new_win->mouse_hook = mlx_int_do_nothing;
55 | new_win->key_hook = mlx_int_do_nothing;
56 | new_win->expose_hook = mlx_int_do_nothing;
57 | */
58 | bzero(&(new_win->hooks), sizeof(new_win->hooks));
59 | XMapRaised(xvar->display,new_win->window);
60 | mlx_int_wait_first_expose(xvar,new_win->window);
61 | return (new_win);
62 | }
63 |
--------------------------------------------------------------------------------
/mlx_pixel_put.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_pixel_put.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 19:01:33 2000 Charlie Root
8 | ** Last update Tue Sep 25 17:09:49 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 | int mlx_pixel_put(t_xvar *xvar,t_win_list *win,
17 | int x,int y,int color)
18 | {
19 | XGCValues xgcv;
20 |
21 | xgcv.foreground = mlx_int_get_good_color(xvar,color);
22 | XChangeGC(xvar->display,win->gc,GCForeground,&xgcv);
23 | XDrawPoint(xvar->display,win->window,win->gc,x,y);
24 | if (xvar->do_flush)
25 | XFlush(xvar->display);
26 | }
27 |
--------------------------------------------------------------------------------
/mlx_put_image_to_window.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_put_image_to_window.c for MiniLibX in raytraceur
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Aug 14 15:55:49 2000 Charlie Root
8 | ** Last update Sun Oct 2 09:53:00 2005 Olivier Crouzet
9 | */
10 |
11 |
12 |
13 | #include "mlx_int.h"
14 |
15 |
16 | int mlx_put_image_to_window(t_xvar *xvar,t_win_list *win,t_img *img,
17 | int x,int y)
18 | {
19 | GC gc;
20 |
21 | gc = win->gc;
22 | if (img->gc)
23 | {
24 | gc = img->gc;
25 | XSetClipOrigin(xvar->display, gc, x, y);
26 | }
27 | if (img->type==MLX_TYPE_SHM)
28 | XShmPutImage(xvar->display,img->pix, win->gc, img->image,0,0,0,0,
29 | img->width,img->height,False);
30 | if (img->type==MLX_TYPE_XIMAGE)
31 | XPutImage(xvar->display,img->pix, win->gc, img->image,0,0,0,0,
32 | img->width,img->height);
33 | XCopyArea(xvar->display,img->pix,win->window, gc,
34 | 0,0,img->width,img->height,x,y);
35 | if (xvar->do_flush)
36 | XFlush(xvar->display);
37 | }
38 |
--------------------------------------------------------------------------------
/mlx_rgb.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** This is a generated file with rgb2c.pl and rgb.txt from
3 | ** the XFree86 distribution.
4 | */
5 |
6 | #include "mlx_int.h"
7 |
8 | struct s_col_name mlx_col_name[] =
9 | {
10 | { "snow" , 0xfffafa },
11 | { "ghost white" , 0xf8f8ff },
12 | { "ghostwhite" , 0xf8f8ff },
13 | { "white smoke" , 0xf5f5f5 },
14 | { "whitesmoke" , 0xf5f5f5 },
15 | { "gainsboro" , 0xdcdcdc },
16 | { "floral white" , 0xfffaf0 },
17 | { "floralwhite" , 0xfffaf0 },
18 | { "old lace" , 0xfdf5e6 },
19 | { "oldlace" , 0xfdf5e6 },
20 | { "linen" , 0xfaf0e6 },
21 | { "antique white" , 0xfaebd7 },
22 | { "antiquewhite" , 0xfaebd7 },
23 | { "papaya whip" , 0xffefd5 },
24 | { "papayawhip" , 0xffefd5 },
25 | { "blanched almond" , 0xffebcd },
26 | { "blanchedalmond" , 0xffebcd },
27 | { "bisque" , 0xffe4c4 },
28 | { "peach puff" , 0xffdab9 },
29 | { "peachpuff" , 0xffdab9 },
30 | { "navajo white" , 0xffdead },
31 | { "navajowhite" , 0xffdead },
32 | { "moccasin" , 0xffe4b5 },
33 | { "cornsilk" , 0xfff8dc },
34 | { "ivory" , 0xfffff0 },
35 | { "lemon chiffon" , 0xfffacd },
36 | { "lemonchiffon" , 0xfffacd },
37 | { "seashell" , 0xfff5ee },
38 | { "honeydew" , 0xf0fff0 },
39 | { "mint cream" , 0xf5fffa },
40 | { "mintcream" , 0xf5fffa },
41 | { "azure" , 0xf0ffff },
42 | { "alice blue" , 0xf0f8ff },
43 | { "aliceblue" , 0xf0f8ff },
44 | { "lavender" , 0xe6e6fa },
45 | { "lavender blush" , 0xfff0f5 },
46 | { "lavenderblush" , 0xfff0f5 },
47 | { "misty rose" , 0xffe4e1 },
48 | { "mistyrose" , 0xffe4e1 },
49 | { "white" , 0xffffff },
50 | { "black" , 0x0 },
51 | { "dark slate" , 0x2f4f4f },
52 | { "darkslategray" , 0x2f4f4f },
53 | { "dark slate" , 0x2f4f4f },
54 | { "darkslategrey" , 0x2f4f4f },
55 | { "dim gray" , 0x696969 },
56 | { "dimgray" , 0x696969 },
57 | { "dim grey" , 0x696969 },
58 | { "dimgrey" , 0x696969 },
59 | { "slate gray" , 0x708090 },
60 | { "slategray" , 0x708090 },
61 | { "slate grey" , 0x708090 },
62 | { "slategrey" , 0x708090 },
63 | { "light slate" , 0x778899 },
64 | { "lightslategray" , 0x778899 },
65 | { "light slate" , 0x778899 },
66 | { "lightslategrey" , 0x778899 },
67 | { "gray" , 0xbebebe },
68 | { "grey" , 0xbebebe },
69 | { "light grey" , 0xd3d3d3 },
70 | { "lightgrey" , 0xd3d3d3 },
71 | { "light gray" , 0xd3d3d3 },
72 | { "lightgray" , 0xd3d3d3 },
73 | { "midnight blue" , 0x191970 },
74 | { "midnightblue" , 0x191970 },
75 | { "navy" , 0x80 },
76 | { "navy blue" , 0x80 },
77 | { "navyblue" , 0x80 },
78 | { "cornflower blue" , 0x6495ed },
79 | { "cornflowerblue" , 0x6495ed },
80 | { "dark slate" , 0x483d8b },
81 | { "darkslateblue" , 0x483d8b },
82 | { "slate blue" , 0x6a5acd },
83 | { "slateblue" , 0x6a5acd },
84 | { "medium slate" , 0x7b68ee },
85 | { "mediumslateblue" , 0x7b68ee },
86 | { "light slate" , 0x8470ff },
87 | { "lightslateblue" , 0x8470ff },
88 | { "medium blue" , 0xcd },
89 | { "mediumblue" , 0xcd },
90 | { "royal blue" , 0x4169e1 },
91 | { "royalblue" , 0x4169e1 },
92 | { "blue" , 0xff },
93 | { "dodger blue" , 0x1e90ff },
94 | { "dodgerblue" , 0x1e90ff },
95 | { "deep sky" , 0xbfff },
96 | { "deepskyblue" , 0xbfff },
97 | { "sky blue" , 0x87ceeb },
98 | { "skyblue" , 0x87ceeb },
99 | { "light sky" , 0x87cefa },
100 | { "lightskyblue" , 0x87cefa },
101 | { "steel blue" , 0x4682b4 },
102 | { "steelblue" , 0x4682b4 },
103 | { "light steel" , 0xb0c4de },
104 | { "lightsteelblue" , 0xb0c4de },
105 | { "light blue" , 0xadd8e6 },
106 | { "lightblue" , 0xadd8e6 },
107 | { "powder blue" , 0xb0e0e6 },
108 | { "powderblue" , 0xb0e0e6 },
109 | { "pale turquoise" , 0xafeeee },
110 | { "paleturquoise" , 0xafeeee },
111 | { "dark turquoise" , 0xced1 },
112 | { "darkturquoise" , 0xced1 },
113 | { "medium turquoise" , 0x48d1cc },
114 | { "mediumturquoise" , 0x48d1cc },
115 | { "turquoise" , 0x40e0d0 },
116 | { "cyan" , 0xffff },
117 | { "light cyan" , 0xe0ffff },
118 | { "lightcyan" , 0xe0ffff },
119 | { "cadet blue" , 0x5f9ea0 },
120 | { "cadetblue" , 0x5f9ea0 },
121 | { "medium aquamarine" , 0x66cdaa },
122 | { "mediumaquamarine" , 0x66cdaa },
123 | { "aquamarine" , 0x7fffd4 },
124 | { "dark green" , 0x6400 },
125 | { "darkgreen" , 0x6400 },
126 | { "dark olive" , 0x556b2f },
127 | { "darkolivegreen" , 0x556b2f },
128 | { "dark sea" , 0x8fbc8f },
129 | { "darkseagreen" , 0x8fbc8f },
130 | { "sea green" , 0x2e8b57 },
131 | { "seagreen" , 0x2e8b57 },
132 | { "medium sea" , 0x3cb371 },
133 | { "mediumseagreen" , 0x3cb371 },
134 | { "light sea" , 0x20b2aa },
135 | { "lightseagreen" , 0x20b2aa },
136 | { "pale green" , 0x98fb98 },
137 | { "palegreen" , 0x98fb98 },
138 | { "spring green" , 0xff7f },
139 | { "springgreen" , 0xff7f },
140 | { "lawn green" , 0x7cfc00 },
141 | { "lawngreen" , 0x7cfc00 },
142 | { "green" , 0xff00 },
143 | { "chartreuse" , 0x7fff00 },
144 | { "medium spring" , 0xfa9a },
145 | { "mediumspringgreen" , 0xfa9a },
146 | { "green yellow" , 0xadff2f },
147 | { "greenyellow" , 0xadff2f },
148 | { "lime green" , 0x32cd32 },
149 | { "limegreen" , 0x32cd32 },
150 | { "yellow green" , 0x9acd32 },
151 | { "yellowgreen" , 0x9acd32 },
152 | { "forest green" , 0x228b22 },
153 | { "forestgreen" , 0x228b22 },
154 | { "olive drab" , 0x6b8e23 },
155 | { "olivedrab" , 0x6b8e23 },
156 | { "dark khaki" , 0xbdb76b },
157 | { "darkkhaki" , 0xbdb76b },
158 | { "khaki" , 0xf0e68c },
159 | { "pale goldenrod" , 0xeee8aa },
160 | { "palegoldenrod" , 0xeee8aa },
161 | { "light goldenrod" , 0xfafad2 },
162 | { "lightgoldenrodyellow" , 0xfafad2 },
163 | { "light yellow" , 0xffffe0 },
164 | { "lightyellow" , 0xffffe0 },
165 | { "yellow" , 0xffff00 },
166 | { "gold" , 0xffd700 },
167 | { "light goldenrod" , 0xeedd82 },
168 | { "lightgoldenrod" , 0xeedd82 },
169 | { "goldenrod" , 0xdaa520 },
170 | { "dark goldenrod" , 0xb8860b },
171 | { "darkgoldenrod" , 0xb8860b },
172 | { "rosy brown" , 0xbc8f8f },
173 | { "rosybrown" , 0xbc8f8f },
174 | { "indian red" , 0xcd5c5c },
175 | { "indianred" , 0xcd5c5c },
176 | { "saddle brown" , 0x8b4513 },
177 | { "saddlebrown" , 0x8b4513 },
178 | { "sienna" , 0xa0522d },
179 | { "peru" , 0xcd853f },
180 | { "burlywood" , 0xdeb887 },
181 | { "beige" , 0xf5f5dc },
182 | { "wheat" , 0xf5deb3 },
183 | { "sandy brown" , 0xf4a460 },
184 | { "sandybrown" , 0xf4a460 },
185 | { "tan" , 0xd2b48c },
186 | { "chocolate" , 0xd2691e },
187 | { "firebrick" , 0xb22222 },
188 | { "brown" , 0xa52a2a },
189 | { "dark salmon" , 0xe9967a },
190 | { "darksalmon" , 0xe9967a },
191 | { "salmon" , 0xfa8072 },
192 | { "light salmon" , 0xffa07a },
193 | { "lightsalmon" , 0xffa07a },
194 | { "orange" , 0xffa500 },
195 | { "dark orange" , 0xff8c00 },
196 | { "darkorange" , 0xff8c00 },
197 | { "coral" , 0xff7f50 },
198 | { "light coral" , 0xf08080 },
199 | { "lightcoral" , 0xf08080 },
200 | { "tomato" , 0xff6347 },
201 | { "orange red" , 0xff4500 },
202 | { "orangered" , 0xff4500 },
203 | { "red" , 0xff0000 },
204 | { "hot pink" , 0xff69b4 },
205 | { "hotpink" , 0xff69b4 },
206 | { "deep pink" , 0xff1493 },
207 | { "deeppink" , 0xff1493 },
208 | { "pink" , 0xffc0cb },
209 | { "light pink" , 0xffb6c1 },
210 | { "lightpink" , 0xffb6c1 },
211 | { "pale violet" , 0xdb7093 },
212 | { "palevioletred" , 0xdb7093 },
213 | { "maroon" , 0xb03060 },
214 | { "medium violet" , 0xc71585 },
215 | { "mediumvioletred" , 0xc71585 },
216 | { "violet red" , 0xd02090 },
217 | { "violetred" , 0xd02090 },
218 | { "magenta" , 0xff00ff },
219 | { "violet" , 0xee82ee },
220 | { "plum" , 0xdda0dd },
221 | { "orchid" , 0xda70d6 },
222 | { "medium orchid" , 0xba55d3 },
223 | { "mediumorchid" , 0xba55d3 },
224 | { "dark orchid" , 0x9932cc },
225 | { "darkorchid" , 0x9932cc },
226 | { "dark violet" , 0x9400d3 },
227 | { "darkviolet" , 0x9400d3 },
228 | { "blue violet" , 0x8a2be2 },
229 | { "blueviolet" , 0x8a2be2 },
230 | { "purple" , 0xa020f0 },
231 | { "medium purple" , 0x9370db },
232 | { "mediumpurple" , 0x9370db },
233 | { "thistle" , 0xd8bfd8 },
234 | { "snow1" , 0xfffafa },
235 | { "snow2" , 0xeee9e9 },
236 | { "snow3" , 0xcdc9c9 },
237 | { "snow4" , 0x8b8989 },
238 | { "seashell1" , 0xfff5ee },
239 | { "seashell2" , 0xeee5de },
240 | { "seashell3" , 0xcdc5bf },
241 | { "seashell4" , 0x8b8682 },
242 | { "antiquewhite1" , 0xffefdb },
243 | { "antiquewhite2" , 0xeedfcc },
244 | { "antiquewhite3" , 0xcdc0b0 },
245 | { "antiquewhite4" , 0x8b8378 },
246 | { "bisque1" , 0xffe4c4 },
247 | { "bisque2" , 0xeed5b7 },
248 | { "bisque3" , 0xcdb79e },
249 | { "bisque4" , 0x8b7d6b },
250 | { "peachpuff1" , 0xffdab9 },
251 | { "peachpuff2" , 0xeecbad },
252 | { "peachpuff3" , 0xcdaf95 },
253 | { "peachpuff4" , 0x8b7765 },
254 | { "navajowhite1" , 0xffdead },
255 | { "navajowhite2" , 0xeecfa1 },
256 | { "navajowhite3" , 0xcdb38b },
257 | { "navajowhite4" , 0x8b795e },
258 | { "lemonchiffon1" , 0xfffacd },
259 | { "lemonchiffon2" , 0xeee9bf },
260 | { "lemonchiffon3" , 0xcdc9a5 },
261 | { "lemonchiffon4" , 0x8b8970 },
262 | { "cornsilk1" , 0xfff8dc },
263 | { "cornsilk2" , 0xeee8cd },
264 | { "cornsilk3" , 0xcdc8b1 },
265 | { "cornsilk4" , 0x8b8878 },
266 | { "ivory1" , 0xfffff0 },
267 | { "ivory2" , 0xeeeee0 },
268 | { "ivory3" , 0xcdcdc1 },
269 | { "ivory4" , 0x8b8b83 },
270 | { "honeydew1" , 0xf0fff0 },
271 | { "honeydew2" , 0xe0eee0 },
272 | { "honeydew3" , 0xc1cdc1 },
273 | { "honeydew4" , 0x838b83 },
274 | { "lavenderblush1" , 0xfff0f5 },
275 | { "lavenderblush2" , 0xeee0e5 },
276 | { "lavenderblush3" , 0xcdc1c5 },
277 | { "lavenderblush4" , 0x8b8386 },
278 | { "mistyrose1" , 0xffe4e1 },
279 | { "mistyrose2" , 0xeed5d2 },
280 | { "mistyrose3" , 0xcdb7b5 },
281 | { "mistyrose4" , 0x8b7d7b },
282 | { "azure1" , 0xf0ffff },
283 | { "azure2" , 0xe0eeee },
284 | { "azure3" , 0xc1cdcd },
285 | { "azure4" , 0x838b8b },
286 | { "slateblue1" , 0x836fff },
287 | { "slateblue2" , 0x7a67ee },
288 | { "slateblue3" , 0x6959cd },
289 | { "slateblue4" , 0x473c8b },
290 | { "royalblue1" , 0x4876ff },
291 | { "royalblue2" , 0x436eee },
292 | { "royalblue3" , 0x3a5fcd },
293 | { "royalblue4" , 0x27408b },
294 | { "blue1" , 0xff },
295 | { "blue2" , 0xee },
296 | { "blue3" , 0xcd },
297 | { "blue4" , 0x8b },
298 | { "dodgerblue1" , 0x1e90ff },
299 | { "dodgerblue2" , 0x1c86ee },
300 | { "dodgerblue3" , 0x1874cd },
301 | { "dodgerblue4" , 0x104e8b },
302 | { "steelblue1" , 0x63b8ff },
303 | { "steelblue2" , 0x5cacee },
304 | { "steelblue3" , 0x4f94cd },
305 | { "steelblue4" , 0x36648b },
306 | { "deepskyblue1" , 0xbfff },
307 | { "deepskyblue2" , 0xb2ee },
308 | { "deepskyblue3" , 0x9acd },
309 | { "deepskyblue4" , 0x688b },
310 | { "skyblue1" , 0x87ceff },
311 | { "skyblue2" , 0x7ec0ee },
312 | { "skyblue3" , 0x6ca6cd },
313 | { "skyblue4" , 0x4a708b },
314 | { "lightskyblue1" , 0xb0e2ff },
315 | { "lightskyblue2" , 0xa4d3ee },
316 | { "lightskyblue3" , 0x8db6cd },
317 | { "lightskyblue4" , 0x607b8b },
318 | { "slategray1" , 0xc6e2ff },
319 | { "slategray2" , 0xb9d3ee },
320 | { "slategray3" , 0x9fb6cd },
321 | { "slategray4" , 0x6c7b8b },
322 | { "lightsteelblue1" , 0xcae1ff },
323 | { "lightsteelblue2" , 0xbcd2ee },
324 | { "lightsteelblue3" , 0xa2b5cd },
325 | { "lightsteelblue4" , 0x6e7b8b },
326 | { "lightblue1" , 0xbfefff },
327 | { "lightblue2" , 0xb2dfee },
328 | { "lightblue3" , 0x9ac0cd },
329 | { "lightblue4" , 0x68838b },
330 | { "lightcyan1" , 0xe0ffff },
331 | { "lightcyan2" , 0xd1eeee },
332 | { "lightcyan3" , 0xb4cdcd },
333 | { "lightcyan4" , 0x7a8b8b },
334 | { "paleturquoise1" , 0xbbffff },
335 | { "paleturquoise2" , 0xaeeeee },
336 | { "paleturquoise3" , 0x96cdcd },
337 | { "paleturquoise4" , 0x668b8b },
338 | { "cadetblue1" , 0x98f5ff },
339 | { "cadetblue2" , 0x8ee5ee },
340 | { "cadetblue3" , 0x7ac5cd },
341 | { "cadetblue4" , 0x53868b },
342 | { "turquoise1" , 0xf5ff },
343 | { "turquoise2" , 0xe5ee },
344 | { "turquoise3" , 0xc5cd },
345 | { "turquoise4" , 0x868b },
346 | { "cyan1" , 0xffff },
347 | { "cyan2" , 0xeeee },
348 | { "cyan3" , 0xcdcd },
349 | { "cyan4" , 0x8b8b },
350 | { "darkslategray1" , 0x97ffff },
351 | { "darkslategray2" , 0x8deeee },
352 | { "darkslategray3" , 0x79cdcd },
353 | { "darkslategray4" , 0x528b8b },
354 | { "aquamarine1" , 0x7fffd4 },
355 | { "aquamarine2" , 0x76eec6 },
356 | { "aquamarine3" , 0x66cdaa },
357 | { "aquamarine4" , 0x458b74 },
358 | { "darkseagreen1" , 0xc1ffc1 },
359 | { "darkseagreen2" , 0xb4eeb4 },
360 | { "darkseagreen3" , 0x9bcd9b },
361 | { "darkseagreen4" , 0x698b69 },
362 | { "seagreen1" , 0x54ff9f },
363 | { "seagreen2" , 0x4eee94 },
364 | { "seagreen3" , 0x43cd80 },
365 | { "seagreen4" , 0x2e8b57 },
366 | { "palegreen1" , 0x9aff9a },
367 | { "palegreen2" , 0x90ee90 },
368 | { "palegreen3" , 0x7ccd7c },
369 | { "palegreen4" , 0x548b54 },
370 | { "springgreen1" , 0xff7f },
371 | { "springgreen2" , 0xee76 },
372 | { "springgreen3" , 0xcd66 },
373 | { "springgreen4" , 0x8b45 },
374 | { "green1" , 0xff00 },
375 | { "green2" , 0xee00 },
376 | { "green3" , 0xcd00 },
377 | { "green4" , 0x8b00 },
378 | { "chartreuse1" , 0x7fff00 },
379 | { "chartreuse2" , 0x76ee00 },
380 | { "chartreuse3" , 0x66cd00 },
381 | { "chartreuse4" , 0x458b00 },
382 | { "olivedrab1" , 0xc0ff3e },
383 | { "olivedrab2" , 0xb3ee3a },
384 | { "olivedrab3" , 0x9acd32 },
385 | { "olivedrab4" , 0x698b22 },
386 | { "darkolivegreen1" , 0xcaff70 },
387 | { "darkolivegreen2" , 0xbcee68 },
388 | { "darkolivegreen3" , 0xa2cd5a },
389 | { "darkolivegreen4" , 0x6e8b3d },
390 | { "khaki1" , 0xfff68f },
391 | { "khaki2" , 0xeee685 },
392 | { "khaki3" , 0xcdc673 },
393 | { "khaki4" , 0x8b864e },
394 | { "lightgoldenrod1" , 0xffec8b },
395 | { "lightgoldenrod2" , 0xeedc82 },
396 | { "lightgoldenrod3" , 0xcdbe70 },
397 | { "lightgoldenrod4" , 0x8b814c },
398 | { "lightyellow1" , 0xffffe0 },
399 | { "lightyellow2" , 0xeeeed1 },
400 | { "lightyellow3" , 0xcdcdb4 },
401 | { "lightyellow4" , 0x8b8b7a },
402 | { "yellow1" , 0xffff00 },
403 | { "yellow2" , 0xeeee00 },
404 | { "yellow3" , 0xcdcd00 },
405 | { "yellow4" , 0x8b8b00 },
406 | { "gold1" , 0xffd700 },
407 | { "gold2" , 0xeec900 },
408 | { "gold3" , 0xcdad00 },
409 | { "gold4" , 0x8b7500 },
410 | { "goldenrod1" , 0xffc125 },
411 | { "goldenrod2" , 0xeeb422 },
412 | { "goldenrod3" , 0xcd9b1d },
413 | { "goldenrod4" , 0x8b6914 },
414 | { "darkgoldenrod1" , 0xffb90f },
415 | { "darkgoldenrod2" , 0xeead0e },
416 | { "darkgoldenrod3" , 0xcd950c },
417 | { "darkgoldenrod4" , 0x8b6508 },
418 | { "rosybrown1" , 0xffc1c1 },
419 | { "rosybrown2" , 0xeeb4b4 },
420 | { "rosybrown3" , 0xcd9b9b },
421 | { "rosybrown4" , 0x8b6969 },
422 | { "indianred1" , 0xff6a6a },
423 | { "indianred2" , 0xee6363 },
424 | { "indianred3" , 0xcd5555 },
425 | { "indianred4" , 0x8b3a3a },
426 | { "sienna1" , 0xff8247 },
427 | { "sienna2" , 0xee7942 },
428 | { "sienna3" , 0xcd6839 },
429 | { "sienna4" , 0x8b4726 },
430 | { "burlywood1" , 0xffd39b },
431 | { "burlywood2" , 0xeec591 },
432 | { "burlywood3" , 0xcdaa7d },
433 | { "burlywood4" , 0x8b7355 },
434 | { "wheat1" , 0xffe7ba },
435 | { "wheat2" , 0xeed8ae },
436 | { "wheat3" , 0xcdba96 },
437 | { "wheat4" , 0x8b7e66 },
438 | { "tan1" , 0xffa54f },
439 | { "tan2" , 0xee9a49 },
440 | { "tan3" , 0xcd853f },
441 | { "tan4" , 0x8b5a2b },
442 | { "chocolate1" , 0xff7f24 },
443 | { "chocolate2" , 0xee7621 },
444 | { "chocolate3" , 0xcd661d },
445 | { "chocolate4" , 0x8b4513 },
446 | { "firebrick1" , 0xff3030 },
447 | { "firebrick2" , 0xee2c2c },
448 | { "firebrick3" , 0xcd2626 },
449 | { "firebrick4" , 0x8b1a1a },
450 | { "brown1" , 0xff4040 },
451 | { "brown2" , 0xee3b3b },
452 | { "brown3" , 0xcd3333 },
453 | { "brown4" , 0x8b2323 },
454 | { "salmon1" , 0xff8c69 },
455 | { "salmon2" , 0xee8262 },
456 | { "salmon3" , 0xcd7054 },
457 | { "salmon4" , 0x8b4c39 },
458 | { "lightsalmon1" , 0xffa07a },
459 | { "lightsalmon2" , 0xee9572 },
460 | { "lightsalmon3" , 0xcd8162 },
461 | { "lightsalmon4" , 0x8b5742 },
462 | { "orange1" , 0xffa500 },
463 | { "orange2" , 0xee9a00 },
464 | { "orange3" , 0xcd8500 },
465 | { "orange4" , 0x8b5a00 },
466 | { "darkorange1" , 0xff7f00 },
467 | { "darkorange2" , 0xee7600 },
468 | { "darkorange3" , 0xcd6600 },
469 | { "darkorange4" , 0x8b4500 },
470 | { "coral1" , 0xff7256 },
471 | { "coral2" , 0xee6a50 },
472 | { "coral3" , 0xcd5b45 },
473 | { "coral4" , 0x8b3e2f },
474 | { "tomato1" , 0xff6347 },
475 | { "tomato2" , 0xee5c42 },
476 | { "tomato3" , 0xcd4f39 },
477 | { "tomato4" , 0x8b3626 },
478 | { "orangered1" , 0xff4500 },
479 | { "orangered2" , 0xee4000 },
480 | { "orangered3" , 0xcd3700 },
481 | { "orangered4" , 0x8b2500 },
482 | { "red1" , 0xff0000 },
483 | { "red2" , 0xee0000 },
484 | { "red3" , 0xcd0000 },
485 | { "red4" , 0x8b0000 },
486 | { "deeppink1" , 0xff1493 },
487 | { "deeppink2" , 0xee1289 },
488 | { "deeppink3" , 0xcd1076 },
489 | { "deeppink4" , 0x8b0a50 },
490 | { "hotpink1" , 0xff6eb4 },
491 | { "hotpink2" , 0xee6aa7 },
492 | { "hotpink3" , 0xcd6090 },
493 | { "hotpink4" , 0x8b3a62 },
494 | { "pink1" , 0xffb5c5 },
495 | { "pink2" , 0xeea9b8 },
496 | { "pink3" , 0xcd919e },
497 | { "pink4" , 0x8b636c },
498 | { "lightpink1" , 0xffaeb9 },
499 | { "lightpink2" , 0xeea2ad },
500 | { "lightpink3" , 0xcd8c95 },
501 | { "lightpink4" , 0x8b5f65 },
502 | { "palevioletred1" , 0xff82ab },
503 | { "palevioletred2" , 0xee799f },
504 | { "palevioletred3" , 0xcd6889 },
505 | { "palevioletred4" , 0x8b475d },
506 | { "maroon1" , 0xff34b3 },
507 | { "maroon2" , 0xee30a7 },
508 | { "maroon3" , 0xcd2990 },
509 | { "maroon4" , 0x8b1c62 },
510 | { "violetred1" , 0xff3e96 },
511 | { "violetred2" , 0xee3a8c },
512 | { "violetred3" , 0xcd3278 },
513 | { "violetred4" , 0x8b2252 },
514 | { "magenta1" , 0xff00ff },
515 | { "magenta2" , 0xee00ee },
516 | { "magenta3" , 0xcd00cd },
517 | { "magenta4" , 0x8b008b },
518 | { "orchid1" , 0xff83fa },
519 | { "orchid2" , 0xee7ae9 },
520 | { "orchid3" , 0xcd69c9 },
521 | { "orchid4" , 0x8b4789 },
522 | { "plum1" , 0xffbbff },
523 | { "plum2" , 0xeeaeee },
524 | { "plum3" , 0xcd96cd },
525 | { "plum4" , 0x8b668b },
526 | { "mediumorchid1" , 0xe066ff },
527 | { "mediumorchid2" , 0xd15fee },
528 | { "mediumorchid3" , 0xb452cd },
529 | { "mediumorchid4" , 0x7a378b },
530 | { "darkorchid1" , 0xbf3eff },
531 | { "darkorchid2" , 0xb23aee },
532 | { "darkorchid3" , 0x9a32cd },
533 | { "darkorchid4" , 0x68228b },
534 | { "purple1" , 0x9b30ff },
535 | { "purple2" , 0x912cee },
536 | { "purple3" , 0x7d26cd },
537 | { "purple4" , 0x551a8b },
538 | { "mediumpurple1" , 0xab82ff },
539 | { "mediumpurple2" , 0x9f79ee },
540 | { "mediumpurple3" , 0x8968cd },
541 | { "mediumpurple4" , 0x5d478b },
542 | { "thistle1" , 0xffe1ff },
543 | { "thistle2" , 0xeed2ee },
544 | { "thistle3" , 0xcdb5cd },
545 | { "thistle4" , 0x8b7b8b },
546 | { "gray0" , 0x0 },
547 | { "grey0" , 0x0 },
548 | { "gray1" , 0x30303 },
549 | { "grey1" , 0x30303 },
550 | { "gray2" , 0x50505 },
551 | { "grey2" , 0x50505 },
552 | { "gray3" , 0x80808 },
553 | { "grey3" , 0x80808 },
554 | { "gray4" , 0xa0a0a },
555 | { "grey4" , 0xa0a0a },
556 | { "gray5" , 0xd0d0d },
557 | { "grey5" , 0xd0d0d },
558 | { "gray6" , 0xf0f0f },
559 | { "grey6" , 0xf0f0f },
560 | { "gray7" , 0x121212 },
561 | { "grey7" , 0x121212 },
562 | { "gray8" , 0x141414 },
563 | { "grey8" , 0x141414 },
564 | { "gray9" , 0x171717 },
565 | { "grey9" , 0x171717 },
566 | { "gray10" , 0x1a1a1a },
567 | { "grey10" , 0x1a1a1a },
568 | { "gray11" , 0x1c1c1c },
569 | { "grey11" , 0x1c1c1c },
570 | { "gray12" , 0x1f1f1f },
571 | { "grey12" , 0x1f1f1f },
572 | { "gray13" , 0x212121 },
573 | { "grey13" , 0x212121 },
574 | { "gray14" , 0x242424 },
575 | { "grey14" , 0x242424 },
576 | { "gray15" , 0x262626 },
577 | { "grey15" , 0x262626 },
578 | { "gray16" , 0x292929 },
579 | { "grey16" , 0x292929 },
580 | { "gray17" , 0x2b2b2b },
581 | { "grey17" , 0x2b2b2b },
582 | { "gray18" , 0x2e2e2e },
583 | { "grey18" , 0x2e2e2e },
584 | { "gray19" , 0x303030 },
585 | { "grey19" , 0x303030 },
586 | { "gray20" , 0x333333 },
587 | { "grey20" , 0x333333 },
588 | { "gray21" , 0x363636 },
589 | { "grey21" , 0x363636 },
590 | { "gray22" , 0x383838 },
591 | { "grey22" , 0x383838 },
592 | { "gray23" , 0x3b3b3b },
593 | { "grey23" , 0x3b3b3b },
594 | { "gray24" , 0x3d3d3d },
595 | { "grey24" , 0x3d3d3d },
596 | { "gray25" , 0x404040 },
597 | { "grey25" , 0x404040 },
598 | { "gray26" , 0x424242 },
599 | { "grey26" , 0x424242 },
600 | { "gray27" , 0x454545 },
601 | { "grey27" , 0x454545 },
602 | { "gray28" , 0x474747 },
603 | { "grey28" , 0x474747 },
604 | { "gray29" , 0x4a4a4a },
605 | { "grey29" , 0x4a4a4a },
606 | { "gray30" , 0x4d4d4d },
607 | { "grey30" , 0x4d4d4d },
608 | { "gray31" , 0x4f4f4f },
609 | { "grey31" , 0x4f4f4f },
610 | { "gray32" , 0x525252 },
611 | { "grey32" , 0x525252 },
612 | { "gray33" , 0x545454 },
613 | { "grey33" , 0x545454 },
614 | { "gray34" , 0x575757 },
615 | { "grey34" , 0x575757 },
616 | { "gray35" , 0x595959 },
617 | { "grey35" , 0x595959 },
618 | { "gray36" , 0x5c5c5c },
619 | { "grey36" , 0x5c5c5c },
620 | { "gray37" , 0x5e5e5e },
621 | { "grey37" , 0x5e5e5e },
622 | { "gray38" , 0x616161 },
623 | { "grey38" , 0x616161 },
624 | { "gray39" , 0x636363 },
625 | { "grey39" , 0x636363 },
626 | { "gray40" , 0x666666 },
627 | { "grey40" , 0x666666 },
628 | { "gray41" , 0x696969 },
629 | { "grey41" , 0x696969 },
630 | { "gray42" , 0x6b6b6b },
631 | { "grey42" , 0x6b6b6b },
632 | { "gray43" , 0x6e6e6e },
633 | { "grey43" , 0x6e6e6e },
634 | { "gray44" , 0x707070 },
635 | { "grey44" , 0x707070 },
636 | { "gray45" , 0x737373 },
637 | { "grey45" , 0x737373 },
638 | { "gray46" , 0x757575 },
639 | { "grey46" , 0x757575 },
640 | { "gray47" , 0x787878 },
641 | { "grey47" , 0x787878 },
642 | { "gray48" , 0x7a7a7a },
643 | { "grey48" , 0x7a7a7a },
644 | { "gray49" , 0x7d7d7d },
645 | { "grey49" , 0x7d7d7d },
646 | { "gray50" , 0x7f7f7f },
647 | { "grey50" , 0x7f7f7f },
648 | { "gray51" , 0x828282 },
649 | { "grey51" , 0x828282 },
650 | { "gray52" , 0x858585 },
651 | { "grey52" , 0x858585 },
652 | { "gray53" , 0x878787 },
653 | { "grey53" , 0x878787 },
654 | { "gray54" , 0x8a8a8a },
655 | { "grey54" , 0x8a8a8a },
656 | { "gray55" , 0x8c8c8c },
657 | { "grey55" , 0x8c8c8c },
658 | { "gray56" , 0x8f8f8f },
659 | { "grey56" , 0x8f8f8f },
660 | { "gray57" , 0x919191 },
661 | { "grey57" , 0x919191 },
662 | { "gray58" , 0x949494 },
663 | { "grey58" , 0x949494 },
664 | { "gray59" , 0x969696 },
665 | { "grey59" , 0x969696 },
666 | { "gray60" , 0x999999 },
667 | { "grey60" , 0x999999 },
668 | { "gray61" , 0x9c9c9c },
669 | { "grey61" , 0x9c9c9c },
670 | { "gray62" , 0x9e9e9e },
671 | { "grey62" , 0x9e9e9e },
672 | { "gray63" , 0xa1a1a1 },
673 | { "grey63" , 0xa1a1a1 },
674 | { "gray64" , 0xa3a3a3 },
675 | { "grey64" , 0xa3a3a3 },
676 | { "gray65" , 0xa6a6a6 },
677 | { "grey65" , 0xa6a6a6 },
678 | { "gray66" , 0xa8a8a8 },
679 | { "grey66" , 0xa8a8a8 },
680 | { "gray67" , 0xababab },
681 | { "grey67" , 0xababab },
682 | { "gray68" , 0xadadad },
683 | { "grey68" , 0xadadad },
684 | { "gray69" , 0xb0b0b0 },
685 | { "grey69" , 0xb0b0b0 },
686 | { "gray70" , 0xb3b3b3 },
687 | { "grey70" , 0xb3b3b3 },
688 | { "gray71" , 0xb5b5b5 },
689 | { "grey71" , 0xb5b5b5 },
690 | { "gray72" , 0xb8b8b8 },
691 | { "grey72" , 0xb8b8b8 },
692 | { "gray73" , 0xbababa },
693 | { "grey73" , 0xbababa },
694 | { "gray74" , 0xbdbdbd },
695 | { "grey74" , 0xbdbdbd },
696 | { "gray75" , 0xbfbfbf },
697 | { "grey75" , 0xbfbfbf },
698 | { "gray76" , 0xc2c2c2 },
699 | { "grey76" , 0xc2c2c2 },
700 | { "gray77" , 0xc4c4c4 },
701 | { "grey77" , 0xc4c4c4 },
702 | { "gray78" , 0xc7c7c7 },
703 | { "grey78" , 0xc7c7c7 },
704 | { "gray79" , 0xc9c9c9 },
705 | { "grey79" , 0xc9c9c9 },
706 | { "gray80" , 0xcccccc },
707 | { "grey80" , 0xcccccc },
708 | { "gray81" , 0xcfcfcf },
709 | { "grey81" , 0xcfcfcf },
710 | { "gray82" , 0xd1d1d1 },
711 | { "grey82" , 0xd1d1d1 },
712 | { "gray83" , 0xd4d4d4 },
713 | { "grey83" , 0xd4d4d4 },
714 | { "gray84" , 0xd6d6d6 },
715 | { "grey84" , 0xd6d6d6 },
716 | { "gray85" , 0xd9d9d9 },
717 | { "grey85" , 0xd9d9d9 },
718 | { "gray86" , 0xdbdbdb },
719 | { "grey86" , 0xdbdbdb },
720 | { "gray87" , 0xdedede },
721 | { "grey87" , 0xdedede },
722 | { "gray88" , 0xe0e0e0 },
723 | { "grey88" , 0xe0e0e0 },
724 | { "gray89" , 0xe3e3e3 },
725 | { "grey89" , 0xe3e3e3 },
726 | { "gray90" , 0xe5e5e5 },
727 | { "grey90" , 0xe5e5e5 },
728 | { "gray91" , 0xe8e8e8 },
729 | { "grey91" , 0xe8e8e8 },
730 | { "gray92" , 0xebebeb },
731 | { "grey92" , 0xebebeb },
732 | { "gray93" , 0xededed },
733 | { "grey93" , 0xededed },
734 | { "gray94" , 0xf0f0f0 },
735 | { "grey94" , 0xf0f0f0 },
736 | { "gray95" , 0xf2f2f2 },
737 | { "grey95" , 0xf2f2f2 },
738 | { "gray96" , 0xf5f5f5 },
739 | { "grey96" , 0xf5f5f5 },
740 | { "gray97" , 0xf7f7f7 },
741 | { "grey97" , 0xf7f7f7 },
742 | { "gray98" , 0xfafafa },
743 | { "grey98" , 0xfafafa },
744 | { "gray99" , 0xfcfcfc },
745 | { "grey99" , 0xfcfcfc },
746 | { "gray100" , 0xffffff },
747 | { "grey100" , 0xffffff },
748 | { "dark grey" , 0xa9a9a9 },
749 | { "darkgrey" , 0xa9a9a9 },
750 | { "dark gray" , 0xa9a9a9 },
751 | { "darkgray" , 0xa9a9a9 },
752 | { "dark blue" , 0x8b },
753 | { "darkblue" , 0x8b },
754 | { "dark cyan" , 0x8b8b },
755 | { "darkcyan" , 0x8b8b },
756 | { "dark magenta" , 0x8b008b },
757 | { "darkmagenta" , 0x8b008b },
758 | { "dark red" , 0x8b0000 },
759 | { "darkred" , 0x8b0000 },
760 | { "light green" , 0x90ee90 },
761 | { "lightgreen" , 0x90ee90 },
762 | { "none", -1 },
763 | { 0, 0 }
764 | };
765 |
--------------------------------------------------------------------------------
/mlx_screen_size.c:
--------------------------------------------------------------------------------
1 | #include "mlx_int.h"
2 |
3 | int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey)
4 | {
5 | XWindowAttributes xwAttr;
6 | Status ret;
7 | t_xvar *xvar;
8 |
9 | xvar = mlx_ptr;
10 | ret = XGetWindowAttributes(xvar->display, xvar->root, &xwAttr);
11 | (*sizex) = xwAttr.width;
12 | (*sizey) = xwAttr.height;
13 | }
14 |
--------------------------------------------------------------------------------
/mlx_set_font.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* mlx_set_font.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: amalliar +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2020/09/30 13:30:47 by amalliar #+# #+# */
9 | /* Updated: 2020/09/30 17:08:36 by amalliar ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include "mlx_int.h"
14 |
15 | /*
16 | ** Allows to specify the font that will be used by mlx_string_put.
17 | **
18 | ** Note: only fixed-width bitmap fonts are supported by Xlib, refer to xfontsel
19 | ** utility to get valid font names for this function.
20 | */
21 |
22 | void mlx_set_font(t_xvar *xvar, t_win_list *win, char *name)
23 | {
24 | static Font font = 0;
25 |
26 | if (font)
27 | XUnloadFont(xvar->display, font);
28 | font = XLoadFont(xvar->display, name);
29 | XSetFont(xvar->display, win->gc, font);
30 | }
31 |
--------------------------------------------------------------------------------
/mlx_string_put.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** mlx_string_put.c for MiniLibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Mon Jul 31 19:01:33 2000 Charlie Root
8 | ** Last update Tue Sep 25 17:11:47 2001 Charlie Root
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 |
15 |
16 | int mlx_string_put(t_xvar *xvar,t_win_list *win,
17 | int x,int y,int color,char *string)
18 | {
19 | XGCValues xgcv;
20 |
21 | xgcv.foreground = mlx_int_get_good_color(xvar,color);
22 | XChangeGC(xvar->display,win->gc,GCForeground,&xgcv);
23 | XDrawString(xvar->display,win->window,win->gc,x,y,string,strlen(string));
24 | if (xvar->do_flush)
25 | XFlush(xvar->display);
26 | }
27 |
--------------------------------------------------------------------------------
/mlx_xpm.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** xpm-read.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Dec 11 15:25:27 2001 olivier crouzet
8 | ** Last update Sat Oct 1 14:56:13 2005 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 | extern struct s_col_name mlx_col_name[];
15 |
16 |
17 | #define RETURN { if (colors) free(colors); if (tab) free(tab); \
18 | tab = (void *)0; if (colors_direct) free(colors_direct); \
19 | if (img) {XDestroyImage(img->image); \
20 | XFreePixmap(xvar->display,img->pix);free(img);} \
21 | return ((void *)0);}
22 |
23 |
24 |
25 |
26 | char *mlx_int_get_line(char *ptr,int *pos,int size)
27 | {
28 | int pos2;
29 | int pos3;
30 | int pos4;
31 |
32 | if ((pos2 = mlx_int_str_str(ptr+*pos,"\"",size-*pos))==-1)
33 | return ((char *)0);
34 | if ((pos3 = mlx_int_str_str(ptr+*pos+pos2+1,"\"",size-*pos-pos2-1))==-1)
35 | return ((char *)0);
36 | *(ptr+*pos+pos2) = 0;
37 | *(ptr+*pos+pos2+1+pos3) = 0;
38 | pos4 = *pos+pos2+1;
39 | *pos += pos2+pos3+2;
40 | return (ptr+pos4);
41 | }
42 |
43 |
44 | unsigned int strlcpy_is_not_posix(char *dest, char *src, unsigned int size)
45 | {
46 | unsigned count;
47 | unsigned i;
48 |
49 | count = 0;
50 | while (src[count] != '\0')
51 | ++count;
52 | i = 0;
53 | while (src[i] != '\0' && i < (size - 1))
54 | {
55 | dest[i] = src[i];
56 | ++i;
57 | }
58 | dest[i] = '\0';
59 | return (count);
60 | }
61 |
62 | char *mlx_int_static_line(char **xpm_data,int *pos,int size)
63 | {
64 | static char *copy = 0;
65 | static int len = 0;
66 | int len2;
67 | char *str;
68 |
69 | str = xpm_data[(*pos)++];
70 | if ((len2 = strlen(str))>len)
71 | {
72 | if (copy)
73 | free(copy);
74 | if (!(copy = malloc(len2+1)))
75 | return ((char *)0);
76 | len = len2;
77 | }
78 | strlcpy_is_not_posix(copy, str, len2);
79 |
80 | return (copy);
81 | }
82 |
83 |
84 | int mlx_int_get_col_name(char *str,int size)
85 | {
86 | int result;
87 |
88 | result = 0;
89 | while (size--)
90 | result = (result<<8)+*(str++);
91 |
92 | return (result);
93 | }
94 |
95 | int mlx_int_get_text_rgb(char *name, char *end)
96 | {
97 | int i;
98 | char buff[64];
99 |
100 | if (*name == '#')
101 | return (strtol(name+1,0,16));
102 | if (end)
103 | {
104 | snprintf(buff, 64, "%s %s", name, end);
105 | name = buff;
106 | }
107 | i = 0;
108 | while (mlx_col_name[i].name)
109 | {
110 | if (!strcasecmp(mlx_col_name[i].name, name))
111 | return (mlx_col_name[i].color);
112 | i ++;
113 | }
114 | return (0);
115 | }
116 |
117 |
118 | int mlx_int_xpm_set_pixel(t_img *img, char *data, int opp, int col, int x)
119 | {
120 | int dec;
121 |
122 | dec = opp;
123 | while (dec--)
124 | {
125 | if (img->image->byte_order)
126 | *(data+x*opp+dec) = col&0xFF;
127 | else
128 | *(data+x*opp+opp-dec-1) = col&0xFF;
129 | col >>= 8;
130 | }
131 | }
132 |
133 |
134 | void *mlx_int_parse_xpm(t_xvar *xvar,void *info,int info_size,char *(*f)())
135 | {
136 | int pos;
137 | char *line;
138 | char **tab;
139 | char *data;
140 | char *clip_data;
141 | int nc;
142 | int opp;
143 | int cpp;
144 | int col;
145 | int rgb_col;
146 | int col_name;
147 | int method;
148 | int x;
149 | int i;
150 | int j;
151 | t_img *img;
152 | t_xpm_col *colors;
153 | int *colors_direct;
154 | int width;
155 | int height;
156 | XImage *clip_img;
157 | XGCValues xgcv;
158 | Pixmap clip_pix;
159 |
160 | colors = 0;
161 | colors_direct = 0;
162 | img = 0;
163 | tab = 0;
164 | pos = 0;
165 | if (!(line = f(info,&pos,info_size)) ||
166 | !(tab = mlx_int_str_to_wordtab(line)) || !(width = atoi(tab[0])) ||
167 | !(height = atoi(tab[1])) || !(nc = atoi(tab[2])) ||
168 | !(cpp = atoi(tab[3])) )
169 | RETURN;
170 | free(tab);
171 | tab = 0;
172 |
173 | method = 0;
174 | if (cpp<=2)
175 | {
176 | method = 1;
177 | if (!(colors_direct = malloc((cpp==2?65536:256)*sizeof(int))))
178 | RETURN;
179 | }
180 | else
181 | if (!(colors = malloc(nc*sizeof(*colors))))
182 | RETURN;
183 |
184 | clip_data = 0;
185 |
186 | i = nc;
187 | while (i--)
188 | {
189 | if (!(line = f(info,&pos,info_size)) ||
190 | !(tab = mlx_int_str_to_wordtab(line+cpp)) )
191 | RETURN;
192 | j = 0;
193 | while (tab[j] && strcmp(tab[j++],"c"));
194 |
195 | if (!tab[j])
196 | RETURN;
197 | rgb_col = mlx_int_get_text_rgb(tab[j], tab[j+1]);
198 | /*
199 | if ((rgb_col = mlx_int_get_text_rgb(tab[j], tab[j+1]))==-1)
200 | {
201 | if (!(clip_data = malloc(4*width*height)) || ok, nice size ..
202 | !(clip_img = XCreateImage(xvar->display, xvar->visual,
203 | 1, XYPixmap, 0, clip_data,
204 | width, height, 8, (width+7)/8)) )
205 | RETURN;
206 | memset(clip_data, 0xFF, 4*width*height);
207 | }
208 | */
209 | if (method)
210 | colors_direct[mlx_int_get_col_name(line,cpp)] = rgb_col;
211 | // rgb_col>=0?mlx_get_color_value(xvar, rgb_col):rgb_col;
212 | else
213 | {
214 | colors[i].name = mlx_int_get_col_name(line,cpp);
215 | colors[i].col = rgb_col; //rgb_col>=0?mlx_get_color_value(xvar,rgb_col):rgb_col;
216 | }
217 | free(tab);
218 | tab = (void *)0;
219 | }
220 |
221 | if (!(img = mlx_new_image(xvar,width,height)))
222 | RETURN;
223 | opp = img->bpp/8;
224 |
225 |
226 | i = height;
227 | data = img->data;
228 | while (i--)
229 | {
230 | if (!(line = f(info,&pos,info_size)))
231 | RETURN;
232 | x = 0;
233 | while (xsize_line;
262 | }
263 | /*
264 | if (clip_data)
265 | {
266 | if (!(clip_pix = XCreatePixmap(xvar->display, xvar->root,
267 | width, height, 1)) )
268 | RETURN;
269 | img->gc = XCreateGC(xvar->display, clip_pix, 0, &xgcv);
270 | XPutImage(xvar->display, clip_pix, img->gc, clip_img,
271 | 0, 0, 0, 0, width, height);
272 | XFreeGC(xvar->display, img->gc);
273 | xgcv.clip_mask = clip_pix;
274 | xgcv.function = GXcopy;
275 | xgcv.plane_mask = AllPlanes;
276 | img->gc = XCreateGC(xvar->display, xvar->root, GCClipMask|GCFunction|
277 | GCPlaneMask, &xgcv);
278 | XSync(xvar->display, False);
279 | XDestroyImage(clip_img);
280 | }
281 | */
282 | if (colors)
283 | free(colors);
284 | if (colors_direct)
285 | free(colors_direct);
286 | return (img);
287 | }
288 |
289 |
290 | int mlx_int_file_get_rid_comment(char *ptr, int size)
291 | {
292 | int com_begin;
293 | int com_end;
294 |
295 | while ((com_begin = mlx_int_str_str_cote(ptr,"/*",size))!=-1)
296 | {
297 | com_end = mlx_int_str_str(ptr+com_begin+2,"*/",size-com_begin-2);
298 | memset(ptr+com_begin,' ',com_end+4);
299 | }
300 | while ((com_begin = mlx_int_str_str_cote(ptr,"//",size))!=-1)
301 | {
302 | com_end = mlx_int_str_str(ptr+com_begin+2,"\n",size-com_begin-2);
303 | memset(ptr+com_begin,' ',com_end+3);
304 | }
305 | }
306 |
307 |
308 | void *mlx_xpm_file_to_image(t_xvar *xvar,char *file,int *width,int *height)
309 | {
310 | int fd;
311 | int size;
312 | char *ptr;
313 | t_img *img;
314 |
315 | fd = -1;
316 | if ((fd = open(file,O_RDONLY))==-1 || (size = lseek(fd,0,SEEK_END))==-1 ||
317 | (ptr = mmap(0,size,PROT_WRITE|PROT_READ,MAP_PRIVATE,fd,0))==
318 | (void *)MAP_FAILED)
319 | {
320 | if (fd>=0)
321 | close(fd);
322 | return ((void *)0);
323 | }
324 | mlx_int_file_get_rid_comment(ptr, size);
325 | if (img = mlx_int_parse_xpm(xvar,ptr,size,mlx_int_get_line))
326 | {
327 | *width = img->width;
328 | *height = img->height;
329 | }
330 | munmap(ptr,size);
331 | close(fd);
332 | return (img);
333 | }
334 |
335 | void *mlx_xpm_to_image(t_xvar *xvar,char **xpm_data,int *width,int *height)
336 | {
337 | t_img *img;
338 |
339 | if (img = mlx_int_parse_xpm(xvar,xpm_data,0,mlx_int_static_line))
340 | {
341 | *width = img->width;
342 | *height = img->height;
343 | }
344 | return (img);
345 | }
346 |
--------------------------------------------------------------------------------
/mlx_xpm.c.ok:
--------------------------------------------------------------------------------
1 | /*
2 | ** xpm-read.c for MinilibX in
3 | **
4 | ** Made by Charlie Root
5 | ** Login
6 | **
7 | ** Started on Tue Dec 11 15:25:27 2001 olivier crouzet
8 | ** Last update Sat Oct 1 14:40:55 2005 Olivier Crouzet
9 | */
10 |
11 |
12 | #include "mlx_int.h"
13 |
14 | extern struct s_col_name mlx_col_name[];
15 |
16 |
17 | #define RETURN { if (colors) free(colors); if (tab) free(tab); \
18 | if (colors_direct) free(colors_direct); \
19 | if (img) {XDestroyImage(img->image); \
20 | XFreePixmap(xvar->display,img->pix);free(img);} \
21 | return ((void *)0);}
22 |
23 |
24 |
25 |
26 | char *mlx_int_get_line(char *ptr,int *pos,int size)
27 | {
28 | int pos2;
29 | int pos3;
30 | int pos4;
31 |
32 | if ((pos2 = mlx_int_str_str(ptr+*pos,"\"",size-*pos))==-1)
33 | return ((char *)0);
34 | if ((pos3 = mlx_int_str_str(ptr+*pos+pos2+1,"\"",size-*pos-pos2-1))==-1)
35 | return ((char *)0);
36 | *(ptr+*pos+pos2) = 0;
37 | *(ptr+*pos+pos2+1+pos3) = 0;
38 | pos4 = *pos+pos2+1;
39 | *pos += pos2+pos3+2;
40 | return (ptr+pos4);
41 | }
42 |
43 |
44 |
45 | char *mlx_int_static_line(char **xpm_data,int *pos,int size)
46 | {
47 | static char *copy = 0;
48 | static int len = 0;
49 | int len2;
50 | char *str;
51 |
52 | str = xpm_data[(*pos)++];
53 | if ((len2 = strlen(str))>len)
54 | {
55 | if (copy)
56 | free(copy);
57 | if (!(copy = malloc(len2+1)))
58 | return ((char *)0);
59 | len = len2;
60 | }
61 | /* strcpy(copy,str); */
62 | strlcpy(copy, str, len2+1);
63 | return (copy);
64 | }
65 |
66 |
67 | int mlx_int_get_col_name(char *str,int size)
68 | {
69 | int result;
70 |
71 | result = 0;
72 | while (size--)
73 | result = (result<<8)+*(str++);
74 | return (result);
75 | }
76 |
77 | int mlx_int_get_text_rgb(char *name)
78 | {
79 | int i;
80 |
81 | if (*name == '#')
82 | return (strtol(name+1,0,16));
83 | i = 0;
84 | while (mlx_col_name[i].name)
85 | {
86 | if (!strcasecmp(mlx_col_name[i].name, name))
87 | return (mlx_col_name[i].color);
88 | i ++;
89 | }
90 | return (0);
91 | }
92 |
93 |
94 | int mlx_int_xpm_set_pixel(t_img *img, char *data, int opp, int col, int x)
95 | {
96 | int dec;
97 |
98 | dec = opp;
99 | while (dec--)
100 | {
101 | if (img->image->byte_order)
102 | *(data+x*opp+dec) = col&0xFF;
103 | else
104 | *(data+x*opp+opp-dec-1) = col&0xFF;
105 | col >>= 8;
106 | }
107 | }
108 |
109 |
110 | void *mlx_int_parse_xpm(t_xvar *xvar,void *info,int info_size,char *(*f)())
111 | {
112 | int pos;
113 | char *line;
114 | char **tab;
115 | char *data;
116 | char *clip_data;
117 | int nc;
118 | int opp;
119 | int cpp;
120 | int col;
121 | int rgb_col;
122 | int col_name;
123 | int method;
124 | int x;
125 | int i;
126 | int j;
127 | t_img *img;
128 | t_xpm_col *colors;
129 | int *colors_direct;
130 | int width;
131 | int height;
132 | XImage *clip_img;
133 | XGCValues xgcv;
134 | Pixmap clip_pix;
135 |
136 | colors = 0;
137 | colors_direct = 0;
138 | img = 0;
139 | tab = 0;
140 | pos = 0;
141 | if (!(line = f(info,&pos,info_size)) ||
142 | !(tab = mlx_int_str_to_wordtab(line)) || !(width = atoi(tab[0])) ||
143 | !(height = atoi(tab[1])) || !(nc = atoi(tab[2])) ||
144 | !(cpp = atoi(tab[3])) )
145 | RETURN;
146 | free(tab);
147 | tab = 0;
148 |
149 | method = 0;
150 | if (cpp<=2)
151 | {
152 | method = 1;
153 | if (!(colors_direct = malloc((cpp==2?65536:256)*sizeof(int))))
154 | RETURN;
155 | }
156 | else
157 | if (!(colors = malloc(nc*sizeof(*colors))))
158 | RETURN;
159 |
160 | clip_data = 0;
161 |
162 | i = nc;
163 | while (i--)
164 | {
165 | if (!(line = f(info,&pos,info_size)) ||
166 | !(tab = mlx_int_str_to_wordtab(line+cpp)) )
167 | RETURN;
168 | j = 0;
169 | while (tab[j] && strcmp(tab[j++],"c"));
170 | if (!tab[j])
171 | RETURN;
172 |
173 | if ((rgb_col = mlx_int_get_text_rgb(tab[j]))==-1)
174 | {
175 | if (!(clip_data = malloc(4*width*height)) || /* ok, nice size .. */
176 | !(clip_img = XCreateImage(xvar->display, xvar->visual,
177 | 1, XYPixmap, 0, clip_data,
178 | width, height, 8, (width+7)/8)) )
179 | RETURN;
180 | memset(clip_data, 0xFF, 4*width*height);
181 | }
182 |
183 | if (method)
184 | colors_direct[mlx_int_get_col_name(line,cpp)] =
185 | rgb_col>=0?mlx_get_color_value(xvar, rgb_col):rgb_col;
186 | else
187 | {
188 | colors[i].name = mlx_int_get_col_name(line,cpp);
189 | colors[i].col = rgb_col>=0?mlx_get_color_value(xvar,rgb_col):rgb_col;
190 | }
191 | free(tab);
192 | }
193 |
194 | if (!(img = mlx_new_image(xvar,width,height)))
195 | RETURN;
196 | opp = img->bpp/8;
197 |
198 |
199 | i = height;
200 | data = img->data;
201 | while (i--)
202 | {
203 | if (!(line = f(info,&pos,info_size)))
204 | RETURN;
205 | x = 0;
206 | while (xsize_line;
229 | }
230 | if (clip_data)
231 | {
232 | if (!(clip_pix = XCreatePixmap(xvar->display, xvar->root,
233 | width, height, 1)) )
234 | RETURN;
235 | img->gc = XCreateGC(xvar->display, clip_pix, 0, &xgcv);
236 | XPutImage(xvar->display, clip_pix, img->gc, clip_img,
237 | 0, 0, 0, 0, width, height);
238 | XFreeGC(xvar->display, img->gc);
239 | xgcv.clip_mask = clip_pix;
240 | xgcv.function = GXcopy;
241 | xgcv.plane_mask = AllPlanes;
242 | img->gc = XCreateGC(xvar->display, xvar->root, GCClipMask|GCFunction|
243 | GCPlaneMask, &xgcv);
244 | XSync(xvar->display, False);
245 | XDestroyImage(clip_img);
246 | }
247 | if (colors)
248 | free(colors);
249 | if (colors_direct)
250 | free(colors_direct);
251 | return (img);
252 | }
253 |
254 |
255 | int mlx_int_file_get_rid_comment(char *ptr, int size)
256 | {
257 | int com_begin;
258 | int com_end;
259 |
260 | while ((com_begin = mlx_int_str_str_cote(ptr,"/*",size))!=-1)
261 | {
262 | com_end = mlx_int_str_str(ptr+com_begin+2,"*/",size-com_begin-2);
263 | memset(ptr+com_begin,' ',com_end+4);
264 | }
265 | while ((com_begin = mlx_int_str_str_cote(ptr,"//",size))!=-1)
266 | {
267 | com_end = mlx_int_str_str(ptr+com_begin+2,"\n",size-com_begin-2);
268 | memset(ptr+com_begin,' ',com_end+3);
269 | }
270 | }
271 |
272 |
273 | void *mlx_xpm_file_to_image(t_xvar *xvar,char *file,int *width,int *height)
274 | {
275 | int fd;
276 | int size;
277 | char *ptr;
278 | t_img *img;
279 |
280 | fd = -1;
281 | if ((fd = open(file,O_RDONLY))==-1 || (size = lseek(fd,0,SEEK_END))==-1 ||
282 | (ptr = mmap(0,size,PROT_WRITE|PROT_READ,MAP_PRIVATE,fd,0))==
283 | (void *)MAP_FAILED)
284 | {
285 | if (fd>=0)
286 | close(fd);
287 | return ((void *)0);
288 | }
289 | mlx_int_file_get_rid_comment(ptr, size);
290 | if (img = mlx_int_parse_xpm(xvar,ptr,size,mlx_int_get_line))
291 | {
292 | *width = img->width;
293 | *height = img->height;
294 | }
295 | munmap(ptr,size);
296 | close(fd);
297 | return (img);
298 | }
299 |
300 | void *mlx_xpm_to_image(t_xvar *xvar,char **xpm_data,int *width,int *height)
301 | {
302 | t_img *img;
303 |
304 | if (img = mlx_int_parse_xpm(xvar,xpm_data,0,mlx_int_static_line))
305 | {
306 | *width = img->width;
307 | *height = img->height;
308 | }
309 | return (img);
310 | }
311 |
--------------------------------------------------------------------------------
/rgb2c.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #
3 | ## rgb2c.pl for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
4 | ##
5 | ## Made by Olivier Crouzet
6 | ## Login
7 | ##
8 | ## Started on Tue Oct 5 16:33:46 2004 Olivier Crouzet
9 | ## Last update Tue Oct 5 16:36:11 2004 Olivier Crouzet
10 | ##
11 |
12 |
13 | #
14 | # Generate a .c file with encoded colors, from the XFree86 rgb.txt file.
15 | #
16 |
17 | open(RGB, "/usr/X11/lib/X11/rgb.txt");
18 |
19 |
20 | printf("/*\n** This is a generated file with rgb2c.pl and rgb.txt from\n");
21 | printf("** the XFree86 distribution.\n*/\n\n");
22 | printf("struct s_col_name mlx_col_name[] =\n{\n");
23 |
24 | while ()
25 | {
26 | @tab = split;
27 | if ($tab[0] ne "!")
28 | {
29 | $color = $tab[3];
30 | if ("$tab[4]" ne "")
31 | {
32 | $color = "$tab[3] $tab[4]";
33 | }
34 | printf(" { \"%s\" , 0x%x },\n", $color, $tab[0]*65536+$tab[1]*256+$tab[2]);
35 | }
36 | }
37 |
38 | printf(" { 0, 0 }\n};\n");
39 |
--------------------------------------------------------------------------------
/test/Makefile.mk:
--------------------------------------------------------------------------------
1 |
2 | INC=%%%%
3 |
4 | INCLIB=$(INC)/../lib
5 |
6 | UNAME := $(shell uname)
7 |
8 | CFLAGS= -I$(INC) -O3 -I.. -g
9 |
10 | NAME= mlx-test
11 | SRC = main.c
12 | OBJ = $(SRC:%.c=%.o)
13 |
14 | LFLAGS = -L.. -lmlx -L$(INCLIB) -lXext -lX11 -lm
15 |
16 | ifeq ($(UNAME), Darwin)
17 | # mac
18 | CC = clang
19 | else ifeq ($(UNAME), FreeBSD)
20 | # FreeBSD
21 | CC = clang
22 | else
23 | #Linux and others...
24 | CC = gcc
25 | LFLAGS += -lbsd
26 | endif
27 |
28 | all: $(NAME)
29 |
30 | $(NAME): $(OBJ)
31 | $(CC) -o $(NAME) $(OBJ) $(LFLAGS)
32 |
33 | show:
34 | @printf "UNAME : $(UNAME)\n"
35 | @printf "NAME : $(NAME)\n"
36 | @printf "CC : $(CC)\n"
37 | @printf "CFLAGS : $(CFLAGS)\n"
38 | @printf "LFLAGS : $(LFLAGS)\n"
39 | @printf "SRC :\n $(SRC)\n"
40 | @printf "OBJ :\n $(OBJ)\n"
41 |
42 | clean:
43 | rm -f $(NAME) $(OBJ) *~ core *.core
44 |
45 | re: clean all
46 |
--------------------------------------------------------------------------------
/test/main.c:
--------------------------------------------------------------------------------
1 |
2 | #include "mlx.h"
3 | #include "mlx_int.h"
4 |
5 | #define WIN1_SX 242
6 | #define WIN1_SY 242
7 | #define IM1_SX 42
8 | #define IM1_SY 42
9 | #define IM3_SX 242
10 | #define IM3_SY 242
11 |
12 | void *mlx;
13 | void *win1;
14 | void *win2;
15 | void *win3;
16 | void *im1;
17 | void *im2;
18 | void *im3;
19 | void *im4;
20 | int bpp1;
21 | int bpp2;
22 | int bpp3;
23 | int bpp4;
24 | int sl1;
25 | int sl2;
26 | int sl3;
27 | int sl4;
28 | int endian1;
29 | int endian2;
30 | int endian3;
31 | int endian4;
32 | char *data1;
33 | char *data2;
34 | char *data3;
35 | char *data4;
36 | int xpm1_x;
37 | int xpm1_y;
38 |
39 | int local_endian;
40 |
41 | int color_map_1(void *win,int w,int h);
42 | int color_map_2(unsigned char *data,int bpp,int sl,int w,int h,int endian, int type);
43 |
44 | int expose_win1(void *p)
45 | {
46 | mlx_put_image_to_window(mlx,win1,im3,0,0);
47 | }
48 |
49 | int expose_win2(void *p)
50 | {
51 | mlx_put_image_to_window(mlx,win2,im4,0,0);
52 | mlx_put_image_to_window(mlx,win2,im2,0,0);
53 | }
54 |
55 | int key_win1(int key,void *p)
56 | {
57 | printf("Key in Win1 : %d\n",key);
58 | if (key==0xFF1B)
59 | exit(0);
60 | }
61 |
62 | int key_win2(int key,void *p)
63 | {
64 | printf("Key in Win2 : %d\n",key);
65 | if (key==0xFF1B)
66 | exit(0);
67 | }
68 |
69 | int key_win3(int key,void *p)
70 | {
71 | printf("Key in Win3 : %d\n",key);
72 | if (key==0xFF1B)
73 | mlx_destroy_window(mlx,win3);
74 | }
75 |
76 | int mouse_win1(int button,int x,int y, void *p)
77 | {
78 | printf("Mouse in Win1, button %d at %dx%d.\n",button,x,y);
79 | }
80 |
81 | int mouse_win2(int button,int x,int y, void *p)
82 | {
83 | printf("Mouse in Win2, button %d at %dx%d.\n",button,x,y);
84 | }
85 |
86 | int mouse_win3(int x,int y, void *p)
87 | {
88 | printf("Mouse moving in Win3, at %dx%d.\n",x,y);
89 | }
90 |
91 |
92 | int main()
93 | {
94 | int a;
95 |
96 | printf("MinilibX Test Program\n");
97 | a = 0x11223344;
98 | if (((unsigned char *)&a)[0] == 0x11)
99 | local_endian = 1;
100 | else
101 | local_endian = 0;
102 | printf(" => Local Endian : %d\n",local_endian);
103 |
104 | printf(" => Connection ...");
105 | if (!(mlx = mlx_init()))
106 | {
107 | printf(" !! KO !!\n");
108 | exit(1);
109 | }
110 | printf("OK (use_xshm %d pshm_format %d)\n",((t_xvar *)mlx)->use_xshm,((t_xvar *)mlx)->pshm_format);
111 |
112 | printf(" => Window1 %dx%d \"Title 1\" ...",WIN1_SX,WIN1_SY);
113 | if (!(win1 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title1")))
114 | {
115 | printf(" !! KO !!\n");
116 | exit(1);
117 | }
118 | printf("OK\n");
119 |
120 | printf(" => Colormap sans event ...");
121 | color_map_1(win1,WIN1_SX,WIN1_SY);
122 | printf("OK\n");
123 | sleep(2);
124 |
125 | printf(" => Clear Window ...");
126 | mlx_clear_window(mlx,win1);
127 | printf("OK\n");
128 | sleep(2);
129 |
130 | printf(" => Image1 ZPixmap %dx%d ...",IM1_SX,IM1_SY);
131 | if (!(im1 = mlx_new_image(mlx,IM1_SX,IM1_SY)))
132 | {
133 | printf(" !! KO !!\n");
134 | exit(1);
135 | }
136 | data1 = mlx_get_data_addr(im1,&bpp1,&sl1,&endian1);
137 | printf("OK (bpp1: %d, sizeline1: %d endian: %d type: %d)\n",bpp1,sl1,endian1,
138 | ((t_img *)im1)->type);
139 |
140 | printf(" => Fill Image1 ...");
141 | color_map_2(data1,bpp1,sl1,IM1_SX,IM1_SY,endian1, 1);
142 | printf("OK (pixmap : %d)\n",(int)((t_img *)im1)->pix);
143 |
144 | printf(" => Put Image1 ...");
145 | mlx_put_image_to_window(mlx,win1,im1,20,20);
146 | printf("OK\n");
147 | sleep(2);
148 |
149 | printf(" => Destroy Image1 ... ");
150 | mlx_destroy_image(mlx, im1);
151 | printf("OK\n");
152 | sleep(2);
153 |
154 | printf(" => Image3 ZPixmap %dx%d ...",IM3_SX,IM3_SY);
155 | if (!(im3 = mlx_new_image(mlx,IM3_SX,IM3_SY)))
156 | {
157 | printf(" !! KO !!\n");
158 | exit(1);
159 | }
160 | data3 = mlx_get_data_addr(im3,&bpp3,&sl3,&endian3);
161 | printf("OK (bpp3 %d, sizeline3 %d endian3 %d type %d)\n",bpp3,sl3,endian3,
162 | ((t_img *)im3)->type);
163 |
164 | printf(" => Fill Image3 ...");
165 | color_map_2(data3,bpp3,sl3,IM3_SX,IM3_SY,endian3, 1);
166 | printf("OK (pixmap : %d)\n",(int)((t_img *)im3)->pix);
167 |
168 | printf(" => Put Image3 ...");
169 | mlx_put_image_to_window(mlx,win1,im3,20,20);
170 | printf("OK\n");
171 | sleep(2);
172 |
173 | printf(" => String ...");
174 | mlx_string_put(mlx,win1,5,WIN1_SY/2,0xFF99FF,"String output");
175 | mlx_string_put(mlx,win1,15,WIN1_SY/2+20,0x00FFFF,"MinilibX test");
176 | printf("OK\n");
177 | sleep(2);
178 |
179 | printf(" => Xpm from file ...");
180 | if (!(im2 = mlx_xpm_file_to_image(mlx,"open.xpm",&xpm1_x,&xpm1_y)))
181 | {
182 | printf(" !! KO !!\n");
183 | exit(1);
184 | }
185 | data2 = mlx_get_data_addr(im2,&bpp2,&sl2,&endian2);
186 | printf("OK (xpm %dx%d)(img bpp2: %d, sizeline2: %d endian: %d type: %d)\n",
187 | xpm1_x,xpm1_y,bpp2,sl2,endian2,((t_img *)im2)->type);
188 | sleep(2);
189 |
190 | printf(" => Put xpm ...");
191 | mlx_put_image_to_window(mlx,win1,im2,0,0);
192 | mlx_put_image_to_window(mlx,win1,im2,100,100);
193 | printf("OK\n");
194 | sleep(2);
195 |
196 | printf(" => 2nd window,");
197 | win2 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title2");
198 | if (!(im4 = mlx_new_image(mlx,IM3_SX, IM3_SY)))
199 | {
200 | printf(" !! KO !!\n");
201 | exit(1);
202 | }
203 | data4 = mlx_get_data_addr(im4,&bpp4,&sl4,&endian4);
204 | color_map_2(data4,bpp4,sl4,IM3_SX,IM3_SY,endian4, 2);
205 |
206 | printf(" 3rd window, Installing hooks ...");
207 | win3 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title3");
208 | mlx_expose_hook(win1,expose_win1,0);
209 | mlx_mouse_hook(win1,mouse_win1,0);
210 | mlx_key_hook(win1,key_win1,0);
211 | mlx_expose_hook(win2,expose_win2,0);
212 | mlx_mouse_hook(win2,mouse_win2,0);
213 | mlx_key_hook(win2,key_win2,0);
214 | mlx_key_hook(win3,key_win3,0);
215 |
216 | mlx_hook(win3, MotionNotify, PointerMotionMask, mouse_win3, 0);
217 |
218 | printf("OK\nNow in Loop. Just play. Esc in 3 to destroy, 1&2 to quit.\n");
219 |
220 | mlx_loop(mlx);
221 | }
222 |
223 |
224 | int color_map_1(void *win,int w,int h)
225 | {
226 | int x;
227 | int y;
228 | int color;
229 |
230 | x = w;
231 | while (x--)
232 | {
233 | y = h;
234 | while (y--)
235 | {
236 | color = (x*255)/w+((((w-x)*255)/w)<<16)+(((y*255)/h)<<8);
237 | mlx_pixel_put(mlx,win,x,y,color);
238 | }
239 | }
240 | }
241 |
242 |
243 | int color_map_2(unsigned char *data,int bpp,int sl,int w,int h,int endian, int type)
244 | {
245 | int x;
246 | int y;
247 | int opp;
248 | int dec;
249 | int color;
250 | int color2;
251 | unsigned char *ptr;
252 |
253 | opp = bpp/8;
254 | printf("(opp : %d) ",opp);
255 | y = h;
256 | while (y--)
257 | {
258 | ptr = data+y*sl;
259 | x = w;
260 | while (x--)
261 | {
262 | if (type==2)
263 | color = (y*255)/w+((((w-x)*255)/w)<<16)
264 | +(((y*255)/h)<<8);
265 | else
266 | color = (x*255)/w+((((w-x)*255)/w)<<16)+(((y*255)/h)<<8);
267 | color2 = mlx_get_color_value(mlx,color);
268 | dec = opp;
269 | while (dec--)
270 | if (endian==local_endian)
271 | {
272 | if (endian)
273 | *(ptr+x*opp+dec) = ((unsigned char *)(&color2))[4-opp+dec];
274 | else
275 | *(ptr+x*opp+dec) = ((unsigned char *)(&color2))[dec];
276 | }
277 | else
278 | {
279 | if (endian)
280 | *(ptr+x*opp+dec) = ((unsigned char *)(&color2))[opp-1-dec];
281 | else
282 | *(ptr+x*opp+dec) = ((unsigned char *)(&color2))[3-dec];
283 | }
284 | }
285 | }
286 |
287 | }
288 |
--------------------------------------------------------------------------------
/test/new_win.c:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #include "mlx.h"
5 |
6 |
7 | void *mlx;
8 | void *win1;
9 | void *win2;
10 |
11 |
12 |
13 | int gere_mouse(int x,int y,int button,void*toto)
14 | {
15 | printf("Mouse event - new win\n");
16 | mlx_destroy_window(mlx,win1);
17 | win1 = mlx_new_window(mlx,random()%500,random()%500,"new win");
18 | mlx_mouse_hook(win1,gere_mouse,0);
19 | }
20 |
21 |
22 | int main()
23 | {
24 | srandom(time(0));
25 | mlx = mlx_init();
26 | win1 = mlx_new_window(mlx,300,300,"win1");
27 | win2 = mlx_new_window(mlx,600,600,"win2");
28 | mlx_mouse_hook(win1,gere_mouse,0);
29 | mlx_mouse_hook(win2,gere_mouse,0);
30 | mlx_loop(mlx);
31 | }
32 |
--------------------------------------------------------------------------------
/test/open.xpm:
--------------------------------------------------------------------------------
1 | /* XPM */
2 | static char * open30_2_xpm[] = {
3 | "64 64 1372 2",
4 | " c None",
5 | ". c #08090D",
6 | "+ c #1A1E23",
7 | "@ c #1F2124",
8 | "# c #060809",
9 | "$ c #1A1E21",
10 | "% c #4F606C",
11 | "& c #3D4145",
12 | "* c #868D93",
13 | "= c #454E56",
14 | "- c #627481",
15 | "; c #667C8A",
16 | "> c #2D3031",
17 | ", c #D7E1E7",
18 | "' c #4D5157",
19 | ") c #8997A5",
20 | "! c #282E31",
21 | "~ c #333B41",
22 | "{ c #A5C6DB",
23 | "] c #718C9B",
24 | "^ c #000000",
25 | "/ c #181B1F",
26 | "( c #262828",
27 | "_ c #D2DEE7",
28 | ": c #B8C5D0",
29 | "< c #151719",
30 | "[ c #08090B",
31 | "} c #272B30",
32 | "| c #2D3037",
33 | "1 c #26282C",
34 | "2 c #1A1D1F",
35 | "3 c #B1CADB",
36 | "4 c #56646E",
37 | "5 c #080809",
38 | "6 c #080A0C",
39 | "7 c #1E2126",
40 | "8 c #98B7C9",
41 | "9 c #A2CAE2",
42 | "0 c #7FA1B5",
43 | "a c #06080A",
44 | "b c #252729",
45 | "c c #A7ADB2",
46 | "d c #272B2E",
47 | "e c #1E2023",
48 | "f c #C8D8E5",
49 | "g c #C9DDED",
50 | "h c #8996A3",
51 | "i c #6B7782",
52 | "j c #C7DFF0",
53 | "k c #CCE0F0",
54 | "l c #AFC1CF",
55 | "m c #47535B",
56 | "n c #B0D3E8",
57 | "o c #7E99A9",
58 | "p c #738493",
59 | "q c #97B4C7",
60 | "r c #53606A",
61 | "s c #6E8996",
62 | "t c #A1CBE3",
63 | "u c #9CC6DE",
64 | "v c #90B5CB",
65 | "w c #171D22",
66 | "x c #1E2629",
67 | "y c #020202",
68 | "z c #ABB3BA",
69 | "A c #BBC4C8",
70 | "B c #222323",
71 | "C c #141617",
72 | "D c #5D6164",
73 | "E c #ACB5BC",
74 | "F c #676D74",
75 | "G c #BDD4E5",
76 | "H c #B3D1E7",
77 | "I c #B0D1E7",
78 | "J c #728A99",
79 | "K c #94AEBF",
80 | "L c #B1D1E7",
81 | "M c #505C64",
82 | "N c #7B98A9",
83 | "O c #A1CBE0",
84 | "P c #99C3D9",
85 | "Q c #475863",
86 | "R c #A0C9DE",
87 | "S c #9CC6DA",
88 | "T c #9ECAE1",
89 | "U c #9CC5DD",
90 | "V c #9AC4DC",
91 | "W c #263137",
92 | "X c #3C4A55",
93 | "Y c #658190",
94 | "Z c #66686B",
95 | "` c #7D8085",
96 | " . c #363839",
97 | ".. c #797E81",
98 | "+. c #D2DBE1",
99 | "@. c #DDE9F4",
100 | "#. c #CADEEF",
101 | "$. c #778593",
102 | "%. c #AED0E5",
103 | "&. c #9EC9DE",
104 | "*. c #9EC8DF",
105 | "=. c #9BC1D8",
106 | "-. c #9EC8DE",
107 | ";. c #6B8596",
108 | ">. c #9BC5DC",
109 | ",. c #9BC6DF",
110 | "'. c #9CC5DC",
111 | "). c #688595",
112 | "!. c #6B8698",
113 | "~. c #9CC4DC",
114 | "{. c #9BC4DC",
115 | "]. c #9DC5DD",
116 | "^. c #647D8C",
117 | "/. c #485864",
118 | "(. c #161A1D",
119 | "_. c #36444C",
120 | ":. c #95BDD5",
121 | "<. c #566E7E",
122 | "[. c #A4AAAD",
123 | "}. c #E9F2F7",
124 | "|. c #DEEAF6",
125 | "1. c #B5D4E9",
126 | "2. c #A9CFE3",
127 | "3. c #90B3C9",
128 | "4. c #9FCAE1",
129 | "5. c #9BC4DD",
130 | "6. c #7490A2",
131 | "7. c #99C2DB",
132 | "8. c #81A5BA",
133 | "9. c #9CC5DE",
134 | "0. c #98C1DA",
135 | "a. c #5F7889",
136 | "b. c #96BFD8",
137 | "c. c #44545F",
138 | "d. c #565A5E",
139 | "e. c #DFE6EC",
140 | "f. c #E6EEF7",
141 | "g. c #D6E4F2",
142 | "h. c #BFD6E9",
143 | "i. c #A9CCE3",
144 | "j. c #9FC8DD",
145 | "k. c #9DC6DD",
146 | "l. c #9CC4DD",
147 | "m. c #7D9FB0",
148 | "n. c #98C0D6",
149 | "o. c #9AC5DD",
150 | "p. c #97BFD8",
151 | "q. c #9BC5DF",
152 | "r. c #2D3840",
153 | "s. c #626567",
154 | "t. c #E7ECF5",
155 | "u. c #E1EAF5",
156 | "v. c #CEE3F3",
157 | "w. c #B7D6EA",
158 | "x. c #A4CBE0",
159 | "y. c #8AAFC5",
160 | "z. c #647F90",
161 | "A. c #648092",
162 | "B. c #89B0C7",
163 | "C. c #9CC6DF",
164 | "D. c #5D7486",
165 | "E. c #7B9BAF",
166 | "F. c #84A8BF",
167 | "G. c #9BC5DD",
168 | "H. c #96BED5",
169 | "I. c #4B5D69",
170 | "J. c #9BC5DE",
171 | "K. c #536B77",
172 | "L. c #2E3B41",
173 | "M. c #1B2124",
174 | "N. c #3F4F58",
175 | "O. c #4D5152",
176 | "P. c #E7EEF3",
177 | "Q. c #E2EAF5",
178 | "R. c #CEE2F2",
179 | "S. c #BAD5E9",
180 | "T. c #9DC2D7",
181 | "U. c #5C7281",
182 | "V. c #232A31",
183 | "W. c #08090A",
184 | "X. c #121418",
185 | "Y. c #131619",
186 | "Z. c #131719",
187 | "`. c #87ACC3",
188 | " + c #7B9BAE",
189 | ".+ c #87ADC3",
190 | "++ c #8FB5CB",
191 | "@+ c #678295",
192 | "#+ c #96C0D8",
193 | "$+ c #607787",
194 | "%+ c #6B8595",
195 | "&+ c #96C1DB",
196 | "*+ c #6A8595",
197 | "=+ c #35424A",
198 | "-+ c #7090A1",
199 | ";+ c #15191C",
200 | ">+ c #2D3033",
201 | ",+ c #DDE5EB",
202 | "'+ c #D2E3F1",
203 | ")+ c #BAD7EB",
204 | "!+ c #A9CFE5",
205 | "~+ c #272F35",
206 | "{+ c #1C2227",
207 | "]+ c #4F697B",
208 | "^+ c #6B8FA9",
209 | "/+ c #759CB6",
210 | "(+ c #7BA0BB",
211 | "_+ c #80A5BC",
212 | ":+ c #88B0C8",
213 | "<+ c #96C3DB",
214 | "[+ c #8FB6CD",
215 | "}+ c #80A1B3",
216 | "|+ c #556876",
217 | "1+ c #96BFD7",
218 | "2+ c #566B77",
219 | "3+ c #93B8CD",
220 | "4+ c #637A8D",
221 | "5+ c #9DC6DE",
222 | "6+ c #8FB4CA",
223 | "7+ c #55697A",
224 | "8+ c #6F8F9F",
225 | "9+ c #91BDD5",
226 | "0+ c #283239",
227 | "a+ c #050406",
228 | "b+ c #767B80",
229 | "c+ c #BDC6CE",
230 | "d+ c #D4E5F3",
231 | "e+ c #C1D7EA",
232 | "f+ c #A7CDE4",
233 | "g+ c #9FC9DE",
234 | "h+ c #668596",
235 | "i+ c #6D90AA",
236 | "j+ c #5C7994",
237 | "k+ c #60849F",
238 | "l+ c #6286A1",
239 | "m+ c #688CA8",
240 | "n+ c #7298B2",
241 | "o+ c #82A8C2",
242 | "p+ c #8FBAD5",
243 | "q+ c #96C2DB",
244 | "r+ c #89ADC4",
245 | "s+ c #96BED6",
246 | "t+ c #99C2DA",
247 | "u+ c #6C899A",
248 | "v+ c #92BBD2",
249 | "w+ c #9AC4DD",
250 | "x+ c #5B717D",
251 | "y+ c #9EC6DE",
252 | "z+ c #8BB1C9",
253 | "A+ c #718EA0",
254 | "B+ c #94C3DB",
255 | "C+ c #536B78",
256 | "D+ c #3E505F",
257 | "E+ c #4E6373",
258 | "F+ c #2C333C",
259 | "G+ c #070708",
260 | "H+ c #040404",
261 | "I+ c #1A1C1E",
262 | "J+ c #202326",
263 | "K+ c #050606",
264 | "L+ c #23292E",
265 | "M+ c #A1C0D4",
266 | "N+ c #9FC9DD",
267 | "O+ c #97C2DB",
268 | "P+ c #80A8C1",
269 | "Q+ c #668AA6",
270 | "R+ c #4B5D72",
271 | "S+ c #4C647A",
272 | "T+ c #5F80A0",
273 | "U+ c #60859E",
274 | "V+ c #678AA6",
275 | "W+ c #739BB5",
276 | "X+ c #85AEC7",
277 | "Y+ c #92BDD7",
278 | "Z+ c #96BFD5",
279 | "`+ c #627B8A",
280 | " @ c #89B1C9",
281 | ".@ c #2B353C",
282 | "+@ c #7597B2",
283 | "@@ c #779CB8",
284 | "#@ c #52697C",
285 | "$@ c #1D2328",
286 | "%@ c #445663",
287 | "&@ c #5E7A8D",
288 | "*@ c #252F37",
289 | "=@ c #090909",
290 | "-@ c #859BB2",
291 | ";@ c #859DB8",
292 | ">@ c #6E8396",
293 | ",@ c #252C33",
294 | "'@ c #9CC4D7",
295 | ")@ c #92C0D9",
296 | "!@ c #79A0BA",
297 | "~@ c #6487A3",
298 | "{@ c #566979",
299 | "]@ c #8CB0C2",
300 | "^@ c #51697C",
301 | "/@ c #60849D",
302 | "(@ c #6D8EAC",
303 | "_@ c #7BA0BC",
304 | ":@ c #8AB4CE",
305 | "<@ c #95C2DB",
306 | "[@ c #9AC5DC",
307 | "}@ c #95C1DA",
308 | "|@ c #607B8C",
309 | "1@ c #597488",
310 | "2@ c #7EA6BF",
311 | "3@ c #597587",
312 | "4@ c #455664",
313 | "5@ c #668598",
314 | "6@ c #82A9C4",
315 | "7@ c #617F92",
316 | "8@ c #1A2328",
317 | "9@ c #2B3137",
318 | "0@ c #728FAC",
319 | "a@ c #51657B",
320 | "b@ c #6B8AA8",
321 | "c@ c #8EAEC7",
322 | "d@ c #A8C8E2",
323 | "e@ c #92BDD6",
324 | "f@ c #769DBA",
325 | "g@ c #526E87",
326 | "h@ c #7490A0",
327 | "i@ c #A6CDE4",
328 | "j@ c #97BFD4",
329 | "k@ c #55697D",
330 | "l@ c #6286A0",
331 | "m@ c #7399B3",
332 | "n@ c #84ACC5",
333 | "o@ c #92BFD9",
334 | "p@ c #99C4DC",
335 | "q@ c #94C0DA",
336 | "r@ c #4F6575",
337 | "s@ c #7DA5BF",
338 | "t@ c #7FA2BC",
339 | "u@ c #8FB6CE",
340 | "v@ c #95C3DB",
341 | "w@ c #8EB8D2",
342 | "x@ c #6A879D",
343 | "y@ c #111318",
344 | "z@ c #252A30",
345 | "A@ c #81868C",
346 | "B@ c #A5ABAD",
347 | "C@ c #70767C",
348 | "D@ c #38434F",
349 | "E@ c #637F9B",
350 | "F@ c #516980",
351 | "G@ c #799AB5",
352 | "H@ c #A5C3D9",
353 | "I@ c #93BDD6",
354 | "J@ c #779EBA",
355 | "K@ c #445A6B",
356 | "L@ c #93B5C9",
357 | "M@ c #B6D3E8",
358 | "N@ c #AECFE4",
359 | "O@ c #95BDD2",
360 | "P@ c #52687A",
361 | "Q@ c #6486A3",
362 | "R@ c #7092B0",
363 | "S@ c #90BCD6",
364 | "T@ c #97C4DC",
365 | "U@ c #A0C9E0",
366 | "V@ c #99C5DD",
367 | "W@ c #86AEC6",
368 | "X@ c #8FBAD4",
369 | "Y@ c #91BDD6",
370 | "Z@ c #7094AC",
371 | "`@ c #2A353E",
372 | " # c #0B0E10",
373 | ".# c #888D90",
374 | "+# c #787D82",
375 | "@# c #465360",
376 | "## c #56697F",
377 | "$# c #A6CADD",
378 | "%# c #5A7382",
379 | " c #6C8CAA",
380 | "*# c #A5BED3",
381 | "=# c #A7CAE0",
382 | "-# c #94C1DA",
383 | ";# c #7EA4BF",
384 | "># c #415160",
385 | ",# c #9DC3D5",
386 | "'# c #B3CFE1",
387 | ")# c #AAC3D4",
388 | "!# c #A8CDE4",
389 | "~# c #89ACBE",
390 | "{# c #567088",
391 | "]# c #6C91AC",
392 | "^# c #81A7C2",
393 | "/# c #96C4DC",
394 | "(# c #85A9BD",
395 | "_# c #708C9B",
396 | ":# c #5A6E7B",
397 | "<# c #6C8695",
398 | "[# c #97C3DB",
399 | "}# c #8BB5CE",
400 | "|# c #425461",
401 | "1# c #63819E",
402 | "2# c #415465",
403 | "3# c #0B0D0E",
404 | "4# c #607387",
405 | "5# c #687D8C",
406 | "6# c #B8D6E9",
407 | "7# c #7893A2",
408 | "8# c #576F85",
409 | "9# c #A7BACF",
410 | "0# c #B0CEE5",
411 | "a# c #98C4DC",
412 | "b# c #88B1CA",
413 | "c# c #36444E",
414 | "d# c #8FA0AD",
415 | "e# c #73818D",
416 | "f# c #596D81",
417 | "g# c #B4D0E4",
418 | "h# c #A3CDE2",
419 | "i# c #658296",
420 | "j# c #6A8DAB",
421 | "k# c #7BA5C0",
422 | "l# c #94BAD2",
423 | "m# c #6D899B",
424 | "n# c #99C3DC",
425 | "o# c #8EB9D2",
426 | "p# c #7AA0BA",
427 | "q# c #6C8FAB",
428 | "r# c #6484A1",
429 | "s# c #1F252C",
430 | "t# c #121619",
431 | "u# c #7E96B0",
432 | "v# c #7A8A96",
433 | "w# c #BCD7EA",
434 | "x# c #A0C5D9",
435 | "y# c #3C4B57",
436 | "z# c #A9BACD",
437 | "A# c #BCD5E8",
438 | "B# c #84A6BA",
439 | "C# c #8EA1AE",
440 | "D# c #CFD1D4",
441 | "E# c #ECF6FA",
442 | "F# c #ABB7C2",
443 | "G# c #556F84",
444 | "H# c #57626A",
445 | "I# c #5C7078",
446 | "J# c #6C8AA7",
447 | "K# c #80A6C0",
448 | "L# c #91B8D0",
449 | "M# c #94BFD8",
450 | "N# c #87B0CA",
451 | "O# c #7CA2BB",
452 | "P# c #7097AF",
453 | "Q# c #495E6F",
454 | "R# c #0C0E11",
455 | "S# c #3A3F43",
456 | "T# c #8AA3BB",
457 | "U# c #778592",
458 | "V# c #C0D8EB",
459 | "W# c #B3D5E9",
460 | "X# c #404A53",
461 | "Y# c #B2C2D3",
462 | "Z# c #96A1AC",
463 | "`# c #9DB2C3",
464 | " $ c #AEBECE",
465 | ".$ c #EDEFF3",
466 | "+$ c #F7FAFC",
467 | "@$ c #B6BFC7",
468 | "#$ c #556E85",
469 | "$$ c #121314",
470 | "%$ c #2B2E2F",
471 | "&$ c #555A5E",
472 | "*$ c #3B4C5B",
473 | "=$ c #6F8EA4",
474 | "-$ c #92BED8",
475 | ";$ c #9DC7DF",
476 | ">$ c #87ACC1",
477 | ",$ c #546A78",
478 | "'$ c #516874",
479 | ")$ c #4E6570",
480 | "!$ c #4D6271",
481 | "~$ c #4C6271",
482 | "{$ c #4E677A",
483 | "]$ c #38454E",
484 | "^$ c #6C7278",
485 | "/$ c #86A1B6",
486 | "($ c #5C656C",
487 | "_$ c #A4B0BA",
488 | ":$ c #555D64",
489 | "<$ c #657178",
490 | "[$ c #A6B0B5",
491 | "}$ c #939CA1",
492 | "|$ c #D4E4F1",
493 | "1$ c #A0BACE",
494 | "2$ c #B9C7D7",
495 | "3$ c #F6F7F9",
496 | "4$ c #C6CED1",
497 | "5$ c #506A7C",
498 | "6$ c #060607",
499 | "7$ c #676A6B",
500 | "8$ c #91999F",
501 | "9$ c #7CA3BE",
502 | "0$ c #96BCD4",
503 | "a$ c #5B717E",
504 | "b$ c #4B5F6C",
505 | "c$ c #455864",
506 | "d$ c #5B717F",
507 | "e$ c #81A5B9",
508 | "f$ c #98C4DD",
509 | "g$ c #93BFD8",
510 | "h$ c #87B1CA",
511 | "i$ c #7BA1BC",
512 | "j$ c #5A7489",
513 | "k$ c #222A33",
514 | "l$ c #838A92",
515 | "m$ c #9DADBC",
516 | "n$ c #ECF0F5",
517 | "o$ c #F1F9FB",
518 | "p$ c #818A8D",
519 | "q$ c #4A5155",
520 | "r$ c #6A6F72",
521 | "s$ c #7E898F",
522 | "t$ c #E6F1F7",
523 | "u$ c #CADCED",
524 | "v$ c #A0B7CC",
525 | "w$ c #C6D1DF",
526 | "x$ c #AFB3B4",
527 | "y$ c #5F707D",
528 | "z$ c #CBCFD1",
529 | "A$ c #F4F5F6",
530 | "B$ c #66737F",
531 | "C$ c #87B2CB",
532 | "D$ c #90B7CD",
533 | "E$ c #596E7B",
534 | "F$ c #586F7E",
535 | "G$ c #8BB0C8",
536 | "H$ c #91BED6",
537 | "I$ c #83ADC7",
538 | "J$ c #6D8EA7",
539 | "K$ c #3F5161",
540 | "L$ c #2D3A45",
541 | "M$ c #1F2020",
542 | "N$ c #BDC5CC",
543 | "O$ c #E0EDF5",
544 | "P$ c #BBCAD8",
545 | "Q$ c #E1E4E7",
546 | "R$ c #5E6368",
547 | "S$ c #5B5F62",
548 | "T$ c #D9E7F3",
549 | "U$ c #A4C3D6",
550 | "V$ c #89A3B3",
551 | "W$ c #7B91A1",
552 | "X$ c #627990",
553 | "Y$ c #42505A",
554 | "Z$ c #CACCCE",
555 | "`$ c #F9F9F9",
556 | " % c #FDFDFD",
557 | ".% c #BCBEC0",
558 | "+% c #5C7689",
559 | "@% c #8DB9D3",
560 | "#% c #8FB5CC",
561 | "$% c #536471",
562 | "%% c #98C1D9",
563 | "&% c #91BED7",
564 | "*% c #81AAC5",
565 | "=% c #597386",
566 | "-% c #41535F",
567 | ";% c #6486A2",
568 | ">% c #4D667D",
569 | ",% c #070809",
570 | "'% c #44484E",
571 | ")% c #BEC8D0",
572 | "!% c #8096A6",
573 | "~% c #516473",
574 | "{% c #A9ACAF",
575 | "]% c #8B8F91",
576 | "^% c #A8B3BD",
577 | "/% c #C5DAEB",
578 | "(% c #9FC8E1",
579 | "_% c #8FBCD6",
580 | ":% c #81A8C2",
581 | "<% c #6C90AC",
582 | "[% c #56728C",
583 | "}% c #585B5F",
584 | "|% c #CBCDCD",
585 | "1% c #C1C3C6",
586 | "2% c #4F565F",
587 | "3% c #82ABC3",
588 | "4% c #93BCD3",
589 | "5% c #95BED7",
590 | "6% c #8EB9D3",
591 | "7% c #5B788B",
592 | "8% c #627E91",
593 | "9% c #7FA7C1",
594 | "0% c #6C91AB",
595 | "a% c #546F87",
596 | "b% c #6F7376",
597 | "c% c #D5E2EF",
598 | "d% c #A9C4D8",
599 | "e% c #81A1BA",
600 | "f% c #333940",
601 | "g% c #5F6B76",
602 | "h% c #C0D5E8",
603 | "i% c #AACCE2",
604 | "j% c #8EB8D3",
605 | "k% c #7FA5BF",
606 | "l% c #7095B0",
607 | "m% c #4E697E",
608 | "n% c #07090A",
609 | "o% c #0D0F10",
610 | "p% c #7193A6",
611 | "q% c #96C3DC",
612 | "r% c #8EBCD7",
613 | "s% c #91BDD7",
614 | "t% c #8FBBD6",
615 | "u% c #7699AD",
616 | "v% c #4D626F",
617 | "w% c #252D33",
618 | "x% c #101215",
619 | "y% c #0C0D0E",
620 | "z% c #0A0C0E",
621 | "A% c #06090A",
622 | "B% c #7F8488",
623 | "C% c #D7E3F1",
624 | "D% c #B6D0E4",
625 | "E% c #A3C2D7",
626 | "F% c #596872",
627 | "G% c #A9BED0",
628 | "H% c #B4D0E5",
629 | "I% c #9EC8DC",
630 | "J% c #8FB9D4",
631 | "K% c #85ADC7",
632 | "L% c #7FA4BE",
633 | "M% c #4B606F",
634 | "N% c #4E6372",
635 | "O% c #89B6D0",
636 | "P% c #92C1DA",
637 | "Q% c #9DC7DD",
638 | "R% c #95C0DA",
639 | "S% c #94BED8",
640 | "T% c #8BB8D1",
641 | "U% c #7AA0B9",
642 | "V% c #4E667A",
643 | "W% c #344151",
644 | "X% c #0C0D0F",
645 | "Y% c #8A8F92",
646 | "Z% c #D4E6F5",
647 | "`% c #BCD5E9",
648 | " & c #8599A5",
649 | ".& c #939DA6",
650 | "+& c #C4DAEB",
651 | "@& c #89A6B9",
652 | "#& c #7D9FB5",
653 | "$& c #98C3DC",
654 | "%& c #95C0D9",
655 | "&& c #7CA2B9",
656 | "*& c #7697AE",
657 | "=& c #698498",
658 | "-& c #7394A8",
659 | ";& c #9EC7DF",
660 | ">& c #8DB1C4",
661 | ",& c #6B8594",
662 | "'& c #50636C",
663 | ")& c #50626C",
664 | "!& c #7F9FB1",
665 | "~& c #93B8D0",
666 | "{& c #627A88",
667 | "]& c #90B6CC",
668 | "^& c #93BDD7",
669 | "/& c #87AFC9",
670 | "(& c #7291A7",
671 | "_& c #384651",
672 | ":& c #121618",
673 | "<& c #12171B",
674 | "[& c #4F6986",
675 | "}& c #597998",
676 | "|& c #324052",
677 | "1& c #969CA1",
678 | "2& c #D6E6F5",
679 | "3& c #C6DCEE",
680 | "4& c #505A64",
681 | "5& c #82929F",
682 | "6& c #99ABBB",
683 | "7& c #A1B9CA",
684 | "8& c #87A0B0",
685 | "9& c #718EA1",
686 | "0& c #8DB2C9",
687 | "a& c #8BAEC4",
688 | "b& c #586D7D",
689 | "c& c #97C0D9",
690 | "d& c #8DB3C9",
691 | "e& c #95B8CD",
692 | "f& c #9DC0D6",
693 | "g& c #6F8B9C",
694 | "h& c #354249",
695 | "i& c #464E54",
696 | "j& c #8A98A5",
697 | "k& c #AABAC7",
698 | "l& c #86939E",
699 | "m& c #41494F",
700 | "n& c #4A5861",
701 | "o& c #97C1DA",
702 | "p& c #5E7888",
703 | "q& c #5C7482",
704 | "r& c #88ACC2",
705 | "s& c #91BFD7",
706 | "t& c #799CB5",
707 | "u& c #47596A",
708 | "v& c #0D0F12",
709 | "w& c #1A2127",
710 | "x& c #56778D",
711 | "y& c #688BA9",
712 | "z& c #5D7F9E",
713 | "A& c #547391",
714 | "B& c #0E1013",
715 | "C& c #9DA6AB",
716 | "D& c #C8DCED",
717 | "E& c #7A8996",
718 | "F& c #B5CEE0",
719 | "G& c #BCDBEC",
720 | "H& c #B9D5EA",
721 | "I& c #8BA2B2",
722 | "J& c #6C8A9D",
723 | "K& c #97BFD7",
724 | "L& c #3E4E59",
725 | "M& c #92B5CB",
726 | "N& c #535F68",
727 | "O& c #454F56",
728 | "P& c #6F7C87",
729 | "Q& c #ABC0D1",
730 | "R& c #C7DCEE",
731 | "S& c #C5DBED",
732 | "T& c #C2D7EA",
733 | "U& c #BFD8EA",
734 | "V& c #BCD7EB",
735 | "W& c #62717B",
736 | "X& c #5B6F7B",
737 | "Y& c #95C3DC",
738 | "Z& c #8BB2C9",
739 | "`& c #485761",
740 | " * c #42525F",
741 | ".* c #6686A1",
742 | "+* c #587896",
743 | "@* c #1B2129",
744 | "#* c #5C7A94",
745 | "$* c #7DA2BD",
746 | "%* c #84AEC7",
747 | "&* c #749BB5",
748 | "** c #5C7E9C",
749 | "=* c #27343F",
750 | "-* c #A4A9B2",
751 | ";* c #D9E7F4",
752 | ">* c #C8DBEC",
753 | ",* c #B1C8DA",
754 | "'* c #5D6C76",
755 | ")* c #A8C5D8",
756 | "!* c #A6BDD0",
757 | "~* c #B9D6EA",
758 | "{* c #B9D4E9",
759 | "]* c #8198A8",
760 | "^* c #8AADC3",
761 | "/* c #8CB1CA",
762 | "(* c #96C2D8",
763 | "_* c #A3C7DF",
764 | ":* c #ADCDE3",
765 | "<* c #ABD0E4",
766 | "[* c #ADCFE3",
767 | "}* c #AACEE4",
768 | "|* c #A4CDE3",
769 | "1* c #A1CBE1",
770 | "2* c #A3CCE3",
771 | "3* c #A2C9DF",
772 | "4* c #41515A",
773 | "5* c #81A2B5",
774 | "6* c #94C0D7",
775 | "7* c #5E7789",
776 | "8* c #526777",
777 | "9* c #516777",
778 | "0* c #6B8CA5",
779 | "a* c #759CBA",
780 | "b* c #658AA5",
781 | "c* c #587798",
782 | "d* c #1B242B",
783 | "e* c #0E1110",
784 | "f* c #101214",
785 | "g* c #202931",
786 | "h* c #59758E",
787 | "i* c #799FBB",
788 | "j* c #84B1CA",
789 | "k* c #86ACC6",
790 | "l* c #354758",
791 | "m* c #A0A6AE",
792 | "n* c #DAE6F2",
793 | "o* c #C4DCEE",
794 | "p* c #B4D2E8",
795 | "q* c #3E4A53",
796 | "r* c #698091",
797 | "s* c #5D7581",
798 | "t* c #A3CAE0",
799 | "u* c #A6CFE5",
800 | "v* c #A5CCE5",
801 | "w* c #718A9C",
802 | "x* c #98C3DB",
803 | "y* c #83ABC7",
804 | "z* c #2E3B46",
805 | "A* c #33414A",
806 | "B* c #678398",
807 | "C* c #8AB3CE",
808 | "D* c #93BED7",
809 | "E* c #97C4DB",
810 | "F* c #42525E",
811 | "G* c #88ACC0",
812 | "H* c #789EB9",
813 | "I* c #7A9FBB",
814 | "J* c #7EA2BD",
815 | "K* c #779DB5",
816 | "L* c #577081",
817 | "M* c #5B7B9B",
818 | "N* c #1D2229",
819 | "O* c #547390",
820 | "P* c #54728D",
821 | "Q* c #6082A0",
822 | "R* c #688EA9",
823 | "S* c #6689A7",
824 | "T* c #6086A0",
825 | "U* c #6285A1",
826 | "V* c #6B8DAA",
827 | "W* c #718FAB",
828 | "X* c #3E5568",
829 | "Y* c #969DA1",
830 | "Z* c #DBE8F4",
831 | "`* c #95ACBD",
832 | " = c #758B9A",
833 | ".= c #A4C9DE",
834 | "+= c #698190",
835 | "@= c #667E8A",
836 | "#= c #7D99AA",
837 | "$= c #7B9BAD",
838 | "%= c #6F8C9A",
839 | "&= c #536976",
840 | "*= c #84ADC6",
841 | "== c #6D92AD",
842 | "-= c #62829E",
843 | ";= c #43576A",
844 | ">= c #2F3B46",
845 | ",= c #5C788A",
846 | "'= c #86AFC8",
847 | ")= c #93BED8",
848 | "!= c #93BAD5",
849 | "~= c #93BAD2",
850 | "{= c #92BCD4",
851 | "]= c #7EA2B6",
852 | "^= c #3D4D56",
853 | "/= c #485B67",
854 | "(= c #7596A9",
855 | "_= c #8CBBD4",
856 | ":= c #90BCD5",
857 | "<= c #91BFD9",
858 | "[= c #789BAD",
859 | "}= c #465B6A",
860 | "|= c #59789A",
861 | "1= c #5D7F9D",
862 | "2= c #5E839C",
863 | "3= c #59799A",
864 | "4= c #415569",
865 | "5= c #2D3A46",
866 | "6= c #2E3B49",
867 | "7= c #4A647C",
868 | "8= c #587690",
869 | "9= c #39485A",
870 | "0= c #7F8589",
871 | "a= c #D9E8F5",
872 | "b= c #CCDEEE",
873 | "c= c #8597A5",
874 | "d= c #B3D2E3",
875 | "e= c #9BB3C4",
876 | "f= c #B2CEE1",
877 | "g= c #B2D1E7",
878 | "h= c #ABCFE6",
879 | "i= c #94B7CB",
880 | "j= c #495C6A",
881 | "k= c #688498",
882 | "l= c #617B8A",
883 | "m= c #85ADC8",
884 | "n= c #78A0B9",
885 | "o= c #62819B",
886 | "p= c #2E3843",
887 | "q= c #485A6C",
888 | "r= c #67889C",
889 | "s= c #8AB5CF",
890 | "t= c #8EB9D1",
891 | "u= c #6C899B",
892 | "v= c #6E91A7",
893 | "w= c #678399",
894 | "x= c #6888A1",
895 | "y= c #323E48",
896 | "z= c #5B7585",
897 | "A= c #98C5DD",
898 | "B= c #83ACC1",
899 | "C= c #2D373F",
900 | "D= c #4B637C",
901 | "E= c #567694",
902 | "F= c #26313C",
903 | "G= c #15191F",
904 | "H= c #4D647A",
905 | "I= c #252F39",
906 | "J= c #5D6163",
907 | "K= c #DDE9F5",
908 | "L= c #CEDFEE",
909 | "M= c #8898A5",
910 | "N= c #B0CBDC",
911 | "O= c #BFDAEC",
912 | "P= c #BFDBEC",
913 | "Q= c #BBDAEC",
914 | "R= c #BAD7EA",
915 | "S= c #6B808F",
916 | "T= c #7297B0",
917 | "U= c #8CB8D1",
918 | "V= c #95C1D9",
919 | "W= c #91BCD6",
920 | "X= c #86AEC8",
921 | "Y= c #7496B3",
922 | "Z= c #6587A2",
923 | "`= c #384958",
924 | " - c #323F4B",
925 | ".- c #546A7C",
926 | "+- c #6C88A1",
927 | "@- c #779AB1",
928 | "#- c #658297",
929 | "$- c #3B4A58",
930 | "%- c #33404B",
931 | "&- c #202830",
932 | "*- c #577287",
933 | "=- c #86B1CC",
934 | "-- c #86ACC0",
935 | ";- c #6E8797",
936 | ">- c #9CC7DF",
937 | ",- c #92BCD5",
938 | "'- c #91BCD5",
939 | ")- c #8EB6CE",
940 | "!- c #344453",
941 | "~- c #263039",
942 | "{- c #364452",
943 | "]- c #2B3643",
944 | "^- c #2A2D2E",
945 | "/- c #E1EBF4",
946 | "(- c #D2E4F3",
947 | "_- c #A0B2C3",
948 | ":- c #8094A1",
949 | "<- c #BAD8EB",
950 | "[- c #B8D6EA",
951 | "}- c #485A6A",
952 | "|- c #789FB9",
953 | "1- c #90BBD3",
954 | "2- c #94C4DC",
955 | "3- c #88B3CD",
956 | "4- c #7A9EB9",
957 | "5- c #698BA8",
958 | "6- c #4D677C",
959 | "7- c #151A1E",
960 | "8- c #1A2125",
961 | "9- c #171C21",
962 | "0- c #1D2329",
963 | "a- c #1D262E",
964 | "b- c #486073",
965 | "c- c #6A8CAA",
966 | "d- c #7CA2BE",
967 | "e- c #90BDD7",
968 | "f- c #9AC5DE",
969 | "g- c #7493A2",
970 | "h- c #708B99",
971 | "i- c #8CB7D1",
972 | "j- c #7494AB",
973 | "k- c #68889F",
974 | "l- c #6A8FA5",
975 | "m- c #7BA2BC",
976 | "n- c #171D21",
977 | "o- c #1D262F",
978 | "p- c #212B36",
979 | "q- c #09090B",
980 | "r- c #BBC2C9",
981 | "s- c #D4E4F2",
982 | "t- c #C1D9EB",
983 | "u- c #44515A",
984 | "v- c #92B5C9",
985 | "w- c #6B8795",
986 | "x- c #4E687E",
987 | "y- c #7EA6C0",
988 | "z- c #91BED8",
989 | "A- c #93BFD9",
990 | "B- c #8CB5D0",
991 | "C- c #7DA4BE",
992 | "D- c #6F92AE",
993 | "E- c #6687A5",
994 | "F- c #526C85",
995 | "G- c #415669",
996 | "H- c #384655",
997 | "I- c #6589A4",
998 | "J- c #6E92AE",
999 | "K- c #80A8C2",
1000 | "L- c #92BCD6",
1001 | "M- c #91BFD8",
1002 | "N- c #799AAF",
1003 | "O- c #6A8796",
1004 | "P- c #81AAC3",
1005 | "Q- c #577187",
1006 | "R- c #1F2930",
1007 | "S- c #192027",
1008 | "T- c #1B2227",
1009 | "U- c #0D1010",
1010 | "V- c #0E1012",
1011 | "W- c #070709",
1012 | "X- c #5C6062",
1013 | "Y- c #DCE8F3",
1014 | "Z- c #C4DCEF",
1015 | "`- c #9BB3C6",
1016 | " ; c #3A424F",
1017 | ".; c #313A44",
1018 | "+; c #35424C",
1019 | "@; c #374655",
1020 | "#; c #6E91AD",
1021 | "$; c #87B2CC",
1022 | "%; c #799EBA",
1023 | "&; c #618298",
1024 | "*; c #7095AF",
1025 | "=; c #435663",
1026 | "-; c #80A7C0",
1027 | ";; c #95C4DC",
1028 | ">; c #779CB3",
1029 | ",; c #526D7E",
1030 | "'; c #516A7A",
1031 | "); c #526B7B",
1032 | "!; c #465764",
1033 | "~; c #34414E",
1034 | "{; c #5C7E9A",
1035 | "]; c #2B3741",
1036 | "^; c #4B657F",
1037 | "/; c #5C7D9C",
1038 | "(; c #557088",
1039 | "_; c #0F0F10",
1040 | ":; c #B9C2CA",
1041 | "<; c #CCDFEF",
1042 | "[; c #B4CDE1",
1043 | "}; c #8DAEC8",
1044 | "|; c #6F93AE",
1045 | "1; c #678CA6",
1046 | "2; c #6E92AF",
1047 | "3; c #81A8C1",
1048 | "4; c #8FBBD5",
1049 | "5; c #8DB9D2",
1050 | "6; c #6D8FA2",
1051 | "7; c #586F82",
1052 | "8; c #394851",
1053 | "9; c #86B0C6",
1054 | "0; c #85AFC8",
1055 | "a; c #6F94AF",
1056 | "b; c #698DA8",
1057 | "c; c #6889A7",
1058 | "d; c #5E7E9F",
1059 | "e; c #475D75",
1060 | "f; c #2E3C4A",
1061 | "g; c #5D7E9D",
1062 | "h; c #405465",
1063 | "i; c #36393B",
1064 | "j; c #D7E5F1",
1065 | "k; c #A4C5DC",
1066 | "l; c #668496",
1067 | "m; c #7595AB",
1068 | "n; c #7798AE",
1069 | "o; c #97C2DA",
1070 | "p; c #789DB3",
1071 | "q; c #8BB1C8",
1072 | "r; c #93C0D9",
1073 | "s; c #8BB5CF",
1074 | "t; c #85AFC9",
1075 | "u; c #82AAC6",
1076 | "v; c #5F7C95",
1077 | "w; c #1E252C",
1078 | "x; c #54728E",
1079 | "y; c #587899",
1080 | "z; c #5A7B9B",
1081 | "A; c #2D3843",
1082 | "B; c #798086",
1083 | "C; c #D1E3F1",
1084 | "D; c #B7D3E8",
1085 | "E; c #7E98AB",
1086 | "F; c #181C1F",
1087 | "G; c #46525F",
1088 | "H; c #80A1B8",
1089 | "I; c #99C3DB",
1090 | "J; c #85ACC2",
1091 | "K; c #21272D",
1092 | "L; c #0A0B0D",
1093 | "M; c #53718C",
1094 | "N; c #577797",
1095 | "O; c #1B2229",
1096 | "P; c #0D0E0F",
1097 | "Q; c #B3BDC4",
1098 | "R; c #CADDED",
1099 | "S; c #B4D3E7",
1100 | "T; c #2B3339",
1101 | "U; c #2F3840",
1102 | "V; c #7899AC",
1103 | "W; c #93C1D9",
1104 | "X; c #8FBCD5",
1105 | "Y; c #8BB6D1",
1106 | "Z; c #8DB8D2",
1107 | "`; c #92BFD8",
1108 | " > c #678092",
1109 | ".> c #547089",
1110 | "+> c #5C7F9B",
1111 | "@> c #1F262E",
1112 | "#> c #202223",
1113 | "$> c #B1BECB",
1114 | "%> c #C3D9EB",
1115 | "&> c #7B8D99",
1116 | "*> c #708B9A",
1117 | "=> c #85ABC1",
1118 | "-> c #7FA3BA",
1119 | ";> c #92BBD3",
1120 | ">> c #7CA0B4",
1121 | ",> c #97BDD4",
1122 | "'> c #657E8F",
1123 | ")> c #93BDD4",
1124 | "!> c #88ADC7",
1125 | "~> c #6F94AE",
1126 | "{> c #526A7E",
1127 | "]> c #65849B",
1128 | "^> c #799DBB",
1129 | "/> c #84AFC9",
1130 | "(> c #8FB9D2",
1131 | "_> c #323C45",
1132 | ":> c #516C84",
1133 | "<> c #658AA4",
1134 | "[> c #5B7C9B",
1135 | "}> c #2E3A49",
1136 | "|> c #2A3038",
1137 | "1> c #252D3A",
1138 | "2> c #1B1E20",
1139 | "3> c #ADBFCF",
1140 | "4> c #C0D6E7",
1141 | "5> c #B0CDE2",
1142 | "6> c #8EB3C9",
1143 | "7> c #526975",
1144 | "8> c #6B899D",
1145 | "9> c #597183",
1146 | "0> c #90BAD5",
1147 | "a> c #94C2DA",
1148 | "b> c #82ABC5",
1149 | "c> c #495E6E",
1150 | "d> c #82A8C3",
1151 | "e> c #81A4BA",
1152 | "f> c #7594A5",
1153 | "g> c #87ABC3",
1154 | "h> c #4D6573",
1155 | "i> c #6689A6",
1156 | "j> c #526E85",
1157 | "k> c #243037",
1158 | "l> c #607B96",
1159 | "m> c #7699B6",
1160 | "n> c #789EB5",
1161 | "o> c #303D48",
1162 | "p> c #7498B4",
1163 | "q> c #7094AF",
1164 | "r> c #597792",
1165 | "s> c #242F39",
1166 | "t> c #1A1D25",
1167 | "u> c #374553",
1168 | "v> c #4D677D",
1169 | "w> c #14191E",
1170 | "x> c #040505",
1171 | "y> c #171A1D",
1172 | "z> c #8A9FAD",
1173 | "A> c #BCD9EC",
1174 | "B> c #B5D3E7",
1175 | "C> c #A2CAE1",
1176 | "D> c #9DC7DE",
1177 | "E> c #9EC7DD",
1178 | "F> c #3B4A57",
1179 | "G> c #455867",
1180 | "H> c #98C2DB",
1181 | "I> c #85B0CC",
1182 | "J> c #7496B2",
1183 | "K> c #4C606F",
1184 | "L> c #6E8EA3",
1185 | "M> c #7EA0B6",
1186 | "N> c #91BBD3",
1187 | "O> c #8DB7D1",
1188 | "P> c #90BAD4",
1189 | "Q> c #96C1DA",
1190 | "R> c #3B4853",
1191 | "S> c #688AA5",
1192 | "T> c #4C657A",
1193 | "U> c #1B2026",
1194 | "V> c #2B3C44",
1195 | "W> c #5F7A90",
1196 | "X> c #587284",
1197 | "Y> c #536978",
1198 | "Z> c #88B1CC",
1199 | "`> c #759AB8",
1200 | " , c #617E9A",
1201 | "., c #556F85",
1202 | "+, c #20272E",
1203 | "@, c #323D48",
1204 | "#, c #333E4A",
1205 | "$, c #060707",
1206 | "%, c #4A5159",
1207 | "&, c #ACC3D5",
1208 | "*, c #ACCFE5",
1209 | "=, c #5A6874",
1210 | "-, c #AACDE1",
1211 | ";, c #9CC6DC",
1212 | ">, c #35414C",
1213 | ",, c #769AB2",
1214 | "', c #80AAC5",
1215 | "), c #6F92AB",
1216 | "!, c #38464F",
1217 | "~, c #7EA4B9",
1218 | "{, c #97C3DC",
1219 | "], c #7A9FB6",
1220 | "^, c #3F505C",
1221 | "/, c #6D8DA6",
1222 | "(, c #1E282E",
1223 | "_, c #080909",
1224 | ":, c #090A0C",
1225 | "<, c #344452",
1226 | "[, c #3B4857",
1227 | "}, c #7799AE",
1228 | "|, c #8DB6D1",
1229 | "1, c #66869E",
1230 | "2, c #3D4957",
1231 | "3, c #536C84",
1232 | "4, c #353F4C",
1233 | "5, c #111215",
1234 | "6, c #65727E",
1235 | "7, c #A6BCCD",
1236 | "8, c #5D6972",
1237 | "9, c #AED0E6",
1238 | "0, c #99C5DC",
1239 | "a, c #8DB5D0",
1240 | "b, c #8DB5CE",
1241 | "c, c #90BBD5",
1242 | "d, c #84AAC5",
1243 | "e, c #8EBBD5",
1244 | "f, c #80A7C1",
1245 | "g, c #6C8DA2",
1246 | "h, c #85AFC6",
1247 | "i, c #61839B",
1248 | "j, c #374352",
1249 | "k, c #576D83",
1250 | "l, c #80A6C1",
1251 | "m, c #81A4BB",
1252 | "n, c #111315",
1253 | "o, c #111418",
1254 | "p, c #4C6378",
1255 | "q, c #33424C",
1256 | "r, c #37454D",
1257 | "s, c #8DB4CF",
1258 | "t, c #7397B3",
1259 | "u, c #3A495A",
1260 | "v, c #0D0F13",
1261 | "w, c #27303A",
1262 | "x, c #272E36",
1263 | "y, c #0F1012",
1264 | "z, c #90A4B2",
1265 | "A, c #A8CBE2",
1266 | "B, c #91BCD4",
1267 | "C, c #80ABC3",
1268 | "D, c #567083",
1269 | "E, c #67899D",
1270 | "F, c #94C2DB",
1271 | "G, c #95C1DB",
1272 | "H, c #779CB2",
1273 | "I, c #60849E",
1274 | "J, c #64849F",
1275 | "K, c #1A1F22",
1276 | "L, c #405061",
1277 | "M, c #79A1BD",
1278 | "N, c #324051",
1279 | "O, c #6183A1",
1280 | "P, c #6B8FAD",
1281 | "Q, c #6485A2",
1282 | "R, c #34444F",
1283 | "S, c #060606",
1284 | "T, c #2D3339",
1285 | "U, c #B2CBDF",
1286 | "V, c #94BCD5",
1287 | "W, c #7DA2BA",
1288 | "X, c #3F5264",
1289 | "Y, c #5A7991",
1290 | "Z, c #7195B3",
1291 | "`, c #7BA5BD",
1292 | " ' c #81AAC6",
1293 | ".' c #88B2CC",
1294 | "+' c #8EBBD4",
1295 | "@' c #8AB2CC",
1296 | "#' c #82ADC7",
1297 | "$' c #7092A5",
1298 | "%' c #95C2DA",
1299 | "&' c #41525F",
1300 | "*' c #6387A3",
1301 | "=' c #475F72",
1302 | "-' c #21282F",
1303 | ";' c #5B7288",
1304 | ">' c #0D0F11",
1305 | ",' c #0B0E11",
1306 | "'' c #212C36",
1307 | ")' c #26323C",
1308 | "!' c #161B20",
1309 | "~' c #55616D",
1310 | "{' c #9BB9D0",
1311 | "]' c #799EB6",
1312 | "^' c #27313A",
1313 | "/' c #1A222B",
1314 | "(' c #5D7E99",
1315 | "_' c #6587A4",
1316 | ":' c #6789A6",
1317 | "<' c #6B8EAB",
1318 | "[' c #628097",
1319 | "}' c #6D8B9D",
1320 | "|' c #769AAF",
1321 | "1' c #6E91A9",
1322 | "2' c #6C8EAD",
1323 | "3' c #6E91AF",
1324 | "4' c #3C4D59",
1325 | "5' c #8BB1CB",
1326 | "6' c #232D32",
1327 | "7' c #13171B",
1328 | "8' c #232B32",
1329 | "9' c #839AAF",
1330 | "0' c #789BB3",
1331 | "a' c #283138",
1332 | "b' c #0C0E0F",
1333 | "c' c #242B33",
1334 | "d' c #3D4D5B",
1335 | "e' c #435768",
1336 | "f' c #4B6176",
1337 | "g' c #283137",
1338 | "h' c #8DB4CC",
1339 | "i' c #41535E",
1340 | "j' c #405362",
1341 | "k' c #3C4F60",
1342 | "l' c #3C4E5B",
1343 | "m' c #2B353E",
1344 | "n' c #526876",
1345 | "o' c #92BAD3",
1346 | "p' c #1B1F23",
1347 | "q' c #31383F",
1348 | "r' c #7F9CB6",
1349 | "s' c #21292F",
1350 | "t' c #29333F",
1351 | "u' c #1F252E",
1352 | "v' c #090A0E",
1353 | "w' c #4D626E",
1354 | "x' c #96BDD3",
1355 | "y' c #191D20",
1356 | "z' c #13181B",
1357 | "A' c #80A4BC",
1358 | "B' c #1B2027",
1359 | "C' c #5D7182",
1360 | "D' c #2C383F",
1361 | "E' c #364857",
1362 | "F' c #1A2028",
1363 | "G' c #333F49",
1364 | "H' c #7FA2B5",
1365 | "I' c #4A5E6E",
1366 | "J' c #232E35",
1367 | "K' c #252D35",
1368 | "L' c #2F3A41",
1369 | "M' c #0A0B0E",
1370 | "N' c #14191D",
1371 | "O' c #5A717F",
1372 | "P' c #212931",
1373 | "Q' c #222B34",
1374 | "R' c #101216",
1375 | "S' c #21272B",
1376 | " ",
1377 | " ",
1378 | " ",
1379 | " . ",
1380 | " + ",
1381 | " @ # $ % ",
1382 | " & * = - ; ",
1383 | " > , ' ) ! ~ { ] ",
1384 | " ^ / ( _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a ",
1385 | " b c d e f g h i j k l m n o p q r s t u v w x ",
1386 | " y z A B C D E F G H I J K L M N O P Q R S T U U V W X Y ",
1387 | " Z ` ...+.@.#.$.%.O &.*.=.-.;.>.,.'.).!.~.~.~.{.].^./.(._.:.<. ",
1388 | " b [.}.|.#.1.2.3.4.{.~.~.~.~.5.6.5.~.7.8.{.~.~.~.~.9.0.a.b.].c. ",
1389 | " d.e.f.g.h.i.j.k.{.~.~.~.~.l.~.m.% n.~.o.{.{.~.~.~.~.p.V 9.~.q.r. ",
1390 | " s.t.u.v.w.x.u y.z.A.B.5.~.~.5.C.D.E.F.~.~.G.~.~.~.G.H.I.J.~.~.J.K.L. M.N. ",
1391 | " O.P.Q.R.S.T.U.V.W.X.Y.Z.`.~.~.5. +.+++@+U ~.~.~.~.~.#+$+%+,.~.~.G.&+*+=+-+;+ ",
1392 | " >+,+Q.'+)+!+~+{+]+^+/+(+_+:+<+~.[+}+U 9.|+5.~.~.~.~.1+2+3+4+5+~.].6+7+8+9+0+ ",
1393 | " a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+5.U ~.U r+s+~.~.~.t+u+v+w+x+y+~.z+A+t+B+C+D+E+ F+G+ ",
1394 | " H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+V ~.~.~.~.U ~.~.~.o.9.{.Z+`+9.~.~.~.V @.@+@@@#@ $@%@&@*@ ",
1395 | " =@-@;@>@,@'@'.)@!@~@{@]@^@/@l+(@_@:@<@~.~.~.U {.~.~.~.{.~.~.{.[@~.~.~.~.}@|@1@2@3@4@5@6@7@8@ ",
1396 | " 9@0@a@b@c@d@-.e@f@g@h@i@j@k@l@V+m@n@o@p@~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.{.q@r@s@t@u@v@w@x@y@ ",
1397 | "z@A@B@C@D@E@X F@G@H@R I@J@K@L@M@N@O@P@Q@R@o+S@T@~.~.~.~.~.~.~.~.~.~.~.~.~.~.9.U@V@W@X@<+V Y@Z@`@ # ",
1398 | " .#+#@###$#%#*#=#-#;#>#,#'#)#!#~#{#]#^#S@/#~.~.~.~.~.~.~.~.~.~.~.~.~.U (#_#:#<#p@{.[#}#|#1#2# ",
1399 | " 3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#S@/#~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.l#m#9.{.~.n#o#p#q#r#s# ",
1400 | " t#u#v#w#x#y#z#A#B#C#D#E#F#G#H#I#% J#K#S@T@~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.L#0.l.~.~.{.M#N#O#P#Q#R# ",
1401 | " S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$-$a#~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.o.o.;$9.G.~.>$,$'$)$!$~${$]$ ",
1402 | " ^$/$($_$:$<$[$}$|$1$2$3$4$5$6$7$8$9$:+<+~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.G.0$a$b$c$d$e$f$g$h$i$j$k$ ",
1403 | " [ l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$M#p@~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.;$D$E$F$G$H$I$J$K$L$ ",
1404 | " M$N$O$P$Q$R$S$T$U$V$W$X$Y$Z$`$ %.%+%@%<+{.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.#%$%%%p@&%*%=%-%;%>%,% ",
1405 | " '%)%!%~%{%]%^%/%(%_%:%<%[%}%|%1%2%3%-$T@~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.4%5%U p@6%7%8%9%0%a%y ",
1406 | " b%c%d%e%f%g%h%i%G.[#j%k%l%m%n%o%p%@%q%{.~.~.~.~.~.~.~.~.~.~.~.~.~.~.{.~.~.~.~.~.~.V G.}@r%s%t%u%v%w%M.x%y%z%A% ",
1407 | " B%C%D%E%F%G%H%I%V o.<@J%K%L%M%N%O%P%p@~.~.~.~.~.~.~.~.~.U ~.~.U 9.Q%{.~.~.~.~.~.{.%%U {.~.~.{.v@R%S%T%U%V%W% X%$ ",
1408 | " Y%Z%`% &.&+&@&U ~.{.$&%&&&*&=&-&T@~.~.~.~.~.~.~.~.~.~.~.;&>&,&'&)&!&5+~.~.~.~.{.~&{&]&9.~.p@^&/&(&_&:& <&[&}&|& ",
1409 | " 1&2&3&4&5&6&7&8&9&l.~.{.V 0&a&b&c&~.~.~.~.~.~.~.5.d&e&f&g&h&i&j&k&l&m&n&~.~.G.~.~.~.o&p&q&r&s&t&u&v& w&x&y&z&A&B& ",
1410 | " C&2&D&E&F&G&G&H&I&J&U ~.~.U K&L&,.~.~.~.~.~.~.~.U M&N&O&P&Q&R&S&T&U&V&W&X&].{.~.~.{./#Y&Z&`& *.*+*@* (.#*$*%*&***=* ",
1411 | " -*;*>*,*'*)*!*~*{*]*^*~.5.{.5./*U ~.~.~.~.~.~.{.[#(*_*:*<*[*[*}*|*1*2*3*4*5*U ~.~.6*7*8*9*0*a*b*c*d*e*f*g*h*i*%*j*k*<%l* ",
1412 | " m*n*o*p*q*r*s*t*u*v*w*1+~.~.~.~.~.~.~.~.~.~.~.x*y*z*A*B*C*D*E*V U ~.G.~.:.F*G*l.{.R%X+H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W*X* ",
1413 | " Y*Z*D&`* =.=+=@=#=$=%=&={.~.~.~.~.~.~.~.~.~.~.<+*===-=;=>=,='=)=[#p@!=~={=]=^=/=(=a#&%_=:=<=-#[=}=k$|=1=2=3=4=5=6=7=8=9= ",
1414 | " 0=a=b=c=d=e=f=g=h=i=j=k=l=5.~.~.~.~.~.~.~.~.~.V -$m=n===o=p=q=r=s=t=:+u=v=w=x=y=z=A=J.V U ~.V [#B=C=D=1=E=F= G=H=I= ",
1415 | " J=K=L=M=N=O=P=Q=R=S=T=U=V=5.U ~.~.~.~.~.~.~.~.~.{.x*W=X=Y=Z=`= -.-+-@-#-$-%-&-*-=---;->-9.x*)=,-'-)-c.!-~- {-]- ",
1416 | " ^-/-(-_-:-<-<-[-%.}-|-1-T@~.{.~.~.~.~.~.~.~.~.~.~.V 2-^&3-4-5-6-7-8-9-0-a-b-c-d-e-f-g-h-V@i-j-k-l-T=m-7@n- o-p- ",
1417 | " q-r-s-t-u-v-!+2*w-x-y-z-V ~.~.~.~.~.~.~.~.~.~.~.~.~.~./#A-B-C-D-E-F-G-H-I-J-K-L-<@M-W=N-O-P-Q-R-<&S-T-U-V- W- ",
1418 | " X-Y-Z-`- ;.;+;@;#;$;q+~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~./#v@W=N#%;&;*;=;-;s=-#;;>;,;';);!;~;{;];^;/;(;H+ ",
1419 | " _;:;<;[;};|;1;2;3;4;{.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.{.T@-#5;6;7;8;9;[#V <+0;a;b;c;E-d;e;f;|=g;h; ",
1420 | " i;j;V#k;F.l;m;n;o;~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.{.~.{.p@S@s=p;q;~.~.{.r;s;t;u;~$v;w;x;y;z;A; ",
1421 | " H+B;C;D;E;F;G;H;~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.{.U ~.~.V E*E*V ~.~.~.{.T@/#I;J;K;L;M;y;N;O; ",
1422 | " P;Q;R;S;T;U;~.{.~.~.~.~.~.~.~.~.l.U {.p@~.~.{.V ~.~.5+V;].~.~.~.~.{.{.p@W;X;Y;Z;`;/# >W..>+>N;@> ",
1423 | " #>$>%>&>*>G.~.~.~.~.~.~.~.~.{.`.=>V=->;>~.n##&>>T@,>'>].~.~.~.~.~.)>!>i$~>{>]>^>/>(>_>:><>[>}> |>1> ",
1424 | " 2>3>4>5>U@U ~.~.~.~.~.~.~.{.6>7>8>9>0>a#a>b>c>d>e>f>~.~.~.V ~.~.g>h>i>1=j>,%k>l>m>n>o>p>q>r>s>t>u>v>w> ",
1425 | " x>y>z>A>B>C>5+D>E>~.~.~.~.{.%&F>G>3;s%{.H>I>J>K>L>M>~.V N>O>P>x*Q>R>S>T>U> X%V>W>X>Y>Z>P-`> ,.,+, ",
1426 | " @,#,$,%,&,1.*,=,-,;,{.p@V {.X@>,,,Z;V ~.5.`;',),!,~,~.{,],^,/,/&-$F$(,_, :,<,[,},<@|,1,2, ",
1427 | " B&3,4, 5,6,7,8,9,0,`;a,b,B+c,d,s=<+~.~.~.a#e,f,g,h,V -#9$i,j,k,l,m,n, o,p,q,r,s,t,u,v, ",
1428 | " w,x, y,z,A,B,C,D,E,o@F,G,<+~.~.~.~.~.;;P>j%}@p@H,]#I,J,K,L,M,=+ N,O,P,Q,R,S, ",
1429 | " T,U,V,W,X,Y,Z,`, '.'+'x*~.{.O+@%@'#'$'%'a#&'*'='-' ~;;'>' ,''')'!' ",
1430 | " ~'{']'^'/'('_'_':'<'['}'{.V |'1'2'3'4'5'}@6'7' 8'K; ",
1431 | " v&9'0'a' b'c'd'e'f'1@g'h'G.i'j'k'l'm'n'o'p' y ",
1432 | " q'r's' t'u'H+ v'w'x'y' z'A'B' ",
1433 | " C'D' E'F' G'H' I'J' ",
1434 | " K'L' M' N'O' P'Q' ",
1435 | " R' S' ",
1436 | " ",
1437 | " ",
1438 | " ",
1439 | " "};
1440 |
--------------------------------------------------------------------------------
/test/open24.xpm:
--------------------------------------------------------------------------------
1 | /* XPM */
2 | static char *open[] = {
3 | /* width height num_colors chars_per_pixel */
4 | " 45 55 168 2",
5 | /* colors */
6 | ".. s None c None",
7 | ".# c #450304",
8 | ".a c #ce7e7c",
9 | ".b c #b94344",
10 | ".c c #b65254",
11 | ".d c #780204",
12 | ".e c #b04c4c",
13 | ".f c #b00204",
14 | ".g c #8a8a64",
15 | ".h c #969a24",
16 | ".i c #b6b60c",
17 | ".j c #cac614",
18 | ".k c #cece34",
19 | ".l c #cace54",
20 | ".m c #caca94",
21 | ".n c #c24e4c",
22 | ".o c #aa0204",
23 | ".p c #9e4244",
24 | ".q c #bc0204",
25 | ".r c #a40204",
26 | ".s c #9e262c",
27 | ".t c #8c3a3c",
28 | ".u c #5c1414",
29 | ".v c #5b0204",
30 | ".w c #700204",
31 | ".x c #722214",
32 | ".y c #b52624",
33 | ".z c #8e3234",
34 | ".A c #b60204",
35 | ".B c #c20204",
36 | ".C c #860204",
37 | ".D c #560304",
38 | ".E c #800204",
39 | ".F c #9e0204",
40 | ".G c #920204",
41 | ".H c #620204",
42 | ".I c #a41314",
43 | ".J c #996a6c",
44 | ".K c #920d09",
45 | ".L c #c80204",
46 | ".M c #690204",
47 | ".N c #980204",
48 | ".O c #984c4c",
49 | ".P c #e2dedc",
50 | ".Q c #ae5e5c",
51 | ".R c #bc6a6c",
52 | ".S c #a21a1c",
53 | ".T c #8a0a04",
54 | ".U c #671e1c",
55 | ".V c #941b1c",
56 | ".W c #b8b4b4",
57 | ".X c #e8e6e4",
58 | ".Y c #ccb4b4",
59 | ".Z c #c07c7c",
60 | ".0 c #f3f2eb",
61 | ".1 c #b49696",
62 | ".2 c #521614",
63 | ".3 c #9e5a5c",
64 | ".4 c #d4d4d4",
65 | ".5 c #a7a5a1",
66 | ".6 c #dec4c4",
67 | ".7 c #e4d6d4",
68 | ".8 c #f4f2f4",
69 | ".9 c #cccac4",
70 | "#. c #9a161c",
71 | "## c #8c0204",
72 | "#a c #862c2c",
73 | "#b c #7e5e5c",
74 | "#c c #a39694",
75 | "#d c #6b6667",
76 | "#e c #322624",
77 | "#f c #b09e9c",
78 | "#g c #b23234",
79 | "#h c #500304",
80 | "#i c #222224",
81 | "#j c #2e322c",
82 | "#k c #925c5c",
83 | "#l c #721a1c",
84 | "#m c #6e6e6c",
85 | "#n c #0a0a0c",
86 | "#o c #b2b2b4",
87 | "#p c #8e6264",
88 | "#q c #884444",
89 | "#r c #8c5c5c",
90 | "#s c #121214",
91 | "#t c #b2aeac",
92 | "#u c #c21e1c",
93 | "#v c #6e0e0c",
94 | "#w c #623e3c",
95 | "#x c #b64e4c",
96 | "#y c #bc3634",
97 | "#z c #624e1c",
98 | "#A c #6e727c",
99 | "#B c #824e4c",
100 | "#C c #8b8d87",
101 | "#D c #a09674",
102 | "#E c #766844",
103 | "#F c #7a663c",
104 | "#G c #828c90",
105 | "#H c #beb6a4",
106 | "#I c #3a0204",
107 | "#J c #8e9298",
108 | "#K c #562529",
109 | "#L c #7c3838",
110 | "#M c #bab294",
111 | "#N c #7e4644",
112 | "#O c #929a9c",
113 | "#P c #762a2c",
114 | "#Q c #a60e0c",
115 | "#R c #ae1e1c",
116 | "#S c #460a0c",
117 | "#T c #a6aaa4",
118 | "#U c #6a4a4c",
119 | "#V c #784c50",
120 | "#W c #761214",
121 | "#X c #9e1e1c",
122 | "#Y c #988c90",
123 | "#Z c #821e1c",
124 | "#0 c #7a1618",
125 | "#1 c #7a6e74",
126 | "#2 c #7e7a77",
127 | "#3 c #808688",
128 | "#4 c #828284",
129 | "#5 c #828279",
130 | "#6 c #827a64",
131 | "#7 c #7e765c",
132 | "#8 c #864a34",
133 | "#9 c #825a44",
134 | "a. c #766e54",
135 | "a# c #7e7e74",
136 | "aa c #806464",
137 | "ab c #7e724c",
138 | "ac c #766634",
139 | "ad c #765a2c",
140 | "ae c #8e7e54",
141 | "af c #a69e8c",
142 | "ag c #c7c2ac",
143 | "ah c #9a2a1c",
144 | "ai c #aa3a3c",
145 | "aj c #979894",
146 | "ak c #70684c",
147 | "al c #62522c",
148 | "am c #6e5e3c",
149 | "an c #92866c",
150 | "ao c #968e6c",
151 | "ap c #826e54",
152 | "aq c #84765c",
153 | "ar c #86522c",
154 | "as c #7e4624",
155 | "at c #7e3614",
156 | "au c #6e5254",
157 | "av c #712e2c",
158 | "aw c #7a5654",
159 | "ax c #82727c",
160 | "ay c #a63634",
161 | "az c #8a6a6c",
162 | "aA c #863534",
163 | "aB c #5c1a18",
164 | "aC c #6a2c2c",
165 | "aD c #5e0e14",
166 | "aE c #868684",
167 | "aF c #922624",
168 | "aG c #901614",
169 | "aH c #c21614",
170 | "aI c #520e0c",
171 | "aJ c #805654",
172 | "aK c #b00c0c",
173 | "aL c #c2221c",
174 | /* pixels */
175 | "..........................................................................................",
176 | "..........................................................................................",
177 | ".....................................#.a.#................................................",
178 | "...................................#.b.c.#.#.#.#...........#.d............................",
179 | ".................................#.e.f.f.#.g.h.i.j.k.l.m...f.n............................",
180 | ".................................d.f.o.f.#.#.#.d.d.#.#.#...f.f.d..........................",
181 | ".................................p.q.q.r.s.t.u.v.w.x.d.d.#.d.r.y.d........................",
182 | ".................................z.A.B.q.C.D.E.F.G.E.H.E.I.F.q.A.d........................",
183 | ".................................J.G.f.G.w.K.f.L.B.B.r.M.f.B.L.A.d........................",
184 | ".................................d.w.N.M.O.P.Q.B.B.o.R.S.E.q.q.T.d........................",
185 | ".................................d.U.M.V.W.X.Y.q.B.Z.0.1.E.r.N.d..........................",
186 | ".................................d.2.r.3.4.5.6.A.f.7.8.9#.###a.#..........................",
187 | "................................#b.d.L#c#d#e#f.N.V.5#d.4#g.E.d............................",
188 | "...............................d#h.r.L#f#i#j#k.M#l#m#n#o.b.r.d............................",
189 | "...............................d#h##.q#g#p#q##.q.N#r#s#t#u.q#v.#..........................",
190 | "..............#j................#w.w.C.r.q##.r.B.f.T#x#y.L.r.M.d..........................",
191 | "............#j#z#j#A#A#j.........d.D.r.M.C.f.r.r.r.q.B.C.N.E#B............................",
192 | "..........#j#C#D#E#z#F#G#j.......d.d.#.G##.w.M.M.C.C.d.G.r.u.d............................",
193 | "....................#E#H#C#j.........d#I.w.F.f.o.o.o.N.M.#.d..............................",
194 | "......................#E#j#J#j......#K.M.#.#.v.w.M.v.##h.H#L.d............................",
195 | "..........................#M#j.......v.F.q.r.d.w.w.C.E.M.v.M#N.d..........................",
196 | "..........................#E#O#j#j#K##.f.L.L.L.B.q.f##.M.v.w.w#P.d.#...d.d................",
197 | "............................#C#E.#.v.o.B.L.L.q.q.q.q.N.M.D#h.M.N.r#Q#R#S.H.J.#............",
198 | "............................#j#T#U.C.q.q.o.G.F.f.q.A.N.d.v.v##.o.q.L.r.C.A###k............",
199 | "..............................#C#V.N.A.N.f.q.F.C.E.f.F.E.H#n#W.K.I#X#a.z.V.q.d#p.d........",
200 | "................................#Y.r.K#Z.K.q.A.G.w#0#b#1#2#3#4#5#5#6#6#7#8.q.G#9..........",
201 | "..................#j#oa..5#j..#J#Ja##4#4aa.o.A##.E.xabacadae#Daf#M#Magah.r.qai.#..........",
202 | "................aja#akalamanaoapaqaaarasat.r.o.E.w.T.T.E.H.#...........#.d.d.#............",
203 | "...........E....#j#j#C#M#j#n#naa#V.O.f.N.F.q.G.d.w.r.C.d.H.#...............#..............",
204 | "...........#.F.F.J#n#n#n#n#n#nauav#p.q.N.d.d.w.M.F.F.E.d.U................................",
205 | ".........E.F.E.E.d.z#n.d#n#n#naw.Uax.r##.d.w.D.M.r.N.E.w.d................................",
206 | ".........E.F.......d.Fay.E.F#naz.2#A.D#h.r.f.w##.r##.d.H.M................................",
207 | ".........F.#...........E.E.F.baAaB#A.#.E.f.r.w.N.N.E.waC.#................................",
208 | ".........F.#...............d.F.E#K#d.H.G.F.G.w.N##.d.D.#..................................",
209 | ".........F.#....................#Aau.v.E##.w.E.E.w.H.d.......d..av.d......................",
210 | ".........E.#..................#j#GaC.M.H.M.d.d.w.H.#.d.d.#aC.w.C##.E.d....................",
211 | "...........F.................5#O...#aD.w.d.w.H.D.M######.G.F.o.f.o.N.3....................",
212 | "...........F.E...........5aEakak.....#.##h#h.v.N.o.f.q.L.L.L.L.L.q.faF....................",
213 | "...........E.E......#E#C.5aq#j.....#.v.N.F.d.N.r.F.r.F#Q.I.o.q.L.L.L.y....................",
214 | ".............E.....................#.E.B.qaG.d.d.d.....#.#.....d#x.b......................",
215 | ".............E.F...................E.w.L.LaG.#............................................",
216 | "...............E.E.................EaA.q.qaG.#............................................",
217 | "...............E.F.E.................E.r.r#Z.#............................................",
218 | ".................E.F.E...............E.G.NaA..............................................",
219 | ".................E#uaH.................w.dav..............................................",
220 | "...................E.E.............EaI.M.w.v.#............................................",
221 | "...................................E.D.d.E.waJ............................................",
222 | ".....................................C.N.N##.M............................................",
223 | "..................................#W.f.q.A.f.G#q..........................................",
224 | ".....................................q.L.L.L.q.V.#........................................",
225 | "...................................#.daK.q.qaL.d..........................................",
226 | ".......................................#.#.#..............................................",
227 | "..........................................................................................",
228 | "..........................................................................................",
229 | ".........................................................................................."
230 | };
231 |
--------------------------------------------------------------------------------
/test/run_tests.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | # This very basic script simulate user inputs for the CI
4 | # Feel free to update, improve or remove it if proper
5 | # intergration tests and/or unit tests are added.
6 |
7 | set -e
8 |
9 | BOLD="\033[1m"
10 | RESET="\033[0m"
11 | LIGHT_RED="\033[91m"
12 | LIGHT_GREEN="\033[92m"
13 | LIGHT_CYAN="\033[96m"
14 |
15 | logging(){
16 | local type=$1; shift
17 | printf "${LIGHT_CYAN}${BOLD}run_tests${RESET} [%b] : %b\n" "$type" "$*"
18 | }
19 | log_info(){
20 | logging "${LIGHT_GREEN}info${RESET}" "$@"
21 | }
22 | log_error(){
23 | logging "${LIGHT_RED}error${RESET}" "$@" >&2
24 | exit 1
25 | }
26 |
27 |
28 | PID=""
29 |
30 | # to properly kill child process executed in background on exit
31 | at_exit() {
32 | status=$?
33 | [ $status -eq 0 ] && log_info "Seem all went well" && exit 0
34 | # Code for non-zero exit:
35 | if ! kill -s TERM "$PID" 2>/dev/null || ! wait "$PID" ; then
36 | log_error "Pid [$PID] died with status $status "
37 | fi
38 | log_error "Something went wrong. Pid [$PID] has been killed. Status code $status"
39 | }
40 | # to properly quit from ctrl+c (SIGINT Signal)
41 | sigint_handler(){
42 | kill -s TERM "$PID"
43 | wait
44 | log_info "Tests abort"
45 | exit 1
46 | }
47 |
48 | # look at test/main.c and run ./mlx-test to understand what this function does
49 | test_default_main(){
50 | ${MAKE} -f Makefile.gen all
51 | ./mlx-test &
52 | PID="$!"
53 | log_info "./mlx-test running in background, pid:" $PID
54 |
55 | i=25 # waiting 25s mlx-test to be ready for inputs.
56 | while [ $i -gt 0 ]; do
57 | if ! ps -p $PID > /dev/null ; then
58 | wait $PID
59 | fi
60 | log_info "countdown" $i
61 | sleep 1
62 | i=$((i - 1))
63 | done
64 | log_info "Ready to \"just play\" using xdotool"
65 | wid1=$(xdotool search --name Title1)
66 | wid2=$(xdotool search --name Title2)
67 | wid3=$(xdotool search --name Title3)
68 |
69 | xdotool windowfocus $wid3
70 | log_info "Focus Win3: Testing move mouse 100 100"
71 | xdotool mousemove 100 100
72 | log_info "Focus Win3: Testing move mouse 200 200"
73 | xdotool mousemove 200 200
74 | log_info "Focus Win3: Pressing escape to destroy window \"Win3\""
75 | xdotool key Escape
76 |
77 | log_info "Focus Win2: Pressing escape to stop program"
78 | xdotool windowfocus $wid2
79 | xdotool key Escape
80 | }
81 |
82 | main(){
83 | case $(uname) in
84 | FreeBSD) MAKE=gmake ;;
85 | *) MAKE=make ;;
86 | esac
87 | cd $(dirname $0)
88 | trap at_exit EXIT
89 | trap sigint_handler INT
90 |
91 | test_default_main
92 | }
93 |
94 | main "$@"
95 |
--------------------------------------------------------------------------------