Toggle image transparency with A-key
This commit is contained in:
		
							parent
							
								
									d982b06eed
								
							
						
					
					
						commit
						3672c0bc63
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| all: sxiv | all: sxiv | ||||||
| 
 | 
 | ||||||
| VERSION=git-20110309 | VERSION=git-20110310 | ||||||
| 
 | 
 | ||||||
| CC?=gcc | CC?=gcc | ||||||
| PREFIX?=/usr/local | PREFIX?=/usr/local | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								image.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								image.c
									
									
									
									
									
								
							| @ -43,6 +43,7 @@ void img_init(img_t *img, win_t *win) { | |||||||
| 		img->zoom = MAX(img->zoom, zoom_min); | 		img->zoom = MAX(img->zoom, zoom_min); | ||||||
| 		img->zoom = MIN(img->zoom, zoom_max); | 		img->zoom = MIN(img->zoom, zoom_max); | ||||||
| 		img->aa = options->aa; | 		img->aa = options->aa; | ||||||
|  | 		img->alpha = 1; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (win) { | 	if (win) { | ||||||
| @ -211,7 +212,7 @@ void img_render(img_t *img, win_t *win) { | |||||||
| 	else | 	else | ||||||
| 		imlib_context_set_image(im_broken); | 		imlib_context_set_image(im_broken); | ||||||
| 
 | 
 | ||||||
| 	if (imlib_image_has_alpha()) | 	if (imlib_image_has_alpha() && !img->alpha) | ||||||
| 		win_draw_rect(win, win->pm, dx, dy, dw, dh, True, 0, win->white); | 		win_draw_rect(win, win->pm, dx, dy, dw, dh, True, 0, win->white); | ||||||
| 	 | 	 | ||||||
| 	imlib_context_set_drawable(win->pm); | 	imlib_context_set_drawable(win->pm); | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								image.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								image.h
									
									
									
									
									
								
							| @ -45,6 +45,7 @@ typedef struct { | |||||||
| 	unsigned char re; | 	unsigned char re; | ||||||
| 	unsigned char checkpan; | 	unsigned char checkpan; | ||||||
| 	unsigned char aa; | 	unsigned char aa; | ||||||
|  | 	unsigned char alpha; | ||||||
| 
 | 
 | ||||||
| 	int x; | 	int x; | ||||||
| 	int y; | 	int y; | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.c
									
									
									
									
									
								
							| @ -496,6 +496,10 @@ void on_keypress(XKeyEvent *kev) { | |||||||
| 				img_toggle_antialias(&img); | 				img_toggle_antialias(&img); | ||||||
| 				changed = 1; | 				changed = 1; | ||||||
| 				break; | 				break; | ||||||
|  | 			case XK_A: | ||||||
|  | 				img.alpha ^= 1; | ||||||
|  | 				changed = 1; | ||||||
|  | 				break; | ||||||
| 			case XK_r: | 			case XK_r: | ||||||
| 				changed = load_image(fileidx); | 				changed = load_image(fileidx); | ||||||
| 				break; | 				break; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert
						Bert