File indexing completed on 2025-01-05 03:59:44

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-07-25
0007  * Description : image region widget item for image editor.
0008  *
0009  * SPDX-FileCopyrightText: 2013-2014 by Yiou Wang <geow812 at gmail dot com>
0010  * SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IMAGE_REGION_ITEM_H
0017 #define DIGIKAM_IMAGE_REGION_ITEM_H
0018 
0019 // Qt includes
0020 
0021 #include <QStyleOptionGraphicsItem>
0022 
0023 // Local includes
0024 
0025 #include "graphicsdimgitem.h"
0026 #include "digikam_export.h"
0027 #include "dimg.h"
0028 #include "imageregionwidget.h"
0029 
0030 namespace Digikam
0031 {
0032 
0033 class DIGIKAM_EXPORT ImageRegionItem : public GraphicsDImgItem
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038 
0039     explicit ImageRegionItem(ImageRegionWidget* const view, bool paintExtras = true);
0040     ~ImageRegionItem()                                                                     override;
0041 
0042     void setTargetImage(const DImg& img);
0043     void setHighLightPoints(const QPolygon& pointsList);
0044     void setRenderingPreviewMode(int mode);
0045 
0046     void  paintExtraData(QPainter* const painter);
0047     QRect getImageRegion() const;
0048 
0049     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
0050     void hoverEnterEvent(QGraphicsSceneHoverEvent*)                                        override;
0051     void hoverLeaveEvent(QGraphicsSceneHoverEvent*)                                        override;
0052 
0053 private:
0054 
0055     class Private;
0056     Private* const dd;
0057 };
0058 
0059 } // namespace Digikam
0060 
0061 #endif // DIGIKAM_IMAGE_REGION_ITEM_H