//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
#include "Unit13.h"
#include <math.h>
#include <stdlib.h>
#include <time.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//TForm2 *Form2;
extern int iFormNum;
extern int iActForm2;
extern int iGraphStyle;
extern int iGraphThick;
extern bool bIsTransparence;
extern TColor tBrushColor;
extern TColor tGroundColor;
extern TColor tGraphColor;
extern bool bForm2Null[50];
extern int iForm2Sum;
extern int iTemplate[4][4];
extern int iTNum;
extern TPoint pProcessBegin,pProcessEnd;
extern int iThre;
extern long lCopyStyle;
long lXTemp,lYTemp;
int iR,iG,iB;
TColor tTempColor;
float fWtempR,fWtempG,fWtempB;
float fla;
int ilb;
int iSmoothStyle;
Graphics::TBitmap *bBitmapCopy=new Graphics::TBitmap;
TCursor tCurTemp;
long lProStep,lProSum,lProi;
int iSunDirection=1;
int iSunConstant=128;
int iSpreadBound=5;
long lofx,lofy,lforx,lfory;
int iTemp,jTemp;
int iPointRange;
extern int iMASAIKE;
TPoint preP,curP;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
int i;
iPicNum=10;
iPicBegin=1;
iPicEnd=0;
iPicNow=0;
iMaxZoom=4;
iZoom=0;
pPBegin.x=0;
pPBegin.y=0;
pPEnd.x=lPicWidth;
pPEnd.y=lPicHeight;
sOperator[0]="打开";
iPointRange=0;
for(i=0;i<iPicNum;i++)
bPicArray[i]=new Graphics::TBitmap();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormResize(TObject *Sender)
{
if(Panel1->Width < this->ClientWidth)
Panel1->Left=(this->ClientWidth - Panel1->Width)/2;
else
Panel1->Left=0;
if(Panel1->Height < this->ClientHeight)
Panel1->Top=(this->ClientHeight - Panel1->Height)/2;
else
Panel1->Top=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
int i;
i=MessageBox(NULL,"是否保存图像","Question?",MB_YESNOCANCEL|MB_ICONQUESTION);
if(i==IDYES)
{
//保存
gotosave:
if(SaveDialog1->Execute())
{
if(FileExists(SaveDialog1->FileName))
{
i=MessageBox(NULL,"您所指定的文件已经存在,是否覆盖?","Question",MB_YESNOCANCEL|MB_ICONQUESTION);
if(i==IDNO)
goto gotosave;
if(i==IDYES)
{
if(!DeleteFile(SaveDialog1->FileName))
{
MessageBox(NULL,"指定的文件正在使用,无法覆盖","error",MB_OK|MB_ICONERROR);
goto gotosave;
}
}
else
{
Action=caNone;
return;
}
}
this->Image1->Picture->SaveToFile(SaveDialog1->FileName);
MessageBox(NULL,"保存成功","OK",MB_OK);
Action=caFree;
iForm2Sum--;
bForm2Null[iOrder]=true;
Form3->ListBox1->Clear();
for(i=0;i<iPicNum;i++)
delete bPicArray[i];
}
else
{
Action=caNone;
return;
}
}
else if(i==IDNO)
{
Action=caFree;
iForm2Sum--;
bForm2Null[iOrder]=true;
Form3->ListBox1->Clear();
for(i=0;i<iPicNum;i++)
delete bPicArray[i];
}
else
{
Action=caNone;
return;
}
Form1->StatusBar2->Panels->Items[2]->Text=" ";
Form1->StatusBar2->Panels->Items[3]->Text=" ";
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormActivate(TObject *Sender)
{
SetForm3List();
pProcessBegin.x=pPBegin.x;
pProcessBegin.y=pPBegin.y;
pProcessEnd.x=pPEnd.x;
pProcessEnd.y=pPEnd.y;
iActForm2=iOrder;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Image1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(Shift.Contains(ssRight)||!iGraphStyle)
{
iGraphStyle=0;
Image1->Cursor=crArrow;
Shape1->Visible=false;
Image1->Canvas->Pen->Mode=pmCopy;
Form1->Panel3->Visible=false;
Form1->Panel4->Visible=false;
Form3->SpeedButton4->Down=true;
return;
}
preP.x=X;
preP.y=Y;
switch(iGraphStyle){
case 1:
Shape1->Shape=stRectangle;
break;
case 2:
Image1->Canvas->Pixels[X*(1 - 0.2*iZoom)][Y*(1 - 0.2*iZoom)]=tGraphColor;
return;
case 3:
Image1->Canvas->Pen->Mode=pmNot;
curP.x=X*(1 - 0.2*iZoom);
curP.y=Y*(1 - 0.2*iZoom);
break;
case 4:
Shape1->Shape=stRectangle;
break;
case 5:
Shape1->Shape=stEllipse;
break;
case 6:
f_imagePointProcess(6,X*(1 - 0.2*iZoom),Y*(1 - 0.2*iZoom));
break;
case 7:
f_imagePointProcess(7,X*(1 - 0.2*iZoom),Y*(1 - 0.2*iZoom));
break;
case 8:
tTempColor=Image1->Canvas->Pixels[X*(1 - 0.2*iZoom)][Y*(1 - 0.2*iZoom)];
Form3->Shape1->Brush->Color=tTempColor;
Form1->StatusBar2->Panels->Items[1]->Text="RGB: ("+IntToStr(GetRValue(tTempColor))+","+IntToStr(GetGValue(tTempColor))+","+IntToStr(GetBValue(tTempColor))+")";
break;
case 9:
break;
default :
break;
}
if(iGraphStyle==1||iGraphStyle==4||iGraphStyle==5)
{
Shape1->Top=Y;
Shape1->Left=X;
Shape1->Width=1;
Shape1->Height=1;
Shape1->Visible=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Image1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
Form1->StatusBar2->Panels->Items[2]->Text="X: "+IntToStr((int)(X*(1 - 0.2*iZoom)));
Form1->StatusBar2->Panels->Items[3]->Text="Y: "+IntToStr((int)(X*(1 - 0.2*iZoom)));
if(!Shift.Contains(ssLeft)||!iGraphStyle)
return;
switch(iGraphStyle){
tuxiangchuli.rar_图像增强 毕业
版权申诉
191 浏览量
2022-09-14
18:54:14
上传
评论
收藏 442KB RAR 举报
刘良运
- 粉丝: 70
- 资源: 1万+
最新资源
- 疯狂吃月饼游戏小程序前端源码
- 知识领域: 人工智能 技术关键词: TensorFlow、Keras、深度学习、神经网络
- 知识领域: 自动化测试 技术关键词: pytest、unittest、自动化测试、测试框架
- 知识领域: 数据库管理 技术关键词: SQLAlchemy、数据库、ORM、SQL 内容关键词: 数据库连接、数据查询、数据操作
- 知识领域: 网络编程 技术关键词: socket、网络编程、异步IO、TCP/IP 内容关键词: 客户端、服务器、网络协议
- 知识领域: 自然语言处理 技术关键词: NLTK、spaCy、文本处理、语言模型
- 硬件工程师毕业设计心形灯PCB原理图+程序
- 开源光谱分析仪博客的代码
- 基于深度学习的工业缺陷检测(续篇)
- 大创项目编程示例开发案列优质学习资料资源工具与案列应用场景开发文档教程资料.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈