Matlab 版 (精华区)

发信人: zjliu (秋天的萝卜), 信区: Matlab
标  题: 发布{一个灌水工具} 2.0版本
发信站: 哈工大紫丁香 (Thu Mar 11 17:37:45 2004), 站内信件



为方便大家灌水,我用matlab写了这个东东,希望大家在玩的时候
能用上matlab,现将这个东东的全部程序给出,共四个文件:

文件1,文件名是:chans.m
function A=chans(str1,str2,str3);
figure('position',[296 457 560 317],'Visible','on');
axes;
text(-0.15,0.48,str1,'fontsize',208);
axis off
set(gcf,'Color','w');
saveas(gcf,'abc.bmp')
close
DD=imread('abc.bmp');
Dt=DD(10:309,1:560);
if length(str1)==1;
    DD=imread('abc.bmp');
    Dt=DD(10:309,1:560);
    Dq=Dt(1:12:end,1:14:end);
    Dqnew=255*ones(size(Dq));
    Dqnew(:,10:30)=Dq(:,1:21);
    A=char(zeros(size(Dq)));
    A(find(Dqnew==0))=str3;
    A(find(Dqnew==255))=str2;
else
    Dq=Dt(1:12:end,1:14:end);
    A=char(zeros(size(Dq)));
    A(find(Dq==0))=str3;
    A(find(Dq==255))=str2;
end


文件2,文件名是:fileL1.m
% 生成面版
close all
gcfk=figure('Position',[29 91 1029 664]);
h_text1=uicontrol(gcfk,'style','text',...
'unit','normalized','position',[0.55,0.75,0.05,0.03],...
'BackgroundColor','w','ForegroundColor','r',...
'string','原始字模');
h_edit1=uicontrol(gcfk,'style','edit',...
'unit','normalized','position',[0.55,0.69,0.05,0.04],...
'BackgroundColor','w','ForegroundColor','r',...
'string','水');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_text2=uicontrol(gcfk,'style','text',...
'unit','normalized','position',[0.62,0.75,0.05,0.03],...
'BackgroundColor','w','ForegroundColor','r',...
'string','背景字模');
h_edit2=uicontrol(gcfk,'style','edit',...
'unit','normalized','position',[0.62,0.69,0.05,0.04],...
'BackgroundColor','w','ForegroundColor','r',...
'string','水');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_text3=uicontrol(gcfk,'style','text',...
'unit','normalized','position',[0.69,0.75,0.05,0.03],...
'BackgroundColor','w','ForegroundColor','r',...
'string','前景字模');
h_edit3=uicontrol(gcfk,'style','edit',...
'unit','normalized','position',[0.69,0.69,0.05,0.04],...
'BackgroundColor','w','ForegroundColor','r',...
'string','灌');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_edit4=uicontrol(gcfk,'style','edit',...
'unit','normalized','position',[0.15,0.08,0.50,0.534],...
'BackgroundColor','w','ForegroundColor','black',...
'string','');
set(h_edit1,'HorizontalAlignment','left');
set(h_edit2,'HorizontalAlignment','left');
set(h_edit3,'HorizontalAlignment','left');
set(h_edit4,'HorizontalAlignment','left');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_text4=uicontrol(gcfk,'style','text',...
'unit','normalized','position',[0.06,0.90,0.06,0.04],...
'BackgroundColor','w','ForegroundColor','r',...
'string','Note:','fontsize',18);
strN='"原始字模"取一个或两个字符,  "背景字模"和"前景字模"取一个字符 !';
h_text5=uicontrol(gcfk,'style','text',...
'unit','normalized','position',[0.13,0.89,0.70,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
'string',strN,'fontsize',18);

文件3,文件名:fileL2.m
% 计算字符
str1=get(h_edit1,'string');
str2=get(h_edit2,'string');
str3=get(h_edit3,'string');
A=chans(str1,str2,str3);
set(h_edit4,'max',size(A,1))
set(h_edit4,'string',A)
set(h_edit4,'fontsize',8)

文件4,文件名:control_all.m
% control
fileL1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_push1=uicontrol(gcfk,'style','push',...
'unit','normalized','position',[0.76,0.69,0.05,0.04],...
'BackgroundColor','g','ForegroundColor','r',...
'string','造水','callback','fileL2;');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


--
╔═══════════════════╗
║★★★★★友谊第一  比赛第二★★★★★║
╚═══════════════════╝

※ 来源:.哈工大紫丁香 bbs.hit.edu.cn [FROM: 202.118.229.162]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.815毫秒