new program 'img_transform',
small fix in 'tinygl.obj' git-svn-id: svn://kolibrios.org@7929 a494cfbc-eb01-0410-851d-a64ba20cac60
@ -1,5 +1,5 @@
|
||||
use32
|
||||
org 0x0
|
||||
org 0
|
||||
db 'MENUET01'
|
||||
dd 1,start,i_end,mem,stacktop,0,cur_dir_path
|
||||
|
||||
@ -112,7 +112,7 @@ draw_window:
|
||||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||||
mcall ,,,(95 shl 16)+5 ;масштаб -
|
||||
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
popad
|
||||
ret
|
||||
@ -146,7 +146,7 @@ key:
|
||||
mov byte[txt_angle_y.v],0
|
||||
stdcall str_cat, txt_angle_y.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,177 ;Down
|
||||
jne @f
|
||||
@ -160,7 +160,7 @@ key:
|
||||
mov byte[txt_angle_y.v],0
|
||||
stdcall str_cat, txt_angle_y.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,176 ;Left
|
||||
jne @f
|
||||
@ -174,7 +174,7 @@ key:
|
||||
mov byte[txt_angle_z.v],0
|
||||
stdcall str_cat, txt_angle_z.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,179 ;Right
|
||||
jne @f
|
||||
@ -188,7 +188,7 @@ key:
|
||||
mov byte[txt_angle_z.v],0
|
||||
stdcall str_cat, txt_angle_z.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
|
||||
jmp still
|
||||
@ -227,14 +227,14 @@ align 4
|
||||
but_dr_0:
|
||||
mov dword[dr_figure],0
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
but_dr_1:
|
||||
mov dword[dr_figure],1
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -257,7 +257,7 @@ but_zoom_p:
|
||||
mov byte[txt_scale.v],0
|
||||
stdcall str_cat, txt_scale.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -280,14 +280,11 @@ but_zoom_m:
|
||||
mov byte[txt_scale.v],0
|
||||
stdcall str_cat, txt_scale.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
|
||||
align 4
|
||||
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||
;sizeof.TinyGLContext = 28
|
||||
|
||||
align 4
|
||||
draw_3d:
|
||||
@ -387,13 +384,6 @@ stdcall [glPopMatrix]
|
||||
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,25,0xffff00
|
||||
ret
|
||||
|
||||
dr_figure dd 0
|
||||
qObj dd 0
|
||||
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
|
||||
texture dd 0 ;указатель на память с текстурой
|
||||
text_w dd 0
|
||||
text_h dd 0
|
||||
|
||||
scale dd 0.4 ;начальный масштаб
|
||||
sc_delt dd 0.05 ;изменение масштаба при нажатии
|
||||
sc_min dd 0.1 ;минимальный масштаб
|
||||
@ -534,14 +524,14 @@ system_dir_1 db '/sys/lib/'
|
||||
lib_name_1 db 'buf2d.obj',0
|
||||
system_dir_2 db '/sys/lib/'
|
||||
lib_name_2 db 'libimg.obj',0
|
||||
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0
|
||||
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0
|
||||
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0
|
||||
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
|
||||
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
|
||||
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
|
||||
head_f_i:
|
||||
head_f_l db 'System error',0
|
||||
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0
|
||||
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0
|
||||
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0
|
||||
head_f_l db '"System error',0
|
||||
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
|
||||
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
|
||||
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
|
||||
;--------------------------------------------------
|
||||
|
||||
txt_scale:
|
||||
@ -589,6 +579,14 @@ l_libs_end:
|
||||
|
||||
align 4
|
||||
i_end:
|
||||
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||
;sizeof.TinyGLContext = 28
|
||||
dr_figure dd 0
|
||||
qObj dd 0
|
||||
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
|
||||
texture dd 0 ;указатель на память с текстурой
|
||||
text_w dd 0
|
||||
text_h dd 0
|
||||
run_file_70 FileInfoBlock
|
||||
sc system_colors
|
||||
align 16
|
||||
|
@ -1,5 +1,5 @@
|
||||
use32
|
||||
org 0x0
|
||||
org 0
|
||||
db 'MENUET01'
|
||||
dd 1,start,i_end,mem,stacktop,0,cur_dir_path
|
||||
|
||||
@ -114,7 +114,7 @@ draw_window:
|
||||
add ebx,IMAGE_TOOLBAR_ICON_SIZE
|
||||
mcall ,,,(95 shl 16)+5 ;масштаб -
|
||||
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
popad
|
||||
ret
|
||||
@ -148,7 +148,7 @@ key:
|
||||
mov byte[txt_angle_y.v],0
|
||||
stdcall str_cat, txt_angle_y.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,179 ;Right
|
||||
jne @f
|
||||
@ -162,7 +162,7 @@ key:
|
||||
mov byte[txt_angle_y.v],0
|
||||
stdcall str_cat, txt_angle_y.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,178 ;Up
|
||||
jne @f
|
||||
@ -176,7 +176,7 @@ key:
|
||||
mov byte[txt_angle_x.v],0
|
||||
stdcall str_cat, txt_angle_x.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
cmp ah,177 ;Down
|
||||
jne @f
|
||||
@ -190,7 +190,7 @@ key:
|
||||
mov byte[txt_angle_x.v],0
|
||||
stdcall str_cat, txt_angle_x.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
@@:
|
||||
|
||||
jmp still
|
||||
@ -229,14 +229,14 @@ align 4
|
||||
but_dr_0:
|
||||
mov dword[dr_figure],0
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
but_dr_1:
|
||||
mov dword[dr_figure],1
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -259,7 +259,7 @@ but_zoom_p:
|
||||
mov byte[txt_scale.v],0
|
||||
stdcall str_cat, txt_scale.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -282,14 +282,11 @@ but_zoom_m:
|
||||
mov byte[txt_scale.v],0
|
||||
stdcall str_cat, txt_scale.v,Data_String
|
||||
call draw_3d
|
||||
stdcall [kosglSwapBuffers]
|
||||
call [kosglSwapBuffers]
|
||||
ret
|
||||
|
||||
align 4
|
||||
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
|
||||
align 4
|
||||
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||
;sizeof.TinyGLContext = 28
|
||||
|
||||
align 4
|
||||
draw_3d:
|
||||
@ -324,13 +321,6 @@ stdcall [glPopMatrix]
|
||||
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_x,5,25,0xffff00
|
||||
ret
|
||||
|
||||
dr_figure dd 0
|
||||
qObj dd 0
|
||||
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
|
||||
texture dd 0 ;указатель на память с текстурой
|
||||
text_w dd 0
|
||||
text_h dd 0
|
||||
|
||||
scale dd 0.95 ;начальный масштаб
|
||||
sc_delt dd 0.05 ;изменение масштаба при нажатии
|
||||
sc_min dd 0.1 ;минимальный масштаб
|
||||
@ -464,14 +454,14 @@ system_dir_1 db '/sys/lib/'
|
||||
lib_name_1 db 'buf2d.obj',0
|
||||
system_dir_2 db '/sys/lib/'
|
||||
lib_name_2 db 'libimg.obj',0
|
||||
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0
|
||||
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0
|
||||
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0
|
||||
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
|
||||
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
|
||||
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
|
||||
head_f_i:
|
||||
head_f_l db 'System error',0
|
||||
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0
|
||||
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0
|
||||
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0
|
||||
head_f_l db '"System error',0
|
||||
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
|
||||
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
|
||||
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
|
||||
;--------------------------------------------------
|
||||
|
||||
txt_scale:
|
||||
@ -525,6 +515,14 @@ l_libs_end:
|
||||
|
||||
align 4
|
||||
i_end:
|
||||
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||
;sizeof.TinyGLContext = 28
|
||||
dr_figure dd 0
|
||||
qObj dd 0
|
||||
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
|
||||
texture dd 0 ;указатель на память с текстурой
|
||||
text_w dd 0
|
||||
text_h dd 0
|
||||
run_file_70 FileInfoBlock
|
||||
sc system_colors
|
||||
align 16
|
||||
|
@ -25,7 +25,8 @@ proc endSharedState uses eax ebx, context:dword
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||
proc glInit, zbuffer1:dword
|
||||
pushad
|
||||
stdcall gl_zalloc,sizeof.GLContext
|
||||
mov dword[gl_ctx],eax
|
||||
mov edx,eax
|
||||
@ -174,7 +175,7 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||
|
||||
; depth test
|
||||
mov dword[edx+GLContext.depth_test],0
|
||||
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
|
3
programs/media/img_transform/Tupfile.lua
Normal file
@ -0,0 +1,3 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
|
||||
tup.rule({"img_transform.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "img_transform")
|
6
programs/media/img_transform/build_en.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm img_transform.asm img_transform.kex
|
||||
@kpack img_transform.kex
|
||||
@erase lang.inc
|
||||
@pause
|
6
programs/media/img_transform/build_ru.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm img_transform.asm img_transform.kex
|
||||
@kpack img_transform.kex
|
||||
@erase lang.inc
|
||||
@pause
|
89
programs/media/img_transform/doc/about.htm
Normal file
@ -0,0 +1,89 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Image transform</title>
|
||||
<meta charset="WINDOWS-1251">
|
||||
<style>
|
||||
body
|
||||
{
|
||||
font-size: 15px;
|
||||
font-family: "Bookman Old Style";
|
||||
color: black;
|
||||
text-align: justify;
|
||||
}
|
||||
h1 { color: green; font-size: 23px; }
|
||||
h2 { color: green; font-size: 21px; }
|
||||
h3 { color: green; font-size: 19px; }
|
||||
h4 { color: #803f00; font-size: 17px; }
|
||||
i { color: #0099cc; }
|
||||
b { color: #0099cc; }
|
||||
p {
|
||||
text-indent: 1em;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
ol, ul, dl{
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
pre
|
||||
{
|
||||
padding: 2px;
|
||||
padding-left: 20px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
font-family: "Courier New";
|
||||
font-size: 15px;
|
||||
color: #004000;
|
||||
background-color: #ffd0ff;
|
||||
}
|
||||
table { font-size: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Image transform 16.05.20</h1>
|
||||
|
||||
<h2>Оглавление</h2>
|
||||
<ul>
|
||||
<li>О программе</li>
|
||||
<li>Панель инструментов</li>
|
||||
<li>Клавиатура</Li>
|
||||
<li>Автор</li>
|
||||
</ul>
|
||||
|
||||
<h2>О программе</h2>
|
||||
<p><b>Image transform</b> - программа для преобразования изображений. </p>
|
||||
|
||||
<p><img src="img_01.png" alt="Внешний вид программы"></p>
|
||||
<p>Рис. 1. Внешний вид программы</p>
|
||||
|
||||
<p>Использование программы:</p>
|
||||
<p>Программу можно использовать для выравнивания искаженных изображений изаначально прямоугольной (квадратной) формы, для создания текстур и т.д. После открытия файла изображения нужно указать 4 точки, которые станут углами преобразованого изображения. Для выбора точки нужно навести курсор мыши в нужное место и нажать кнопку на клавиатуре цифру от 1 до 4, в зависимости от того какую точку нужно установить в выбранное место. Для более точной установки координат можно выделить точку нажатием на ней курсором мыши, а потом курсорами на клавиатуре двигать точку в нужное место.</p>
|
||||
|
||||
<p><img src="img_02.png"></p>
|
||||
<p>Рис. 2. Окно с исходным изображением</p>
|
||||
|
||||
<p><img src="img_03.png"></p>
|
||||
<p>Рис. 3. Окно с преобразованным изображением</p>
|
||||
|
||||
<h2>Панель инструментов</h2>
|
||||
<p><img src="but_01.png"> открытие файла.</p>
|
||||
<p><img src="but_02.png"> сохранение файла.</p>
|
||||
<p><img src="but_03.png"> выбор режима просмотра. Выбирается один из 2-х режимов: исходное или преобразованное изображение.</p>
|
||||
<p><img src="but_04.png"> выбор размера преобразованного изображения.Выбирается один из 2-х размеров: близкий к входному или увеличенный на весь буфер.</p>
|
||||
<p><img src="but_05.png"> информация о программе.</p>
|
||||
|
||||
<h2>Клавиатура</h2>
|
||||
<p><b>Ctrl+O</b> - открытие файла.</p>
|
||||
<p><b>Ctrl+S</b> - сохранение файла.</p>
|
||||
<p><b>1, 2, 3, 4</b> - установка координат указанной точки.</p>
|
||||
<p><b>↑</b>, <b>↓</b>, <b>←</b>, <b>→</b> - навигация по изображению или пермещение выделенной точки.</p>
|
||||
|
||||
<h2>Автор</h2>
|
||||
<p>IgorA</p>
|
||||
</body>
|
||||
</html>
|
BIN
programs/media/img_transform/doc/but_01.png
Normal file
After Width: | Height: | Size: 642 B |
BIN
programs/media/img_transform/doc/but_02.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
programs/media/img_transform/doc/but_03.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
programs/media/img_transform/doc/but_04.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
programs/media/img_transform/doc/but_05.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
programs/media/img_transform/doc/img_01.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
programs/media/img_transform/doc/img_02.png
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
programs/media/img_transform/doc/img_03.png
Normal file
After Width: | Height: | Size: 72 KiB |
1349
programs/media/img_transform/img_transform.asm
Normal file
357
programs/media/img_transform/select_points.inc
Normal file
@ -0,0 +1,357 @@
|
||||
;
|
||||
; файл для работы с выделенными точками,
|
||||
; по которым делается преобразование изображения
|
||||
;[0-3] - рамка (исх. и.)
|
||||
;[4] - средняя точка (исх. и.)
|
||||
;[5-6] - рамка (вых. и.)
|
||||
;[7] - средняя точка (вых. и.)
|
||||
;
|
||||
|
||||
struct point2d
|
||||
x dd ? ;координата относит изображения
|
||||
y dd ?
|
||||
tx dd ? ;координата для текстуры
|
||||
ty dd ?
|
||||
captx rb 6
|
||||
capty rb 6
|
||||
ends
|
||||
|
||||
;настройка точек при загрузке программы
|
||||
;(точки не активны)
|
||||
align 4
|
||||
points_init:
|
||||
xor eax,eax
|
||||
dec eax
|
||||
mov ecx,8
|
||||
mov edi,sel_pt
|
||||
@@:
|
||||
mov [edi+point2d.x],eax
|
||||
mov [edi+point2d.y],eax
|
||||
add edi,sizeof.point2d
|
||||
loop @b
|
||||
ret
|
||||
|
||||
;настройка точек при открытии изображения
|
||||
;(точки ставятся по углам изображения)
|
||||
align 4
|
||||
proc points_init_2 uses eax ecx edx edi, ot_x:dword
|
||||
xor eax,eax
|
||||
mov edi,sel_pt
|
||||
mov edx,[ot_x]
|
||||
mov [edi+point2d.x],edx ;1
|
||||
mov [edi+point2d.y],eax ;1
|
||||
add edi,sizeof.point2d
|
||||
mov ecx,[buf_i0.w]
|
||||
sub ecx,edx
|
||||
mov [edi+point2d.x],ecx ;2
|
||||
mov [edi+point2d.y],eax ;2
|
||||
add edi,sizeof.point2d
|
||||
mov [edi+point2d.x],ecx ;3
|
||||
mov ecx,[buf_i0.h]
|
||||
mov [edi+point2d.y],ecx ;3
|
||||
add edi,sizeof.point2d
|
||||
mov [edi+point2d.x],edx ;4
|
||||
mov [edi+point2d.y],ecx ;4
|
||||
call points_update_prop
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc points_update_prop uses eax ebx ecx edi esi
|
||||
;вычисление координат средней точки
|
||||
mov edi,sel_pt
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov ecx,4
|
||||
@@:
|
||||
add eax,[edi+point2d.x]
|
||||
add ebx,[edi+point2d.y]
|
||||
add edi,sizeof.point2d
|
||||
loop @b
|
||||
shr eax,2
|
||||
mov [edi+point2d.x],eax
|
||||
shr ebx,2
|
||||
mov [edi+point2d.y],ebx
|
||||
add edi,sizeof.point2d
|
||||
|
||||
cmp byte[trans_a],0 ;проверяем алгоритм растягивания текстуры
|
||||
je @f
|
||||
;на весь буфер
|
||||
xor eax,eax
|
||||
mov ebx,edi
|
||||
mov edi,buf_i0
|
||||
mov [ebx+point2d.x],eax
|
||||
mov [ebx+point2d.y],eax
|
||||
add ebx,sizeof.point2d
|
||||
mov eax,buf2d_w
|
||||
mov [ebx+point2d.x],eax
|
||||
mov ecx,buf2d_h
|
||||
mov [ebx+point2d.y],ecx
|
||||
add ebx,sizeof.point2d
|
||||
shr eax,1
|
||||
mov [ebx+point2d.x],eax
|
||||
shr ecx,1
|
||||
mov [ebx+point2d.y],ecx
|
||||
jmp .end0
|
||||
@@:
|
||||
;на часть буфера
|
||||
mov eax,[edi+point2d.x-5*sizeof.point2d]
|
||||
add eax,[edi+point2d.x-2*sizeof.point2d]
|
||||
shr eax,1
|
||||
mov [edi+point2d.x],eax
|
||||
mov eax,[edi+point2d.x-4*sizeof.point2d]
|
||||
add eax,[edi+point2d.x-3*sizeof.point2d]
|
||||
shr eax,1
|
||||
mov [edi+point2d.x+sizeof.point2d],eax
|
||||
|
||||
mov eax,[edi+point2d.y-5*sizeof.point2d]
|
||||
add eax,[edi+point2d.y-4*sizeof.point2d]
|
||||
shr eax,1
|
||||
mov [edi+point2d.y],eax
|
||||
mov eax,[edi+point2d.y-3*sizeof.point2d]
|
||||
add eax,[edi+point2d.y-2*sizeof.point2d]
|
||||
shr eax,1
|
||||
mov [edi+point2d.y+sizeof.point2d],eax
|
||||
|
||||
lea esi,[edi-sizeof.point2d]
|
||||
add edi,2*sizeof.point2d
|
||||
movsd ;copy coord x
|
||||
movsd ;copy coord y
|
||||
.end0:
|
||||
|
||||
mov edi,buf_i0
|
||||
mov ebx,sel_pt
|
||||
mov ecx,8
|
||||
finit
|
||||
.cycle0:
|
||||
fild dword[ebx+point2d.x]
|
||||
fidiv buf2d_w
|
||||
fst dword[ebx+point2d.tx]
|
||||
|
||||
fstp qword[Data_Double]
|
||||
call DoubleFloat_to_String
|
||||
call String_crop_0
|
||||
m2m dword[ebx+point2d.captx],dword[Data_String]
|
||||
mov al,byte[Data_String+4]
|
||||
mov byte[ebx+point2d.captx+4],al
|
||||
|
||||
fild dword[ebx+point2d.y]
|
||||
fidiv buf2d_h
|
||||
fst dword[ebx+point2d.ty]
|
||||
|
||||
fstp qword[Data_Double]
|
||||
call DoubleFloat_to_String
|
||||
call String_crop_0
|
||||
m2m dword[ebx+point2d.capty],dword[Data_String]
|
||||
mov al,byte[Data_String+4]
|
||||
mov byte[ebx+point2d.capty+4],al
|
||||
|
||||
add ebx,sizeof.point2d
|
||||
loop .cycle0
|
||||
|
||||
call draw_transf_texture
|
||||
ret
|
||||
endp
|
||||
|
||||
;рисование выбранных точек
|
||||
align 4
|
||||
proc points_draw
|
||||
locals
|
||||
PervX dd 0 ;pervios point coord X
|
||||
PervY dd 0 ;pervios point coord Y
|
||||
GrafX dd ? ;active point coord X
|
||||
GrafY dd ? ;active point coord Y
|
||||
endl
|
||||
mov edi,buf_ogl
|
||||
cmp buf2d_data,0
|
||||
je .endf
|
||||
|
||||
xor ecx,ecx
|
||||
mov edi,sel_pt
|
||||
mov dword[txt_buf],'0'
|
||||
|
||||
cmp byte[view_b],1
|
||||
je .cycle0end
|
||||
;берем координаты последней точки
|
||||
mov eax,[edi+3*sizeof.point2d+point2d.x]
|
||||
add eax,[nav_x]
|
||||
mov [PervX],eax
|
||||
mov ebx,[edi+3*sizeof.point2d+point2d.y]
|
||||
add ebx,[nav_y]
|
||||
mov [PervY],ebx
|
||||
align 4
|
||||
.cycle0:
|
||||
cmp dword[edi+point2d.x],-1
|
||||
je .end0
|
||||
mov eax,[edi+point2d.x]
|
||||
add eax,[nav_x]
|
||||
mov [GrafX],eax
|
||||
sub eax,3
|
||||
mov ebx,[edi+point2d.y]
|
||||
add ebx,[nav_y]
|
||||
mov [GrafY],ebx
|
||||
sub ebx,3
|
||||
cmp ecx,[sel_act]
|
||||
je @f
|
||||
stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx, 5,5, 0xffff00
|
||||
@@:
|
||||
dec eax
|
||||
dec ebx
|
||||
stdcall [buf2d_rect_by_size], buf_0, eax,ebx, 7,7, 0x808000
|
||||
call point_draw_info
|
||||
;рисование линии
|
||||
stdcall [buf2d_line], buf_0, [PervX],[PervY], [GrafX],[GrafY], 0x808000
|
||||
mov eax,[GrafX]
|
||||
mov [PervX],eax
|
||||
mov eax,[GrafY]
|
||||
mov [PervY],eax
|
||||
.end0:
|
||||
add edi,sizeof.point2d
|
||||
inc ecx
|
||||
cmp ecx,4
|
||||
jl .cycle0
|
||||
jmp .cycle1end
|
||||
.cycle0end:
|
||||
add edi,5*sizeof.point2d
|
||||
align 4
|
||||
.cycle1:
|
||||
cmp dword[edi+point2d.x],-1
|
||||
je .end1
|
||||
mov eax,[GrafX]
|
||||
mov [PervX],eax
|
||||
mov eax,[GrafY]
|
||||
mov [PervY],eax
|
||||
mov eax,[edi+point2d.x]
|
||||
add eax,[nav_x]
|
||||
mov [GrafX],eax
|
||||
sub eax,3
|
||||
mov ebx,[edi+point2d.y]
|
||||
add ebx,[nav_y]
|
||||
mov [GrafY],ebx
|
||||
sub ebx,3
|
||||
stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx, 5,5, 0xffff00
|
||||
dec eax
|
||||
dec ebx
|
||||
stdcall [buf2d_rect_by_size], buf_0, eax,ebx, 7,7, 0x808000
|
||||
call point_draw_info
|
||||
.end1:
|
||||
add edi,sizeof.point2d
|
||||
inc ecx
|
||||
cmp ecx,2
|
||||
jl .cycle1
|
||||
mov eax,[GrafX]
|
||||
sub eax,[PervX]
|
||||
mov [GrafX],eax
|
||||
mov eax,[GrafY]
|
||||
sub eax,[PervY]
|
||||
mov [GrafY],eax
|
||||
stdcall [buf2d_rect_by_size], buf_0, [PervX],[PervY], [GrafX],[GrafY], 0x808000
|
||||
.cycle1end:
|
||||
;средняя точка
|
||||
mov eax,[edi+point2d.x]
|
||||
add eax,[nav_x]
|
||||
sub eax,3
|
||||
mov ebx,[edi+point2d.y]
|
||||
add ebx,[nav_y]
|
||||
sub ebx,3
|
||||
stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx, 5,5, 0xff0000
|
||||
dec eax
|
||||
dec ebx
|
||||
stdcall [buf2d_rect_by_size], buf_0, eax,ebx, 7,7, 0x808000
|
||||
add ebx,9
|
||||
inc byte[txt_buf]
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0
|
||||
.endf:
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
; eax - coord x
|
||||
; ebx - coord y
|
||||
; edi - указатель на структуру point2d
|
||||
align 4
|
||||
point_draw_info:
|
||||
;вывод текста
|
||||
add ebx,9
|
||||
inc byte[txt_buf]
|
||||
inc eax
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0xffffff
|
||||
sub eax,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0xffffff
|
||||
inc eax
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0xffffff
|
||||
;dec ebx
|
||||
sub ebx,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0xffffff
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,txt_buf,eax,ebx,0
|
||||
add ebx,9
|
||||
lea edx,[edi+point2d.captx]
|
||||
inc eax
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
sub eax,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
inc eax
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
;dec ebx
|
||||
sub ebx,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0
|
||||
add ebx,9
|
||||
lea edx,[edi+point2d.capty]
|
||||
inc eax
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
sub eax,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
inc eax
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
;dec ebx
|
||||
sub ebx,2
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0xffffff
|
||||
inc ebx
|
||||
stdcall [buf2d_draw_text], buf_0, buf_font,edx,eax,ebx,0
|
||||
ret
|
||||
|
||||
;рисование преобразованной текстуры
|
||||
align 4
|
||||
draw_transf_texture:
|
||||
cmp dword[buf_ogl],0
|
||||
je .endf
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
stdcall [glBegin],GL_TRIANGLES
|
||||
|
||||
stdcall [glTexCoord2f], dword[sel_pt+4*sizeof.point2d+point2d.tx], dword[sel_pt+4*sizeof.point2d+point2d.ty] ;5
|
||||
stdcall [glVertex3f], dword[sel_pt+7*sizeof.point2d+point2d.tx], dword[sel_pt+7*sizeof.point2d+point2d.ty], 0.1 ;8
|
||||
stdcall [glTexCoord2f], dword[sel_pt+point2d.tx], dword[sel_pt+point2d.ty] ;1
|
||||
stdcall [glVertex3f], dword[sel_pt+5*sizeof.point2d+point2d.tx], dword[sel_pt+5*sizeof.point2d+point2d.ty], 0.1 ;6
|
||||
stdcall [glTexCoord2f], dword[sel_pt+sizeof.point2d+point2d.tx], dword[sel_pt+sizeof.point2d+point2d.ty] ;2
|
||||
stdcall [glVertex3f], dword[sel_pt+6*sizeof.point2d+point2d.tx], dword[sel_pt+5*sizeof.point2d+point2d.ty], 0.1 ;7|6
|
||||
|
||||
stdcall [glTexCoord2f], dword[sel_pt+4*sizeof.point2d+point2d.tx], dword[sel_pt+4*sizeof.point2d+point2d.ty] ;5
|
||||
stdcall [glVertex3f], dword[sel_pt+7*sizeof.point2d+point2d.tx], dword[sel_pt+7*sizeof.point2d+point2d.ty], 0.1 ;8
|
||||
stdcall [glTexCoord2f], dword[sel_pt+sizeof.point2d+point2d.tx], dword[sel_pt+sizeof.point2d+point2d.ty] ;2
|
||||
stdcall [glVertex3f], dword[sel_pt+6*sizeof.point2d+point2d.tx], dword[sel_pt+5*sizeof.point2d+point2d.ty], 0.1 ;7|6
|
||||
stdcall [glTexCoord2f], dword[sel_pt+2*sizeof.point2d+point2d.tx], dword[sel_pt+2*sizeof.point2d+point2d.ty] ;3
|
||||
stdcall [glVertex3f], dword[sel_pt+6*sizeof.point2d+point2d.tx], dword[sel_pt+6*sizeof.point2d+point2d.ty], 0.1 ;7
|
||||
|
||||
stdcall [glTexCoord2f], dword[sel_pt+4*sizeof.point2d+point2d.tx], dword[sel_pt+4*sizeof.point2d+point2d.ty] ;5
|
||||
stdcall [glVertex3f], dword[sel_pt+7*sizeof.point2d+point2d.tx], dword[sel_pt+7*sizeof.point2d+point2d.ty], 0.1 ;8
|
||||
stdcall [glTexCoord2f], dword[sel_pt+2*sizeof.point2d+point2d.tx], dword[sel_pt+2*sizeof.point2d+point2d.ty] ;3
|
||||
stdcall [glVertex3f], dword[sel_pt+6*sizeof.point2d+point2d.tx], dword[sel_pt+6*sizeof.point2d+point2d.ty], 0.1 ;7
|
||||
stdcall [glTexCoord2f], dword[sel_pt+3*sizeof.point2d+point2d.tx], dword[sel_pt+3*sizeof.point2d+point2d.ty] ;4
|
||||
stdcall [glVertex3f], dword[sel_pt+5*sizeof.point2d+point2d.tx], dword[sel_pt+6*sizeof.point2d+point2d.ty], 0.1 ;6|7
|
||||
|
||||
stdcall [glTexCoord2f], dword[sel_pt+4*sizeof.point2d+point2d.tx], dword[sel_pt+4*sizeof.point2d+point2d.ty] ;5
|
||||
stdcall [glVertex3f], dword[sel_pt+7*sizeof.point2d+point2d.tx], dword[sel_pt+7*sizeof.point2d+point2d.ty], 0.1 ;8
|
||||
stdcall [glTexCoord2f], dword[sel_pt+3*sizeof.point2d+point2d.tx], dword[sel_pt+3*sizeof.point2d+point2d.ty] ;4
|
||||
stdcall [glVertex3f], dword[sel_pt+5*sizeof.point2d+point2d.tx], dword[sel_pt+6*sizeof.point2d+point2d.ty], 0.1 ;6|7
|
||||
stdcall [glTexCoord2f], dword[sel_pt+point2d.tx], dword[sel_pt+point2d.ty] ;1
|
||||
stdcall [glVertex3f], dword[sel_pt+5*sizeof.point2d+point2d.tx], dword[sel_pt+5*sizeof.point2d+point2d.ty], 0.1 ;6
|
||||
|
||||
stdcall [glEnd]
|
||||
.endf:
|
||||
ret
|
BIN
programs/media/img_transform/toolbar.png
Normal file
After Width: | Height: | Size: 1.2 KiB |