hytos / HYTOS / HYTOS / Commands / RotateImageCommand.py @ 29485992
이력 | 보기 | 이력해설 | 다운로드 (1.42 KB)
1 |
import os.path |
---|---|
2 |
import AbstractCommand |
3 |
try:
|
4 |
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QBuffer, QRect, QRegExp |
5 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QPainter, QColor, QPen, QBrush, QCursor, QTransform, QFont, QRegExpValidator, QValidator |
6 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox |
7 |
except ImportError: |
8 |
try:
|
9 |
from PyQt4.QtCore import Qt, QPoint, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QBuffer, QRect, QRegExp |
10 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QPainter, QColor, QPen, QBrush, QCursor, QTransform, QFont, QRegExpValidator, QValidator |
11 |
except ImportError: |
12 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
13 |
|
14 |
class RotateImageCommand(AbstractCommand.AbstractCommand): |
15 |
'''
|
16 |
@history 2018.05.09 Jeongwoo Draw Rect on ±1 area
|
17 |
'''
|
18 |
def __init__(self, imageViewer, isCounterClock = False): |
19 |
super(RotateImageCommand, self).__init__(imageViewer) |
20 |
image = imageViewer.image() |
21 |
transform = QTransform() |
22 |
|
23 |
degree = 90
|
24 |
if isCounterClock:
|
25 |
degree = -90
|
26 |
|
27 |
transform.rotate(degree) |
28 |
image = image.transformed(transform) |
29 |
imageViewer.setImage(image) |
30 |
|
31 |
def execute(self, param): |
32 |
pass
|
33 |
|
34 |
def undo(self): |
35 |
pass
|
36 |
|
37 |
def redo(self): |
38 |
pass
|