CMM APPS: use img_file_load (at least mblocks -1 sector)

git-svn-id: svn://kolibrios.org@8381 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-13 00:32:34 +00:00
parent 99103794f2
commit 82dc2376da
11 changed files with 66 additions and 64 deletions

View File

@ -106,7 +106,6 @@ void main()
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(Proc_lib, #OpenDialog_init,0);
o_dialog.type = 2; //select folder

View File

@ -48,10 +48,10 @@ char *unicode_symbols[]={
"#8594", "->",
"uarr", "\24",
"darr", "\25",
"rarr", "\26",
"larr", "\27",
"uarr", "^",
"darr", "v",
"rarr", "->",
"larr", "<-",
"bull", "\31",
"percnt","%",

View File

@ -13,7 +13,6 @@
#include "../lib/gui.h"
#include "../lib/list_box.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/libini.h"
#include "../lib/collection.h"
@ -88,7 +87,6 @@ byte process_sections(dword sec_name, f_name)
void main()
{
load_dll(libio, #libio_init,1);
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
load_dll(libimg, #libimg_init,1);

View File

@ -23,6 +23,7 @@
#include "../lib/collection.h"
#include "../lib/copyf.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/libimg.h"

View File

@ -13,6 +13,7 @@
#include "../lib/list_box.h"
#include "../lib/events.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/box_lib.h"

View File

@ -47,7 +47,7 @@ void DrawBufer::Fill(dword start_pointer, i_fill_color)
dword i;
dword max_i = bufw * bufh * 4 + buf_data + 8;
fill_color = i_fill_color;
MEMSETD(buf_data+start_pointer+8, max_i-buf_data-start_pointer-8/4, fill_color);
@MEMSETD(buf_data+start_pointer+8, max_i-buf_data-start_pointer-8/4, fill_color);
}
void DrawBufer::DrawBar(dword x, y, w, h, color)
@ -158,9 +158,9 @@ void DrawBufer::Zoom2x(int zoom)
*/
void DrawBufer::Show()
void DrawBufer::Show(dword _y_offset)
{
PutPaletteImage(buf_data+8, bufw, bufh, bufx, bufy, 32, 0);
PutPaletteImage(_y_offset * bufw * 4 + buf_data+8, bufw, bufh, bufx, bufy, 32, 0);
}
void DrawBufer::IncreaseBufSize()

View File

@ -14,38 +14,36 @@
#include "../lib/dll.h"
#endif
#ifndef INCLUDE_LIBIO_H
#include "../lib/obj/libio.h"
#endif
//library
dword libimg = #alibimg;
char alibimg[] = "/sys/lib/libimg.obj";
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw;
dword img_create = #aimg_create;
dword img_encode = #aimg_encode;
dword img_convert = #aimg_convert;
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw;
dword img_create = #aimg_create;
dword img_encode = #aimg_encode;
dword img_convert = #aimg_convert;
dword img_from_file = #aimg_from_file;
//dword img_flip = #aimg_flip;
//dword img_rotate = #aimg_rotate;
$DD 2 dup 0
//import libimg , \
char alibimg_init[] = "lib_init";
char aimg_is_img[] = "img_is_img";
char aimg_to_rgb2[] = "img_to_rgb2";
char aimg_decode[] = "img_decode";
char aimg_destroy[] = "img_destroy";
char aimg_draw[] = "img_draw";
char aimg_create[] = "img_create";
char aimg_encode[] = "img_encode";
char aimg_convert[] = "img_convert";
char alibimg_init[] = "lib_init";
char aimg_is_img[] = "img_is_img";
char aimg_to_rgb2[] = "img_to_rgb2";
char aimg_decode[] = "img_decode";
char aimg_destroy[] = "img_destroy";
char aimg_draw[] = "img_draw";
char aimg_create[] = "img_create";
char aimg_encode[] = "img_encode";
char aimg_convert[] = "img_convert";
char aimg_from_file[] = "img_from_file";
//char aimg_flip[] = "img_flip";
//char aimg_rotate[] = "img_rotate ";
@ -292,27 +290,38 @@ struct libimg_image
/////////////////////////////
:void DrawIcon32(dword x,y, _bg, icon_n) {
static libimg_image i32;
static dword bg;
//load_dll(libimg, #libimg_init,1);
if (!i32.image) || (bg!=_bg) {
static dword pure_img32;
if (!pure_img32) || (bg!=_bg) {
bg = _bg;
i32.load("/sys/icons32.png");
i32.replace_color(0x00000000, bg);
img_from_file stdcall("/sys/icons32.png");
pure_img32 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0x00000000) DSDWORD[ESI] = bg;
}
}
if (icon_n>=0) i32.draw(x, y, 32, 32, 0, icon_n*32);
img_draw stdcall(pure_img32, x, y, 32, 32, 0, icon_n*32);
}
:void DrawIcon16(dword x,y, bg, icon_n) {
static libimg_image i16;
//load_dll(libimg, #libimg_init,1);
if (!i16.image) {
i16.load("/sys/icons16.png");
i16.replace_color(0xffFFFfff, bg);
i16.replace_color(0xffCACBD6, MixColors(bg, 0, 220));
:void DrawIcon16(dword x,y, _bg, icon_n) {
static dword bg;
static dword pure_img16;
dword bgshadow;
if (!pure_img16) || (bg!=_bg) {
bg = _bg;
bgshadow = MixColors(bg, 0, 220);
img_from_file stdcall("/sys/icons16.png");
pure_img16 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0xffFFFfff) DSDWORD[ESI] = bg;
if (DSDWORD[ESI]==0xffCACBD6) DSDWORD[ESI] = bgshadow;
}
}
if (icon_n>=0) i16.draw(x, y, 16, 16, 0, icon_n*16);
img_draw stdcall(pure_img16, x, y, 16, 16, 0, icon_n*16);
}
#endif

View File

@ -4,6 +4,7 @@
#include "../lib/mem.h"
#include "../lib/gui.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"

View File

@ -10,7 +10,6 @@
#include "..\lib\gui.h"
#include "..\lib\random.h"
#include "..\lib\obj\libio.h"
#include "..\lib\obj\libimg.h"
#ifndef AUTOBUILD
@ -45,7 +44,6 @@ int count;
void main()
{
dword id;
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
NewGame();
@ -157,7 +155,7 @@ void ReDraw_Game_Button(int id)
case BTN_OPEN:
DrawBar(xx+1, yy+1, CELL_SIZE-1, CELL_SIZE-1, 0xFFFfff);//background
}
DrawIcon32(xx+6, yy+6, 0xFFFfff, bitpict[id]);
DrawIcon32(xx+6, yy+6, 0xFFFfff, bitpict[id]+51); //skip first 51 icons as they are boring for game
}
void Draw_Panel()

View File

@ -28,6 +28,7 @@
#include "../lib/obj/box_lib.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/iconv.h"
#include "../lib/obj/proc_lib.h"

View File

@ -1,6 +1,6 @@
/*
* System Monitor
* version 1.35
* version 1.36
* Author: Leency
*/
@ -43,9 +43,6 @@
#define BOTPANEL_H 36
#ifdef LANG_RUS
#define T_CPU_AND_RAM "<22>à®æ¥áá®à ¨ Ž‡“"
#define T_DRIVES "„¨áª¨"
#define T_PROCESSES "<22>à®æ¥ááë"
#define T_APP_TITLE "‘¨á⥬­ë© ¬®­¨â®à"
#define T_SHOW_SYSTEM "‘¨á⥬­ë¥"
#define T_DETAILS "<22>®¤à®¡­¥¥"
@ -57,9 +54,6 @@
#define T_RD_USAGE "‘¨á⥬­ë© ¤¨áª: %i Š¡ ᢮¡®¤­® ¨§ 1.4 Œ¡"
#define T_TMP_USAGE "TMP%i ¤¨áª: %i Œ¡ ᢮¡®¤­® ¨§ %i Œ¡"
#else
#define T_CPU_AND_RAM "CPU & RAM"
#define T_DRIVES "Drives"
#define T_PROCESSES "Processes"
#define T_APP_TITLE "System Monitor"
#define T_SHOW_SYSTEM "System"
#define T_DETAILS "Details"
@ -118,7 +112,7 @@ void main()
//dword cpu_frequency = GetCpuFrequency()/1000;
load_lib();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(@WaitEventTimeout(120))
loop() switch(@WaitEventTimeout(50))
{
case evMouse:
SelectList_ProcessMouse();
@ -175,9 +169,9 @@ void main()
ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23);
rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23);
default:
SelectList_LineChanged();
MonitorCpu();
MonitorRam();
SelectList_LineChanged();
MonitorRd();
MonitorTmp();
}
@ -343,11 +337,11 @@ void MonitorCpu()
sprintf(#param, T_CPU_LOAD, cpu_stack[pos]);
DrawIconWithText(RIGHT_X, cpu.y - 25, 48, #param);
for (i=0; i<right_w; i+=2) {
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_CPU);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
#define LINEW 8
for (i=0; i<right_w; i+=LINEW) {
DrawBar(i+cpu.x, cpu.y, LINEW, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, LINEW, cpu_stack[i], 0xDFA13B);
//DrawBar(i+LINEW+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
}
pos++;