2006-11-03 17:57:32 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2007-07-15 13:53:26 +00:00
|
|
|
#ifndef _OKULAR_ROTATIONJOB_P_H_
|
|
|
|
#define _OKULAR_ROTATIONJOB_P_H_
|
2006-11-03 17:57:32 +00:00
|
|
|
|
|
|
|
#include <QtGui/QImage>
|
2012-09-08 15:06:02 +00:00
|
|
|
#include <QtGui/QTransform>
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
#include <threadweaver/qobjectdecorator.h>
|
|
|
|
#include <threadweaver/job.h>
|
2007-07-04 16:55:33 +00:00
|
|
|
|
2007-01-05 17:09:47 +00:00
|
|
|
#include "core/global.h"
|
2012-08-17 17:25:58 +00:00
|
|
|
#include "core/area.h"
|
2007-01-05 17:09:47 +00:00
|
|
|
|
2006-11-03 17:57:32 +00:00
|
|
|
namespace Okular {
|
|
|
|
|
2013-02-24 21:58:53 +00:00
|
|
|
class DocumentObserver;
|
2007-03-24 10:47:22 +00:00
|
|
|
class PagePrivate;
|
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
class RotationJobInternal : public ThreadWeaver::Job
|
2006-11-03 17:57:32 +00:00
|
|
|
{
|
2014-08-09 18:44:25 +00:00
|
|
|
friend class RotationJob;
|
|
|
|
|
|
|
|
public:
|
|
|
|
QImage image() const;
|
|
|
|
Rotation rotation() const;
|
|
|
|
NormalizedRect rect() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
RotationJobInternal( const QImage &image, Rotation oldRotation, Rotation newRotation );
|
|
|
|
|
|
|
|
const QImage mImage;
|
|
|
|
Rotation mOldRotation;
|
|
|
|
Rotation mNewRotation;
|
|
|
|
QImage mRotatedImage;
|
|
|
|
};
|
2007-03-24 10:47:22 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
class RotationJob : public ThreadWeaver::QObjectDecorator
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2006-11-03 17:57:32 +00:00
|
|
|
public:
|
2013-02-24 21:58:53 +00:00
|
|
|
RotationJob( const QImage &image, Rotation oldRotation, Rotation newRotation, DocumentObserver *observer );
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2007-03-24 10:47:22 +00:00
|
|
|
void setPage( PagePrivate * pd );
|
2012-08-17 17:25:58 +00:00
|
|
|
void setRect( const NormalizedRect &rect );
|
2007-03-24 10:47:22 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
QImage image() const { return static_cast<const RotationJobInternal*>(job())->image(); }
|
|
|
|
Rotation rotation() const { return static_cast<const RotationJobInternal*>(job())->rotation(); }
|
2013-02-24 21:58:53 +00:00
|
|
|
DocumentObserver *observer() const;
|
2007-03-24 10:47:22 +00:00
|
|
|
PagePrivate * page() const;
|
2012-08-17 17:25:58 +00:00
|
|
|
NormalizedRect rect() const;
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2012-09-08 15:06:02 +00:00
|
|
|
static QTransform rotationMatrix( Rotation from, Rotation to );
|
2007-09-03 18:16:27 +00:00
|
|
|
|
2006-11-03 17:57:32 +00:00
|
|
|
private:
|
2013-02-24 21:58:53 +00:00
|
|
|
DocumentObserver *mObserver;
|
2007-03-24 10:47:22 +00:00
|
|
|
PagePrivate * m_pd;
|
2012-08-17 17:25:58 +00:00
|
|
|
NormalizedRect mRect;
|
2006-11-03 17:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|