fix Liza, upload some experimental programs

git-svn-id: svn://kolibrios.org@5520 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-03-16 14:23:55 +00:00
parent 024cd8ec51
commit 20b79b5a5a
8 changed files with 254 additions and 8 deletions

View File

@ -0,0 +1,9 @@
@del lang.h--
@echo #define LANG_ENG 1 >lang.h--
C-- easyshot.c
@del easyshot
@rename easyshot.com easyshot
@del warning.txt
@del lang.h--
@pause

View File

@ -0,0 +1,9 @@
@del lang.h--
@echo #define LANG_RUS 1 >lang.h--
C-- easyshot.c
@del easyshot
@rename easyshot.com easyshot
@del warning.txt
@del lang.h--
@pause

View File

@ -0,0 +1,130 @@
#define MEMSIZE 0xFFFFF
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\gui.h"
#ifndef AUTOBUILD
#include "lang.h--"
#endif
/* === DATA === */
system_colors sc;
proc_info Form;
dword b_screen,
s_screen;
int b_screen_width,
b_screen_height,
b_screen_length,
s_screen_width,
s_screen_height,
s_screen_length;
/* === CODE === */
void main()
{
char id;
mem_Init();
b_screen_width = GetScreenWidth()+1;
b_screen_height = GetScreenHeight()+1;
b_screen_length = b_screen_width*b_screen_height*3;
s_screen_width = b_screen_width / 2;
s_screen_height = b_screen_height / 2;
s_screen_length = b_screen_length / 2;
b_screen = malloc(b_screen_length);
s_screen = malloc(b_screen_length/2);
loop()
{
switch(WaitEvent())
{
case evButton:
id = GetButtonID();
if (id==1) ExitProcess();
if (id==10) TakeScreenshot();
break;
case evReDraw:
sc.get();
DefineAndDrawWindow(b_screen_width/4, b_screen_height/4, s_screen_width + 9, s_screen_height + GetSkinHeight() + 45,0x74, 0, "EasyShot v0.2",0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
DrawBar(0, 0, Form.cwidth, 41, sc.work);
DrawCaptButton(10, 10, 140, 20, 10, sc.work_button, sc.work_button_text, "Make screenshot");
_PutImage(0, Form.cheight - s_screen_height, s_screen_width, s_screen_height, s_screen);
if (ESDWORD[s_screen]==0)
WriteTextB(Form.cwidth/2 - 60, Form.cheight/2+10, 0x90, 0xFFFfff, "There will be preview");
else
DrawCaptButton(160, 10, 80, 20, 11, sc.work_button, sc.work_button_text, "Save");
}
}
}
void TakeScreenshot() {
MinimizeWindow();
pause(20);
CopyScreen(b_screen, 0, 0, b_screen_width, b_screen_height);
ZoomImageTo50percent();
ActivateWindow(GetProcessSlot(Form.ID));
//_PutImage(0, Form.cheight - s_screen_height, s_screen_width, s_screen_height, s_screen);
}
void ZoomImageTo50percent() {
dword point_x,
line_h= b_screen_width * 3,
s_off = s_screen + 3,
b_off = b_screen + 6,
b_off_r,
b_off_g,
b_off_b,
rez_r,
rez_g,
rez_b;
while( (s_off < s_screen + s_screen_length) && (b_off < b_screen + b_screen_length ) ) {
if (b_off < b_screen + line_h) || (b_off > b_screen + b_screen_length - line_h)
{
ESBYTE[s_off] = ESBYTE[b_off];
ESBYTE[s_off+1] = ESBYTE[b_off+1];
ESBYTE[s_off+2] = ESBYTE[b_off+2];
}
else
{
// line[x].R = (line[x+1].R + line[x].R + line[x-1].R + line1[x].R + line2[x].R) / 5;
// line[x].G = (line[x+1].G + line[x].G + line[x-1].G + line1[x].G + line2[x].G) / 5;
// line[x].B = (line[x+1].B + line[x].B + line[x-1].B + line1[x].B + line2[x].B) / 5
b_off_r = b_off;
b_off_g = b_off + 1;
b_off_b = b_off + 2;
rez_r = ESBYTE[b_off_r+3] + ESBYTE[b_off_r] + ESBYTE[b_off_r-3] + ESBYTE[b_off_r-line_h] + ESBYTE[b_off_r+line_h] / 5;
rez_g = ESBYTE[b_off_g+3] + ESBYTE[b_off_g] + ESBYTE[b_off_g-3] + ESBYTE[b_off_g-line_h] + ESBYTE[b_off_g+line_h] / 5;
rez_b = ESBYTE[b_off_b+3] + ESBYTE[b_off_b] + ESBYTE[b_off_b-3] + ESBYTE[b_off_b-line_h] + ESBYTE[b_off_b+line_h] / 5;
ESBYTE[s_off] = rez_r;
ESBYTE[s_off+1] = rez_g;
ESBYTE[s_off+2] = rez_b;
}
s_off+=3;
b_off+=6;
point_x+=2;
if (point_x >= b_screen_width)
{
b_off += line_h;
point_x = 0;
}
}
}
stop:

View File

@ -0,0 +1,10 @@
C-- ttf_performance.c
@del ttf_performance
@rename ttf_performance.com ttf_performance
kpack ttf_performance
@del warning.txt
@pause
@rem ====== Automatically add binnary to kolibri.img and then run QEMU =====
"C:\Program Files (x86)\WinImage\WINIMAGE.exe" D:\Kolibri\work\QEMU\kolibri.img /I /H/Q C:\Users\lee\Desktop\CMM\ttf_performance\ttf_performance
@cd /d D:\Kolibri\work\QEMU
D:\Kolibri\work\QEMU\qemu-kos-img.bat

View File

@ -0,0 +1,89 @@
#define MEMSIZE 397113
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\file_system.h"
#include "..\lib\dll.h"
#include "..\lib\obj\truetype.h"
proc_info Form;
dword font_data;
stbtt_fontinfo font_info;
inline fastcall dword get_start_time()
{
$mov eax,26
$mov ebx,9
$int 0x40
}
#define TESTS_NUM 10
char test_text[] = "The quick brown fox jumps over the lazy dog";
word rez[TESTS_NUM];
void main()
{
BDVK FontFile_atr;
int id, key;
mem_Init();
if (load_dll2(libtruetype, #truetype, 1) != 0) notify("Error: library doesn't exists - truetype");
if (param[0]==0) strcpy(#param, "/sys/arial.ttf");
GetFileInfo(#param, #FontFile_atr);
font_data = malloc(FontFile_atr.sizelo);
ReadFile(0, FontFile_atr.sizelo, #font_data, #param);
init_font stdcall (#font_info, #font_data);
if (EAX==0) notify("init_font failed");
loop()
{
switch(WaitEvent())
{
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
break;
case evKey:
key = GetKey();
IF (key==013){ //Enter
debug("Tests count: ");
debugi(TESTS_NUM);
for (id=0; id<TESTS_NUM; id++)
{
rez[id] = DrawFonts();
debugi(rez[id]);
}
debugln("Done");
}
break;
case evReDraw:
DefineAndDrawWindow(30,100,800,300,0x34,0xFFFFFF,"TTF Viewer v0.1");
GetProcessInfo(#Form, SelfInfo);
WriteTextB(50,85,0x90,0xFF00FF,"Press Enter to start testing");
break;
}
}
}
word DrawFonts()
{
dword time1, time2;
time1 = get_start_time();
text_out stdcall (#test_text, #font_info, 10, time1, 0xFFFfff, 3, 4);
text_out stdcall (#test_text, #font_info, 12, time1, 0xFFFfff, 3, 18);
text_out stdcall (#test_text, #font_info, 24, time1, 0xFFFfff, 3, 35);
text_out stdcall (#test_text, #font_info, 36, time1, 0xFFFfff, 3, 60);
text_out stdcall (#test_text, #font_info, 48, time1, 0xFFFfff, 3, 110);
text_out stdcall (#test_text, #font_info, 58, time1, 0xFFFfff, 3, 170);
time2 = get_start_time();
return time2 - time1;
}
stop:

View File

@ -29,7 +29,7 @@ dword frame_draw = #aFrame_draw;
$DD 2 dup 0
char aEdit_box_draw [] = "edit_box";
char aEdit_box_draw [] = "edit_box";
char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse";
char aVersion_ed [] = "version_ed";

View File

@ -1,7 +1,6 @@
char fontinfo[28];
// Truetype library
dword libtruetype = #att_libtruetype;
char att_libtruetype[22] = "/sys/lib/truetype.obj\0";
dword truetype = #att_truetype; // truetype(unsigned char *s, stbtt_fontinfo *buffer, char *screen1, int width, int height)
@ -10,20 +9,20 @@ dword get_width = #att_get_width; // get_width_utf8(unsigned char *s, stbtt_f
dword text_out = #att_text_out; // text_out(unsigned char *string, char *buffer, int height, int color,int back_color, int x, int y)
dword init_font = #att_init_font; // init_font(stbtt_fontinfo *font,unsigned char *FontData)
dword text_out_mem = #att_text_out_mem; // text_out_mem(unsigned char *string, stbtt_fontinfo *buffer, int height, int color,int back_color)
dword text_scale_EM = #att_text_scale; // scale_EM(stbtt_fontinfo *buffer, int size)
$DD 2 dup 0
char att_truetype[] = "truetype";
char att_get_length[] = "get_length";
char att_get_width[] = "get_width";
char att_text_out[] = "text_out";
char att_init_font[] = "init_font";
char att_text_out_mem[] = "text_out_mem";
char att_text_scale[] = "scale_EM";
char att_init_font[] = "init_font";
//============================================================
//============================================================
char fontinfo[28];
struct stbtt_fontinfo
{
dword userdata;

View File

@ -87,7 +87,7 @@ dword col_bg;
dword panel_color;
dword border_color;
progress_bar progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
progress_bar wv_progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
int http_transfer;
char version[]=" WebView 0.1";