forked from KolibriOS/kolibrios
IconEditor: fix FLIP_HOR, add FLIP_VER, fix zoom value for some cases, fix BMP was flipped vertically when saved
git-svn-id: svn://kolibrios.org@7154 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
eb145a52ea
commit
e507f8bd35
@ -56,54 +56,60 @@ void _colors::move(int _direction)
|
||||
int r, c;
|
||||
dword first_element_data;
|
||||
|
||||
if (_direction == MOVE_LEFT)
|
||||
switch(_direction)
|
||||
{
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
first_element_data = get_pixel(r, 0);
|
||||
for (c = 0; c < columns-1; c++) set_pixel(r, c, get_pixel(r, c+1));
|
||||
set_pixel(r, columns-1, first_element_data);
|
||||
}
|
||||
}
|
||||
if (_direction == MOVE_RIGHT)
|
||||
{
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
first_element_data = get_pixel(r, columns-1);
|
||||
for (c = columns-1; c > 0; c--) set_pixel(r, c, get_pixel(r, c-1));
|
||||
set_pixel(r, 0, first_element_data);
|
||||
}
|
||||
}
|
||||
if (_direction == MOVE_UP)
|
||||
{
|
||||
for (c = 0; c < columns; c++)
|
||||
{
|
||||
first_element_data = get_pixel(0, c);
|
||||
for (r = 0; r < rows-1; r++) set_pixel(r, c, get_pixel(r+1, c));
|
||||
set_pixel(rows-1, c, first_element_data);
|
||||
}
|
||||
}
|
||||
if (_direction == MOVE_DOWN)
|
||||
{
|
||||
for (c = 0; c < columns; c++)
|
||||
{
|
||||
first_element_data = get_pixel(rows-1, c);
|
||||
for (r = rows-1; r > 0; r--) set_pixel(r, c, get_pixel(r-1, c));
|
||||
set_pixel(0, c, first_element_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_direction == FLIP_HOR)
|
||||
{
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
for (c = 0; c < columns/2; c++) {
|
||||
first_element_data = get_pixel(r, c);
|
||||
set_pixel(r, c, get_pixel(r, columns-c));
|
||||
set_pixel(r, columns-c, first_element_data);
|
||||
}
|
||||
}
|
||||
case MOVE_LEFT:
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
first_element_data = get_pixel(r, 0);
|
||||
for (c = 0; c < columns-1; c++) set_pixel(r, c, get_pixel(r, c+1));
|
||||
set_pixel(r, columns-1, first_element_data);
|
||||
}
|
||||
break;
|
||||
case MOVE_RIGHT:
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
first_element_data = get_pixel(r, columns-1);
|
||||
for (c = columns-1; c > 0; c--) set_pixel(r, c, get_pixel(r, c-1));
|
||||
set_pixel(r, 0, first_element_data);
|
||||
}
|
||||
break;
|
||||
case MOVE_UP:
|
||||
for (c = 0; c < columns; c++)
|
||||
{
|
||||
first_element_data = get_pixel(0, c);
|
||||
for (r = 0; r < rows-1; r++) set_pixel(r, c, get_pixel(r+1, c));
|
||||
set_pixel(rows-1, c, first_element_data);
|
||||
}
|
||||
break;
|
||||
case MOVE_DOWN:
|
||||
for (c = 0; c < columns; c++)
|
||||
{
|
||||
first_element_data = get_pixel(rows-1, c);
|
||||
for (r = rows-1; r > 0; r--) set_pixel(r, c, get_pixel(r-1, c));
|
||||
set_pixel(0, c, first_element_data);
|
||||
}
|
||||
break;
|
||||
case FLIP_HOR:
|
||||
for (r = 0; r < rows; r++)
|
||||
{
|
||||
for (c = 0; c < columns/2; c++) {
|
||||
first_element_data = get_pixel(r, c);
|
||||
set_pixel(r, c, get_pixel(r, columns-c-1));
|
||||
set_pixel(r, columns-c-1, first_element_data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FLIP_VER:
|
||||
for (c = 0; c < columns; c++)
|
||||
{
|
||||
for (r = 0; r < rows/2; r++) {
|
||||
first_element_data = get_pixel(r, c);
|
||||
set_pixel(r, c, get_pixel(rows-r-1, c));
|
||||
set_pixel(rows-r-1, c, first_element_data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
/*
|
||||
* BACKGEN - Background generator
|
||||
* Icon Editor for KolibriOS
|
||||
* Author: Leency
|
||||
* Licence: GPL v2
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO/BUGS
|
||||
Flip first pixel doesn't work well
|
||||
Open with param
|
||||
*/
|
||||
|
||||
@ -27,7 +26,7 @@ Open with param
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
#define T_TITLE "Icon Editor 0.09"
|
||||
#define T_TITLE "Icon Editor 0.09b"
|
||||
|
||||
#define TOOLBAR_H 24+8
|
||||
#define PALLETE_SIZE 116
|
||||
@ -272,7 +271,7 @@ void DrawEditArea()
|
||||
canvas.w = image.columns * zoom.value;
|
||||
canvas.h = image.rows * zoom.value;
|
||||
if (canvas.w+2 > wrapper.w) || (canvas.h+2 > wrapper.h) {
|
||||
zoom.value--;
|
||||
zoom.click(BTN_ZOOM_OUT);
|
||||
DrawEditArea();
|
||||
return;
|
||||
}
|
||||
@ -361,7 +360,9 @@ void EventSave()
|
||||
{
|
||||
char save_buf[3126];
|
||||
memmov(#save_buf, #bmp_32x32x16_header, sizeof(bmp_32x32x16_header));
|
||||
image.move(FLIP_VER); //fix an issue that BMP image is flipped vertically
|
||||
memmov(#save_buf+sizeof(bmp_32x32x16_header), image.get_image(), sizeof(save_buf)-sizeof(bmp_32x32x16_header));
|
||||
image.move(FLIP_VER); //restore
|
||||
if (WriteFile(sizeof(save_buf), #save_buf, "/rd/1/saved_image.bmp")==0)
|
||||
{
|
||||
notify("'File saved as /rd/1/saved_image.bmp' -O");
|
||||
|
Loading…
Reference in New Issue
Block a user