-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathimageWindow.h
More file actions
84 lines (72 loc) · 2.47 KB
/
imageWindow.h
File metadata and controls
84 lines (72 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "baseWindow.h"
class CImageLabel : public QLabel
{
Q_OBJECT
public:
CImageLabel();
void SetZoom( float zoom );
void SetImage( QImage const& image );
private:
QPixmap m_pixmap;
float m_zoom;
void paintEvent( QPaintEvent* event ) Q_DECL_OVERRIDE;
};
class CImageWindow : public QScrollArea, public CBaseWindow
{
Q_OBJECT
public:
CImageWindow();
bool LoadFile( QString const& path );
virtual void Reload();
virtual void ZoomIn();
virtual void ZoomOut();
virtual void SetViewChannel( EViewChannel channel );
virtual void SetViewFace( unsigned face );
virtual void SetViewMipMap( unsigned mipMap );
virtual void SetViewMin( float min );
virtual void SetViewMax( float max );
virtual void SetViewGamma( float gamma );
virtual void SetViewDiffMult( float mult ) {}
virtual QSize GetInitialSize() const { return QSize( m_imageWidth, m_imageHeight ); }
virtual QString const& GetTitle() const { return m_title; }
virtual EViewChannel GetViewChannel() const { return m_viewChannel; }
virtual unsigned GetMipNum() const { return m_info.mipLevels; }
virtual unsigned GetFaceNum() const { return m_info.arraySize; }
virtual unsigned GetViewFace() const { return m_viewFace; }
virtual unsigned GetViewMipMap() const { return m_viewMipMap; }
virtual float GetViewMin() const { return m_viewMin; }
virtual float GetViewMax() const { return m_viewMax; }
virtual float GetViewGamma() const { return m_viewGamma; }
virtual float GetViewDiffMult() const { return 1.0f; }
private:
QString m_title;
DirectX::ScratchImage m_scratchImage;
DirectX::TexMetadata m_info;
QString m_path;
QString m_fileName;
QString m_formatName;
CImageLabel m_imageLabel;
float m_zoom;
bool m_dragEnabled;
QPoint m_dragStart;
EViewChannel m_viewChannel;
unsigned m_texelSizeInBytes;
unsigned m_viewFace;
unsigned m_viewMipMap;
float m_viewMin;
float m_viewMax;
float m_viewGamma;
unsigned m_imageWidth;
unsigned m_imageHeight;
QPoint m_selectionStart;
QPoint m_selectionEnd;
QRubberBand m_selection;
void mousePressEvent( QMouseEvent* event ) Q_DECL_OVERRIDE;
void mouseReleaseEvent( QMouseEvent* event ) Q_DECL_OVERRIDE;
void mouseMoveEvent( QMouseEvent* event ) Q_DECL_OVERRIDE;
void wheelEvent( QWheelEvent* event ) Q_DECL_OVERRIDE;
void PickTexel( QPoint const& pos );
void UpdateImage();
void UpdateTitle();
};