⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphicview.h

📁 计算机图形学课程设计源码 这是大二的时候学计算机图形学时做的课程设计
💻 H
字号:
// graphicView.h : interface of the CGraphicView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GRAPHICVIEW_H__F7819606_1943_49FC_960B_6C4EEE7F90FF__INCLUDED_)
#define AFX_GRAPHICVIEW_H__F7819606_1943_49FC_960B_6C4EEE7F90FF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include<conio.h>
#include<iostream.h>
#define SOLID 0
#define   WINDOW_HEIGHT  500
#define PI 3.1415926
#define true 1
#define false 0

typedef struct pointfloat
{
	CPoint point;
	pointfloat *next;
}dcpt;
//typedef struct dcpt3	{ int x,y,z; }	dcpt3;
typedef struct coloor{int R,G,B;}coloor;

typedef struct tEdge{
	int yUpper;
	float xIntersect,dxPerScan;
	coloor color1,color2;
	struct tEdge *next;
}Edge;//

/////////////////////////////////////////////////////////

class CGraphicView : public CView
{
protected://///////////////////////////////////////////////
int m_lineStyle ;
int m_lineMask ;
int m_lineWidth ;
int m_penID ;
int m_penStyle;
int m_penWidth ;
int m_penMask[16] ;
int m_k,m_ky;
int m_maskwidth;
COLORREF m_ForeColor;
COLORREF m_BackColor;

//typedef char * CString;
//////////////////////////////////////////////////////////
protected:
	bool m_bLine;
	bool m_bBezier;
	bool m_bSircle;
	bool m_bArea;
	bool m_bFreehand;
	bool m_bSphere;
	bool m_bSeeable ;
	bool m_bSunlight ;
	bool m_bUp ;
	bool m_bDown ;
	bool m_bAnydrect ;
	bool m_bFill;
	CPoint m_StartPoint,m_LastEndPoint;
	dcpt *TemPoint;
	dcpt *pEnd;
protected: // create from serialization only
	CGraphicView();
	DECLARE_DYNCREATE(CGraphicView)

// Attributes
public:
	CGraphicDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGraphicView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation

public:
	void setPixmask(int x,int y);
	void clearwindow();
	virtual ~CGraphicView();
	void setPixline(int x,int y,int m);
	void setPixel(int  x,int  y);
	void drawcurve(dcpt *dcpt1);	
	bool lineany();
	void lineany(int xa,int ya,int xb,int yb);
	void lineany(CPoint p1,CPoint p2);
	void circleMidPoint(CPoint sta,CPoint end);
	void circleMidPoint(int xCenter,int yCenter,int radius);
	void circlePlotPoints(int xCenter,int yCenter,int x,int y);
	bool sphereview();
	void fillScan(int scan,Edge *active);
	void scanFill(int cnt,CPoint *pts);
	void scanFill4(CPoint *pts,int iii,int jjj);

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CClientDC *m_pDC; 

// Generated message map functions
protected:
	//{{AFX_MSG(CGraphicView)
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnCancelMode();
	afx_msg void OnMenuArea();
	afx_msg void OnMenuBezier();
	afx_msg void OnMenuSircle();
	afx_msg void OnMenuFreehand();
	afx_msg void OnMenuLine();
	afx_msg void OnBUTTONBezier();
	afx_msg void OnBUTTONClear();
	afx_msg void OnBUTTONLine();
	afx_msg void OnBUTTONSircle();
	afx_msg void OnBUTTONSphere();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnButtonSeeable();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnButtonSunlight();
	afx_msg void OnButtonRight();
	afx_msg void OnButtonUp();
	afx_msg void OnFileFill();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in graphicView.cpp
inline CGraphicDoc* CGraphicView::GetDocument()
   { return (CGraphicDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GRAPHICVIEW_H__F7819606_1943_49FC_960B_6C4EEE7F90FF__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -