Files
external_libcamera/src/qcam/viewfinder.h
T
Kieran Bingham 0f292e7821 qcam: Provide save image functionality
Implement a save image button on the toolbar which will take a current
viewfinder image and present the user with a QFileDialog to allow them
to choose where to save the image.

Utilise the QImageWriter to perform the output task.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14 12:34:36 +00:00

45 lines
842 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* viewfinder.h - qcam - Viewfinder
*/
#ifndef __QCAM_VIEWFINDER_H__
#define __QCAM_VIEWFINDER_H__
#include <QMutex>
#include <QWidget>
#include "format_converter.h"
class QImage;
class ViewFinder : public QWidget
{
public:
ViewFinder(QWidget *parent);
~ViewFinder();
int setFormat(unsigned int format, unsigned int width,
unsigned int height);
void display(const unsigned char *rgb, size_t size);
QImage getCurrentImage();
protected:
void paintEvent(QPaintEvent *) override;
QSize sizeHint() const override;
private:
unsigned int format_;
unsigned int width_;
unsigned int height_;
FormatConverter converter_;
QImage *image_;
QMutex mutex_; /* Prevent concurrent access to image_ */
};
#endif /* __QCAM_VIEWFINDER__ */