Subversion Repositories Kolibri OS

Rev

Rev 7152 | Rev 7155 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7152 Rev 7154
Line 1... Line 1...
1
/*
1
/*
2
 * BACKGEN - Background generator
2
 * Icon Editor for KolibriOS
3
 * Author: Leency
3
 * Author: Leency
4
 * Licence: GPL v2
4
 * Licence: GPL v2
5
*/
5
*/
Line 6... Line 6...
6
 
6
 
7
/*
7
/*
8
TODO/BUGS
-
 
9
Flip first pixel doesn't work well
8
TODO/BUGS
10
Open with param 
9
Open with param 
Line 11... Line 10...
11
*/
10
*/
Line 25... Line 24...
25
//                                                   //
24
//                                                   //
26
//                       DATA                        //
25
//                       DATA                        //
27
//                                                   //
26
//                                                   //
28
//===================================================//
27
//===================================================//
Line 29... Line 28...
29
 
28
 
Line 30... Line 29...
30
#define T_TITLE "Icon Editor 0.09"
29
#define T_TITLE "Icon Editor 0.09b"
31
 
30
 
Line 32... Line 31...
32
#define TOOLBAR_H    24+8
31
#define TOOLBAR_H    24+8
Line 270... Line 269...
270
 
269
 
271
	//canvas{
270
	//canvas{
272
	canvas.w = image.columns * zoom.value;
271
	canvas.w = image.columns * zoom.value;
273
	canvas.h = image.rows * zoom.value;
272
	canvas.h = image.rows * zoom.value;
274
	if (canvas.w+2 > wrapper.w) || (canvas.h+2 > wrapper.h) { 
273
	if (canvas.w+2 > wrapper.w) || (canvas.h+2 > wrapper.h) { 
275
		zoom.value--;
274
		zoom.click(BTN_ZOOM_OUT);
276
		DrawEditArea();
275
		DrawEditArea();
277
		return;
276
		return;
278
	}
277
	}
279
	canvas.x = -zoom.value*image.columns+wrapper.w/2 + wrapper.x;
278
	canvas.x = -zoom.value*image.columns+wrapper.w/2 + wrapper.x;
Line 359... Line 358...
359
dword bmp_32x32x16_header[] = FROM "bmp32x32header";
358
dword bmp_32x32x16_header[] = FROM "bmp32x32header";
360
void EventSave()
359
void EventSave()
361
{
360
{
362
	char save_buf[3126];
361
	char save_buf[3126];
363
	memmov(#save_buf, #bmp_32x32x16_header, sizeof(bmp_32x32x16_header));
362
	memmov(#save_buf, #bmp_32x32x16_header, sizeof(bmp_32x32x16_header));
-
 
363
	image.move(FLIP_VER); //fix an issue that BMP image is flipped vertically
364
	memmov(#save_buf+sizeof(bmp_32x32x16_header), image.get_image(), sizeof(save_buf)-sizeof(bmp_32x32x16_header));
364
	memmov(#save_buf+sizeof(bmp_32x32x16_header), image.get_image(), sizeof(save_buf)-sizeof(bmp_32x32x16_header));
-
 
365
	image.move(FLIP_VER); //restore
365
	if (WriteFile(sizeof(save_buf), #save_buf, "/rd/1/saved_image.bmp")==0)
366
	if (WriteFile(sizeof(save_buf), #save_buf, "/rd/1/saved_image.bmp")==0)
366
	{
367
	{
367
		notify("'File saved as /rd/1/saved_image.bmp' -O");
368
		notify("'File saved as /rd/1/saved_image.bmp' -O");
368
	}
369
	}
369
	else {
370
	else {