Delphi图像处理
本文的线性亮度/对比度调整方法是在《改进的图像线性亮度调整方法》一文中线性亮度调整方法与《Delphi图像处理 -- Photoshop图像亮度/对比度调整》中的对比度调整方法基础上形成的,其原理和特点可参见这2篇文章:
过程定义:
// 线性调整亮度,Value亮度值
procedure ImageLinearBrightness(Data: TImageData; Value: Integer);
// 调整亮度(线性)和对比度
procedure ImageLinearBrightnessAndContrast(Data: TImageData;
Bright, Contrast: Integer; Threshold: LongWord);
实现代码:
procedure ImageLinearbrightness(Data: TImageData; Value: Integer);
asm
push ebp
push esi
push edi
push ebx
test edx, edx // if (Value == 0) return
jz @end
mov ebp, edx
jl @@2
push eax
cmp ebp, 255 // if (Value > 0)
jle @@1 // {
mov ebp, 255 // if (Value > 255) Value = 255
@@1:
mov eax, 65536 // Value = 65536 / (256 - Value) - 256
mov ecx, 256
sub ecx, ebp
cdq
div ecx
sub eax, 256
mov ebp, eax // }
pop eax
@@2:
call SetDataReg32
cld
@yLoop:
push ecx
@xLoop:
push ecx
mov ecx, 3
@RGBLoop:
movzx eax, [edi] // rgb = rgb + rgb * value / 256
mov esi, eax
imul eax, ebp
sar eax, 8
add eax, esi
jns @@3
xor eax, eax
jmp @@4
@@3:
cmp eax, 255
jle @@4
mov eax, 255
@@4:
stosb
loop @RGBLoop
inc edi
pop ecx
loop @xLoop
pop ecx
add edi, ebx
dec edx
jnz @yLoop
@end:
pop ebx
pop edi
pop esi
pop ebp
end;
procedure ImageLinearBrightnessAndContrast(Data: TImageData;
Bright, Contrast: Integer; Threshold: LongWord);
begin
if (Bright <> 0) and (Contrast > 0) then
ImageLinearBrightness(Data, Bright);
ImageContrast(Data, Contrast, Threshold);
if (Bright <> 0) and (Contrast <= 0) then
ImageLinearBrightness(Data, Bright);
end;
&
相关文档:
1.[Error] DCansactionIformationManagement.pas(171): String literals may have at most 255 elements
[Fatal Error] DCMain.pas(32): Could not compile used unit 'DCansactionIformationManagement.pas'
报错:‘不正常定义了参数。提供了不一致或不完整信息’
解决方法:语法
数据定义要一致
2. ......
Delphi的TThread类
http://bigpower.blog.51cto.com/209892/89525
我们常有工作线程和主线程之分,工作线程负责作一些后台操作,比如接收邮件;主线程负责界面上的一些显示。工作线程的好处在某些时候是不言而喻的,你的主界面可以响应任何操作,而背后的线程却在默默地工作。
VCL中,工作线程执行在Execute方法中 ......
网上搜集资料 参考写的代码 实现控件的动态创建 完整代码如下:
(实现界面)
-------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;
type
TControlClass =class ......
第一章 DELPHI的原子世界
第二章 DELPHI与WIN32时空
第三章 多线程
第四章 接口
第五章 包
第六章 事件与消息
第七章 组织你的模块
第八章 探索数据库
第九章 多层体系结构
第十章 操作界面与操作逻辑
第十一章 面向对象数据库基础
空 ......