forked from KolibriOS/kolibrios
IconEdit 0.7 Beta: open image of any color depth, bugfixes
lib/patterns/libimg_load_skin.h: convert into object git-svn-id: svn://kolibrios.org@7977 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b75bb6ed4d
commit
25c205ad05
@ -207,19 +207,19 @@ void Write_Error(int error_number)
|
|||||||
void LoadIcons()
|
void LoadIcons()
|
||||||
{
|
{
|
||||||
//ICONS16.PNG
|
//ICONS16.PNG
|
||||||
Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
|
icons16_default.load("/sys/icons16.png");
|
||||||
Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
|
icons16_selected.load("/sys/icons16.png");
|
||||||
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.selec);
|
icons16_selected.replace_color(0xffFFFfff, col.selec);
|
||||||
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.selec, 0, 200));
|
icons16_selected.replace_color(0xffCACBD6, MixColors(col.selec, 0, 200));
|
||||||
if (col.list_bg!=0xFFFfff) {
|
if (col.list_bg!=0xFFFfff) {
|
||||||
Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.list_bg);
|
icons16_default.replace_color(0xffFFFfff, col.list_bg);
|
||||||
Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.list_bg, 0, 200));
|
icons16_default.replace_color(0xffCACBD6, MixColors(col.list_bg, 0, 200));
|
||||||
}
|
}
|
||||||
//ICONS32.PNG
|
//ICONS32.PNG
|
||||||
Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
|
icons32_default.load("/sys/icons32.png");
|
||||||
Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
|
icons32_selected.load("/sys/icons32.png");
|
||||||
Libimg_ReplaceColor(icons32_default.image, icons32_selected.w, icons32_selected.h, 0x00000000, col.list_bg);
|
icons32_default.replace_color(0x00000000, col.list_bg);
|
||||||
Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, icons32_selected.h, 0x00000000, col.selec);
|
icons32_selected.replace_color(0x00000000, col.selec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAppColors()
|
void SetAppColors()
|
||||||
|
@ -165,7 +165,7 @@ dword _image::get_pixel(int _r, _c)
|
|||||||
void _image::set_image(dword _inbuf)
|
void _image::set_image(dword _inbuf)
|
||||||
{
|
{
|
||||||
dword i;
|
dword i;
|
||||||
for (i = 0; i < columns*rows; i++;)
|
for (i = 0; i < columns*rows-1; i++;)
|
||||||
{
|
{
|
||||||
// mas[i] = ESDWORD[i*4+_inbuf] & 0x00FFFFFF; //for x32 bit color
|
// mas[i] = ESDWORD[i*4+_inbuf] & 0x00FFFFFF; //for x32 bit color
|
||||||
mas[i] = ESDWORD[i*3+_inbuf] & 0xFFFFFF;
|
mas[i] = ESDWORD[i*3+_inbuf] & 0xFFFFFF;
|
||||||
|
@ -9,7 +9,7 @@ cls
|
|||||||
@del lang.h--
|
@del lang.h--
|
||||||
|
|
||||||
if exist iconedit (
|
if exist iconedit (
|
||||||
"C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\Leency\Desktop\kolibri.img" /H /Q /I iconedit
|
"C:\Program Files (x86)\WinImage\winimage.exe" "D:\Kolibri\Desktop\kolibri.img" /H /Q /I iconedit
|
||||||
d:
|
d:
|
||||||
cd "D:\Kolibri\Infrastructure\QEMU"
|
cd "D:\Kolibri\Infrastructure\QEMU"
|
||||||
call "z_kos.bat"
|
call "z_kos.bat"
|
||||||
|
@ -9,7 +9,7 @@ cls
|
|||||||
@del lang.h--
|
@del lang.h--
|
||||||
|
|
||||||
if exist iconedit (
|
if exist iconedit (
|
||||||
"C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\Leency\Desktop\kolibri.img" /H /Q /I iconedit
|
"C:\Program Files (x86)\WinImage\winimage.exe" "D:\Kolibri\Desktop\kolibri.img" /H /Q /I iconedit
|
||||||
d:
|
d:
|
||||||
cd "D:\Kolibri\Infrastructure\QEMU"
|
cd "D:\Kolibri\Infrastructure\QEMU"
|
||||||
call "z_kos.bat"
|
call "z_kos.bat"
|
||||||
|
@ -32,12 +32,16 @@
|
|||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
|
char edit_menu_items[] =
|
||||||
|
"‚ë१ âì|Ctrl+X
|
||||||
|
Š®¯¨à®¢ âì|Ctrl+C
|
||||||
|
‚áâ ¢¨âì|Ctrl+V";
|
||||||
char image_menu_items[] =
|
char image_menu_items[] =
|
||||||
"Š®«¨ç¥á⢮ ¨á¯®«ì§®¢ ëå 梥⮢
|
"Š®«¨ç¥á⢮ ¨á¯®«ì§®¢ ëå 梥⮢
|
||||||
‡ ¬¥¨âì ¢á¥ æ¢¥â 1 2";
|
‡ ¬¥¨âì ¢á¥ æ¢¥â 1 2";
|
||||||
?define T_MENU_IMAGE "ˆª®ª "
|
?define T_MENU_IMAGE "ˆª®ª "
|
||||||
?define T_TEST_ICON "<EFBFBD>஢¥à¨âì ¨ª®ªã"
|
?define T_TEST_ICON "<EFBFBD>஢¥à¨âì ¨ª®ªã"
|
||||||
?define T_TITLE "<EFBFBD>¥¤ ªâ®à ¨ª®®ª 0.60 Alpha"
|
?define T_TITLE "<EFBFBD>¥¤ ªâ®à ¨ª®®ª 0.70 Beta"
|
||||||
?define T_UNIC_COLORS_COUNT "'“¨ª «ìëå 梥⮢: %i.' -I"
|
?define T_UNIC_COLORS_COUNT "'“¨ª «ìëå 梥⮢: %i.' -I"
|
||||||
?define T_TOO_BIG_IMAGE_FOR_PREVIEW "'IconEdit
|
?define T_TOO_BIG_IMAGE_FOR_PREVIEW "'IconEdit
|
||||||
ˆ§®¡à ¦¥¨¥ ᫨誮¬ ¡®«ì讥 ¤«ï ¯à¥¤¯à®á¬®âà !' -tE"
|
ˆ§®¡à ¦¥¨¥ ᫨誮¬ ¡®«ì讥 ¤«ï ¯à¥¤¯à®á¬®âà !' -tE"
|
||||||
@ -45,12 +49,16 @@ char image_menu_items[] =
|
|||||||
?define T_ERROR_IMA_ICONEDIT "'<27>â® ¯à®á⮠। ªâ®à ¨ª®®ª, ¢ë¡à ®¥
|
?define T_ERROR_IMA_ICONEDIT "'<27>â® ¯à®á⮠। ªâ®à ¨ª®®ª, ¢ë¡à ®¥
|
||||||
¨§®¡à ¦¥¨¥ ᫨誮¬ ¢¥«¨ª® ¤«ï ¥£®!' -E"
|
¨§®¡à ¦¥¨¥ ᫨誮¬ ¢¥«¨ª® ¤«ï ¥£®!' -E"
|
||||||
#else
|
#else
|
||||||
|
char edit_menu_items[] =
|
||||||
|
"Cut|Ctrl+X
|
||||||
|
Copy|Ctrl+C
|
||||||
|
Paste|Ctrl+V";
|
||||||
char image_menu_items[] =
|
char image_menu_items[] =
|
||||||
"Count colors used
|
"Count colors used
|
||||||
Replace all colors equal to 1 by 2";
|
Replace all colors equal to 1 by 2";
|
||||||
?define T_MENU_IMAGE "Icon"
|
?define T_MENU_IMAGE "Icon"
|
||||||
?define T_TEST_ICON "Test Icon"
|
?define T_TEST_ICON "Test Icon"
|
||||||
?define T_TITLE "Icon Editor 0.60 Alpha"
|
?define T_TITLE "Icon Editor 0.70 Beta"
|
||||||
?define T_UNIC_COLORS_COUNT "'Image has %i unique colors.' -I"
|
?define T_UNIC_COLORS_COUNT "'Image has %i unique colors.' -I"
|
||||||
?define T_TOO_BIG_IMAGE_FOR_PREVIEW "'IconEdit
|
?define T_TOO_BIG_IMAGE_FOR_PREVIEW "'IconEdit
|
||||||
Image is too big for preview!' -tE"
|
Image is too big for preview!' -tE"
|
||||||
@ -160,28 +168,26 @@ void main()
|
|||||||
{
|
{
|
||||||
word btn;
|
word btn;
|
||||||
libimg_image open_image;
|
libimg_image open_image;
|
||||||
dword bg_col;
|
|
||||||
|
|
||||||
load_dll(libio, #libio_init, 1);
|
load_dll(libio, #libio_init, 1);
|
||||||
load_dll(libimg, #libimg_init, 1);
|
load_dll(libimg, #libimg_init, 1);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
|
|
||||||
Libimg_LoadImage(#top_icons, "/sys/icons16.png");
|
top_icons.load("/sys/icons16.png");
|
||||||
Libimg_LoadImage(#left_icons, "/sys/icons16.png");
|
left_icons.load("/sys/icons16.png");
|
||||||
|
|
||||||
sc.get();
|
sc.get();
|
||||||
bg_col = sc.work;
|
|
||||||
bg_dark = skin_is_dark();
|
bg_dark = skin_is_dark();
|
||||||
|
|
||||||
semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96);
|
semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96);
|
||||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
|
top_icons.replace_color(0xffFFFfff, semi_white);
|
||||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
|
top_icons.replace_color(0xffCACBD6, MixColors(semi_white, 0, 220));
|
||||||
|
|
||||||
Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffFFFfff, sc.work);
|
left_icons.replace_color(0xffFFFfff, sc.work);
|
||||||
Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffCACBD6, MixColors(sc.work, 0, 200));
|
left_icons.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200));
|
||||||
|
|
||||||
//fix line and rectandle color for dark skins
|
//fix line and rectandle color for dark skins
|
||||||
if (bg_dark) Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xff545454, 0xffD3D3D4);
|
if (bg_dark) left_icons.replace_color(0xff545454, 0xffD3D3D4);
|
||||||
|
|
||||||
EventSetActiveColor(1, color1);
|
EventSetActiveColor(1, color1);
|
||||||
|
|
||||||
@ -190,7 +196,7 @@ void main()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Libimg_LoadImage(#open_image, #param);
|
open_image.load_as24b(#param);
|
||||||
|
|
||||||
if (open_image.w*open_image.h>MAX_CELL_SIZE*MAX_CELL_SIZE) {
|
if (open_image.w*open_image.h>MAX_CELL_SIZE*MAX_CELL_SIZE) {
|
||||||
notify(T_ERROR_IMA_ICONEDIT);
|
notify(T_ERROR_IMA_ICONEDIT);
|
||||||
@ -369,14 +375,13 @@ void DrawWindow()
|
|||||||
DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, sc.work);
|
DrawBar(0, 0, Form.cwidth, TOPBAR_H-1, sc.work);
|
||||||
DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, sc.work_graph);
|
DrawBar(0, TOPBAR_H-1, Form.cwidth, 1, sc.work_graph);
|
||||||
|
|
||||||
tx.n = 5-GAPH;
|
DrawTopPanelButton(#EventCreateNewIcon, ECTRL + SCAN_CODE_KEY_N, tx.set(5), 2);
|
||||||
DrawTopPanelButton(#EventCreateNewIcon, ECTRL + SCAN_CODE_KEY_N, tx.inc(GAPH), 2);
|
|
||||||
DrawTopPanelButton(#EventOpenIcon, ECTRL + SCAN_CODE_KEY_O, tx.inc(GAPH), 0);
|
DrawTopPanelButton(#EventOpenIcon, ECTRL + SCAN_CODE_KEY_O, tx.inc(GAPH), 0);
|
||||||
DrawTopPanelButton(#EventSaveIconToFile, ECTRL + SCAN_CODE_KEY_S, tx.inc(GAPH), 5);
|
DrawTopPanelButton(#EventSaveIconToFile, ECTRL + SCAN_CODE_KEY_S, tx.inc(GAPH), 5);
|
||||||
DrawTopPanelButton(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAPH+BLOCK_SPACE), 30);
|
DrawTopPanelButton(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAPH+BLOCK_SPACE), 30);
|
||||||
DrawTopPanelButton(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAPH), 31);
|
DrawTopPanelButton(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAPH), 31);
|
||||||
DrawTopPanelButton(#EventMoveUp, ECTRL + SCAN_CODE_UP, tx.inc(GAPH), 32);
|
DrawTopPanelButton(#EventMoveUp, ECTRL + SCAN_CODE_UP, tx.inc(GAPH), 32);
|
||||||
DrawTopPanelButton(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAPH), 33);
|
DrawTopPanelButton(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAPH), 33);
|
||||||
DrawTopPanelButton(#EventFlipHor, 0, tx.inc(GAPH+BLOCK_SPACE), 34);
|
DrawTopPanelButton(#EventFlipHor, 0, tx.inc(GAPH+BLOCK_SPACE), 34);
|
||||||
DrawTopPanelButton(#EventFlipVer, 0, tx.inc(GAPH), 35);
|
DrawTopPanelButton(#EventFlipVer, 0, tx.inc(GAPH), 35);
|
||||||
DrawTopPanelButton(#EventRotateLeft, ECTRL + SCAN_CODE_KEY_L, tx.inc(GAPH), 37);
|
DrawTopPanelButton(#EventRotateLeft, ECTRL + SCAN_CODE_KEY_L, tx.inc(GAPH), 37);
|
||||||
@ -384,7 +389,7 @@ void DrawWindow()
|
|||||||
DrawTopPanelButton(#EventTestIcon, ECTRL + SCAN_CODE_KEY_T, tx.inc(GAPH+BLOCK_SPACE), 12);
|
DrawTopPanelButton(#EventTestIcon, ECTRL + SCAN_CODE_KEY_T, tx.inc(GAPH+BLOCK_SPACE), 12);
|
||||||
DrawTopPanelButton(#EventCrop, 0, tx.inc(GAPH+BLOCK_SPACE), 46);
|
DrawTopPanelButton(#EventCrop, 0, tx.inc(GAPH+BLOCK_SPACE), 46);
|
||||||
|
|
||||||
image_menu_btn.x = tx.n;
|
image_menu_btn.x = tx.inc(GAPH+BLOCK_SPACE);
|
||||||
image_menu_btn.w = DrawFlatPanelButton(button.add(#EventShowImageMenu), image_menu_btn.x, image_menu_btn.y, T_MENU_IMAGE);
|
image_menu_btn.w = DrawFlatPanelButton(button.add(#EventShowImageMenu), image_menu_btn.x, image_menu_btn.y, T_MENU_IMAGE);
|
||||||
//tx.inc(image_menu_btn.w + BLOCK_SPACE);
|
//tx.inc(image_menu_btn.w + BLOCK_SPACE);
|
||||||
|
|
||||||
@ -742,6 +747,12 @@ void EventShowImageMenu()
|
|||||||
image_menu_btn.y + image_menu_btn.h, MENU_ALIGN_TOP_LEFT, NULL, #image_menu_items);
|
image_menu_btn.y + image_menu_btn.h, MENU_ALIGN_TOP_LEFT, NULL, #image_menu_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventShowEditMenu()
|
||||||
|
{
|
||||||
|
open_lmenu(Form.left+5 + image_menu_btn.x, Form.top+skin_height +
|
||||||
|
image_menu_btn.y + image_menu_btn.h, MENU_ALIGN_TOP_LEFT, NULL, #edit_menu_items);
|
||||||
|
}
|
||||||
|
|
||||||
void EventCheckMenuItemSelected()
|
void EventCheckMenuItemSelected()
|
||||||
{
|
{
|
||||||
switch(get_menu_click()) {
|
switch(get_menu_click()) {
|
||||||
@ -794,14 +805,14 @@ void EventFlipVer() { EventMove(FLIP_VER); }
|
|||||||
void EventRotateLeft() { EventMove(ROTATE_LEFT); }
|
void EventRotateLeft() { EventMove(ROTATE_LEFT); }
|
||||||
void EventRotateRight() { EventMove(ROTATE_RIGHT); }
|
void EventRotateRight() { EventMove(ROTATE_RIGHT); }
|
||||||
|
|
||||||
void EventSelectToolPencil() { setCurrentTool(TOOL_PENCIL); DrawLeftPanelSelection(); }
|
void EventSelectToolPencil() { setCurrentTool(TOOL_PENCIL); }
|
||||||
void EventSelectToolPick() { setCurrentTool(TOOL_PIPETTE); DrawLeftPanelSelection(); }
|
void EventSelectToolPick() { setCurrentTool(TOOL_PIPETTE); }
|
||||||
void EventSelectToolFill() { setCurrentTool(TOOL_FILL); DrawLeftPanelSelection(); }
|
void EventSelectToolFill() { setCurrentTool(TOOL_FILL); }
|
||||||
void EventSelectToolLine() { setCurrentTool(TOOL_LINE); DrawLeftPanelSelection(); }
|
void EventSelectToolLine() { setCurrentTool(TOOL_LINE); }
|
||||||
void EventSelectToolRect() { setCurrentTool(TOOL_RECT); DrawLeftPanelSelection(); }
|
void EventSelectToolRect() { setCurrentTool(TOOL_RECT); }
|
||||||
void EventSelectToolBar() { setCurrentTool(TOOL_BAR); DrawLeftPanelSelection(); }
|
void EventSelectToolBar() { setCurrentTool(TOOL_BAR); }
|
||||||
void EventSelectToolSelect() { setCurrentTool(TOOL_SELECT); DrawLeftPanelSelection(); }
|
void EventSelectToolSelect() { setCurrentTool(TOOL_SELECT); }
|
||||||
void EventSelectToolScrCopy() { setCurrentTool(TOOL_SCREEN_COPY); DrawLeftPanelSelection(); }
|
void EventSelectToolScrCopy() { setCurrentTool(TOOL_SCREEN_COPY); }
|
||||||
|
|
||||||
char test_icon_stak22[4096];
|
char test_icon_stak22[4096];
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define TOCANVAS 2
|
#define TOCANVAS 2
|
||||||
|
|
||||||
|
|
||||||
struct Tool {
|
struct TOOL {
|
||||||
int id;
|
int id;
|
||||||
dword cursor;
|
dword cursor;
|
||||||
void (*activate)();
|
void (*activate)();
|
||||||
@ -10,11 +10,10 @@ struct Tool {
|
|||||||
void (*onMouseEvent)(int x, int y, int lkm, int pkm);
|
void (*onMouseEvent)(int x, int y, int lkm, int pkm);
|
||||||
void (*onKeyEvent)(dword keycode);
|
void (*onKeyEvent)(dword keycode);
|
||||||
void (*onCanvasDraw)();
|
void (*onCanvasDraw)();
|
||||||
};
|
} tools[8];
|
||||||
|
|
||||||
int previousTool = -1;
|
int previousTool = -1;
|
||||||
int currentTool = -1;
|
int currentTool = -1;
|
||||||
Tool tools[8];
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TOOL_NONE = -1,
|
TOOL_NONE = -1,
|
||||||
@ -108,6 +107,7 @@ void setCurrentTool(int index) {
|
|||||||
Cursor.Restore();
|
Cursor.Restore();
|
||||||
if (wrapper.hovered()) SetCursor();
|
if (wrapper.hovered()) SetCursor();
|
||||||
DrawCanvas();
|
DrawCanvas();
|
||||||
|
DrawLeftPanelSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCursor()
|
void SetCursor()
|
||||||
|
@ -30,6 +30,7 @@ dword img_destroy = #aimg_destroy;
|
|||||||
dword img_draw = #aimg_draw;
|
dword img_draw = #aimg_draw;
|
||||||
dword img_create = #aimg_create;
|
dword img_create = #aimg_create;
|
||||||
dword img_encode = #aimg_encode;
|
dword img_encode = #aimg_encode;
|
||||||
|
dword img_convert = #aimg_convert;
|
||||||
|
|
||||||
//dword img_flip = #aimg_flip;
|
//dword img_flip = #aimg_flip;
|
||||||
//dword img_rotate = #aimg_rotate;
|
//dword img_rotate = #aimg_rotate;
|
||||||
@ -42,11 +43,14 @@ char aimg_to_rgb2[] = "img_to_rgb2";
|
|||||||
char aimg_decode[] = "img_decode";
|
char aimg_decode[] = "img_decode";
|
||||||
char aimg_destroy[] = "img_destroy";
|
char aimg_destroy[] = "img_destroy";
|
||||||
char aimg_draw[] = "img_draw";
|
char aimg_draw[] = "img_draw";
|
||||||
char aimg_create[] = "img_create";
|
char aimg_create[] = "img_create";
|
||||||
char aimg_encode[] = "img_encode";
|
char aimg_encode[] = "img_encode";
|
||||||
|
char aimg_convert[] = "img_convert";
|
||||||
//char aimg_flip[] = "img_flip";
|
//char aimg_flip[] = "img_flip";
|
||||||
//char aimg_rotate[] = "img_rotate ";
|
//char aimg_rotate[] = "img_rotate ";
|
||||||
|
|
||||||
|
//invoke img.scale, ebx, 0, 0, [ebx + Image.Width], [ebx + Image.Height], 0, LIBIMG_SCALE_TYPE_STRETCH, LIBIMG_SCALE_ALG_BILINEAR, edx, ecx
|
||||||
|
|
||||||
#define LIBIMG_FORMAT_BMP 1
|
#define LIBIMG_FORMAT_BMP 1
|
||||||
#define LIBIMG_FORMAT_ICO 2
|
#define LIBIMG_FORMAT_ICO 2
|
||||||
#define LIBIMG_FORMAT_CUR 3
|
#define LIBIMG_FORMAT_CUR 3
|
||||||
@ -236,6 +240,13 @@ struct _Image
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:dword convert_image(dword _image_pointer, _w, _h, _path)
|
||||||
|
{
|
||||||
|
img_convert stdcall(_image_pointer, 0, Image_bpp32, 0, 0);
|
||||||
|
if (EAX!=0)
|
||||||
|
mov [image_converted], eax
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H
|
#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H
|
||||||
#include "../lib/patterns/libimg_load_skin.h"
|
#include "../lib/patterns/libimg_load_skin.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,38 +7,60 @@
|
|||||||
|
|
||||||
:struct libimg_image {
|
:struct libimg_image {
|
||||||
dword image, w, h, imgsrc;
|
dword image, w, h, imgsrc;
|
||||||
|
void load_as24b();
|
||||||
|
void load();
|
||||||
|
void replace_color();
|
||||||
|
void fill_transparent();
|
||||||
} skin;
|
} skin;
|
||||||
|
|
||||||
:void Libimg_LoadImage(dword struct_pointer, file_path)
|
:void libimg_image::load_as24b(dword file_path)
|
||||||
{
|
{
|
||||||
dword image_pointer;
|
dword image_pointer = load_image(file_path);
|
||||||
image_pointer = load_image(file_path);
|
|
||||||
if (!image_pointer) notify("'Error: Image not loaded' -E");
|
if (!image_pointer) notify("'Error: Image not loaded' -E");
|
||||||
ESDWORD[struct_pointer] = image_pointer;
|
|
||||||
ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
|
img_convert stdcall(image_pointer, 0, Image_bpp24, 0, 0);
|
||||||
ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
|
if (!EAX) {
|
||||||
ESDWORD[struct_pointer+12] = ESDWORD[image_pointer+24];
|
notify("'Error: Image can not be converted to 24b' -E");
|
||||||
|
} else {
|
||||||
|
image = image_pointer = EAX;
|
||||||
|
w = DSWORD[image_pointer+4];
|
||||||
|
h = DSWORD[image_pointer+8];
|
||||||
|
imgsrc = ESDWORD[image_pointer+24];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:void Libimg_ReplaceColor(dword struct_pointer, w, h, old_color, new_color)
|
:void libimg_image::load(dword file_path)
|
||||||
{
|
{
|
||||||
dword i, max_i, image_data;
|
dword image_pointer = load_image(file_path);
|
||||||
image_data = ESDWORD[struct_pointer + 24];
|
if (!EAX) {
|
||||||
max_i = w * h * 4 + image_data;
|
notify("'Error: Image not loaded' -E");
|
||||||
for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==old_color) DSDWORD[i] = new_color;
|
} else {
|
||||||
|
image = image_pointer = EAX;
|
||||||
|
w = DSWORD[image_pointer+4];
|
||||||
|
h = DSWORD[image_pointer+8];
|
||||||
|
imgsrc = ESDWORD[image_pointer+24];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:void Libimg_FillTransparent(dword struct_pointer, w, h, new_color)
|
:void libimg_image::replace_color(dword old_color, new_color)
|
||||||
{
|
{
|
||||||
if (new_color!=0) Libimg_ReplaceColor(struct_pointer, w, h, 0, new_color);
|
dword i, max_i;
|
||||||
|
max_i = w * h * 4 + imgsrc;
|
||||||
|
for (i = imgsrc; i < max_i; i += 4) if (DSDWORD[i]==old_color) DSDWORD[i] = new_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
:void libimg_image::fill_transparent(new_color)
|
||||||
|
{
|
||||||
|
if (new_color) replace_color(0, new_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
:libimg_image icons32draw;
|
:libimg_image icons32draw;
|
||||||
:void DrawIcon32(dword x,y, bg, icon_n) {
|
:void DrawIcon32(dword x,y, bg, icon_n) {
|
||||||
//load_dll(libimg, #libimg_init,1);
|
//load_dll(libimg, #libimg_init,1);
|
||||||
if (!icons32draw.image) {
|
if (!icons32draw.image) {
|
||||||
Libimg_LoadImage(#icons32draw, "/sys/icons32.png");
|
icons32draw.load("/sys/icons32.png");
|
||||||
Libimg_FillTransparent(icons32draw.image, icons32draw.w, icons32draw.h, bg);
|
icons32draw.fill_transparent(bg);
|
||||||
}
|
}
|
||||||
if (icon_n>=0) img_draw stdcall(icons32draw.image, x, y, 32, 32, 0, icon_n*32);
|
if (icon_n>=0) img_draw stdcall(icons32draw.image, x, y, 32, 32, 0, icon_n*32);
|
||||||
}
|
}
|
||||||
@ -47,9 +69,9 @@
|
|||||||
:void DrawIcon16(dword x,y, bg, icon_n) {
|
:void DrawIcon16(dword x,y, bg, icon_n) {
|
||||||
//load_dll(libimg, #libimg_init,1);
|
//load_dll(libimg, #libimg_init,1);
|
||||||
if (!icons16draw.image) {
|
if (!icons16draw.image) {
|
||||||
Libimg_LoadImage(#icons16draw, "/sys/icons16.png");
|
icons16draw.load("/sys/icons16.png");
|
||||||
Libimg_ReplaceColor(icons16draw.image, icons16draw.w, icons16draw.h, 0xffFFFfff, bg);
|
icons16draw.replace_color(0xffFFFfff, bg);
|
||||||
Libimg_ReplaceColor(icons16draw.image, icons16draw.w, icons16draw.h, 0xffCACBD6, MixColors(bg, 0, 220));
|
icons16draw.replace_color(0xffCACBD6, MixColors(bg, 0, 220));
|
||||||
}
|
}
|
||||||
if (icon_n>=0) img_draw stdcall(icons16draw.image, x, y, 16, 16, 0, icon_n*16);
|
if (icon_n>=0) img_draw stdcall(icons16draw.image, x, y, 16, 16, 0, icon_n*16);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@ unsigned int DrawTopPanelButton(dword _button_id, _x, _y, signed int _icon_n, bo
|
|||||||
static dword semi_white=0, bg_col_light, bg_col_dark;
|
static dword semi_white=0, bg_col_light, bg_col_dark;
|
||||||
int i;
|
int i;
|
||||||
if (!semi_white) {
|
if (!semi_white) {
|
||||||
Libimg_LoadImage(#top_icons, "/sys/icons16.png");
|
top_icons.load("/sys/icons16.png");
|
||||||
|
|
||||||
semi_white = MixColors(sc.work, 0xFFFfff, skin_is_dark()*90 + 96);
|
semi_white = MixColors(sc.work, 0xFFFfff, skin_is_dark()*90 + 96);
|
||||||
bg_col_dark = MixColors(sc.work, sc.work_graph, 90);
|
bg_col_dark = MixColors(sc.work, sc.work_graph, 90);
|
||||||
bg_col_light = MixColors(semi_white, 0xFFFfff, skin_is_dark()*90 + 10);
|
bg_col_light = MixColors(semi_white, 0xFFFfff, skin_is_dark()*90 + 10);
|
||||||
|
|
||||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
|
top_icons.replace_color(0xffFFFfff, semi_white);
|
||||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
|
top_icons.replace_color(0xffCACBD6, MixColors(semi_white, 0, 220));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawWideRectangle(_x+1, _y+1, TSZE, TSZE, 5, semi_white);
|
DrawWideRectangle(_x+1, _y+1, TSZE, TSZE, 5, semi_white);
|
||||||
|
@ -44,8 +44,8 @@ void main()
|
|||||||
load_dll(libio, #libio_init,1);
|
load_dll(libio, #libio_init,1);
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
|
|
||||||
Libimg_LoadImage(#skin, "/sys/icons32.png");
|
skin.load("/sys/icons32.png");
|
||||||
Libimg_FillTransparent(skin.image, skin.w, skin.h, COLOR_CELL_BG);
|
skin.fill_transparent(COLOR_CELL_BG);
|
||||||
|
|
||||||
NewGame();
|
NewGame();
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ void SetAppColors()
|
|||||||
|
|
||||||
void LoadImages()
|
void LoadImages()
|
||||||
{
|
{
|
||||||
Libimg_LoadImage(#skin, "/sys/icons32.png");
|
skin.load("/sys/icons32.png");
|
||||||
Libimg_FillTransparent(skin.image, skin.w, skin.h, swc.list_bg);
|
skin.fill_transparent(swc.list_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void LoadIniConfig()
|
|||||||
win_y_small = ini.GetInt("win_y_small", -1);
|
win_y_small = ini.GetInt("win_y_small", -1);
|
||||||
ini.GetString("last_folder", #work_folder, sizeof(work_folder), NULL);
|
ini.GetString("last_folder", #work_folder, sizeof(work_folder), NULL);
|
||||||
|
|
||||||
Libimg_LoadImage(#skin, abspath("pixieskn.png"));
|
skin.load(abspath("pixieskn.png"));
|
||||||
skin.w = 322;
|
skin.w = 322;
|
||||||
theme.color_top_panel_bg = 0x242424;
|
theme.color_top_panel_bg = 0x242424;
|
||||||
theme.color_top_panel_folder_name = 0xEEEeee;
|
theme.color_top_panel_folder_name = 0xEEEeee;
|
||||||
|
@ -64,8 +64,8 @@ void main()
|
|||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(libini, #lib_init,1);
|
load_dll(libini, #lib_init,1);
|
||||||
|
|
||||||
Libimg_LoadImage(#skin, "/sys/icons32.png");
|
skin.load("/sys/icons32.png");
|
||||||
Libimg_FillTransparent(skin.image, skin.w, skin.h, COLOR_BG);
|
skin.fill_transparent(COLOR_BG);
|
||||||
|
|
||||||
ini_get_int stdcall ("/sys/appicons.ini", "taskbar", "attachement", ATTACHEMENT_BOTTOM);
|
ini_get_int stdcall ("/sys/appicons.ini", "taskbar", "attachement", ATTACHEMENT_BOTTOM);
|
||||||
attachement = EAX;
|
attachement = EAX;
|
||||||
|
@ -126,9 +126,9 @@ void main()
|
|||||||
|
|
||||||
load_dll(libio, #libio_init,1);
|
load_dll(libio, #libio_init,1);
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
Libimg_LoadImage(#menu, abspath("menu.png"));
|
menu.load(abspath("menu.png"));
|
||||||
Libimg_LoadImage(#road, abspath("road.png"));
|
road.load(abspath("road.png"));
|
||||||
Libimg_LoadImage(#objects, abspath("objects.png"));
|
objects.load(abspath("objects.png"));
|
||||||
|
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user