2002-03-06 12:07:23 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2003-08-23 00:17:00 +00:00
|
|
|
* \file xformsImage.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-06 12:07:23 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-03-11 17:00:41 +00:00
|
|
|
*/
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/* An instantiation of Image that makes use of the xforms lirary routines
|
2002-03-11 17:00:41 +00:00
|
|
|
* to load and store the image in memory.
|
2002-03-06 12:07:23 +00:00
|
|
|
*/
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
#ifndef XFORMSIMAGE_H
|
|
|
|
#define XFORMSIMAGE_H
|
2002-03-06 12:07:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "graphics/GraphicsImage.h"
|
2002-06-12 14:21:58 +00:00
|
|
|
|
2002-07-15 17:17:57 +00:00
|
|
|
#include <X11/X.h>
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
struct flimage_;
|
|
|
|
typedef flimage_ FL_IMAGE;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace graphics {
|
2002-03-06 12:07:23 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
class xformsImage : public Image
|
2002-03-06 12:07:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Access to this class is through this static method.
|
|
|
|
static ImagePtr newImage();
|
|
|
|
|
|
|
|
/// Return the list of loadable formats.
|
|
|
|
static FormatList loadableFormats();
|
|
|
|
|
|
|
|
///
|
2002-06-28 11:22:56 +00:00
|
|
|
~xformsImage();
|
2002-03-06 12:07:23 +00:00
|
|
|
///
|
|
|
|
Pixmap getPixmap() const;
|
|
|
|
|
2003-09-16 15:34:39 +00:00
|
|
|
/// Internal callbacks.
|
|
|
|
void statusCB(string const &);
|
|
|
|
void errorCB(string const &);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2003-09-16 15:34:39 +00:00
|
|
|
private:
|
|
|
|
/// Create a copy
|
|
|
|
virtual Image * clone_impl() const;
|
|
|
|
/// Get the image width
|
|
|
|
virtual unsigned int getWidth_impl() const;
|
2002-03-06 12:07:23 +00:00
|
|
|
/// Get the image height
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual unsigned int getHeight_impl() const;
|
|
|
|
/// Is the image drawable ?
|
|
|
|
virtual bool isDrawable_impl() const;
|
2002-03-06 12:07:23 +00:00
|
|
|
/** Load the image file into memory.
|
2002-06-28 11:22:56 +00:00
|
|
|
* The process is asynchronous, so this method starts the loading.
|
|
|
|
* When finished, the Image::finishedLoading signal is emitted.
|
2002-03-06 12:07:23 +00:00
|
|
|
*/
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void load_impl(string const & filename);
|
2002-03-06 12:07:23 +00:00
|
|
|
/** Generate the pixmap, based on the current state of
|
|
|
|
* image_ (clipped, rotated, scaled etc).
|
|
|
|
* Uses the params to decide on color, grayscale etc.
|
|
|
|
* Returns true if the pixmap is created.
|
|
|
|
*/
|
2003-09-16 15:34:39 +00:00
|
|
|
bool setPixmap_impl(Params const & params);
|
2002-03-06 12:07:23 +00:00
|
|
|
/// Clip the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void clip_impl(Params const & params);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-03-06 12:07:23 +00:00
|
|
|
/// Rotate the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void rotate_impl(Params const & params);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-03-06 12:07:23 +00:00
|
|
|
/// Scale the image using params.
|
2003-09-16 15:34:39 +00:00
|
|
|
virtual void scale_impl(Params const & params);
|
2002-03-06 12:07:23 +00:00
|
|
|
|
|
|
|
/// Access to the class is through newImage() and clone.
|
2002-06-28 11:22:56 +00:00
|
|
|
xformsImage();
|
2002-03-06 12:07:23 +00:00
|
|
|
///
|
2002-06-28 11:22:56 +00:00
|
|
|
xformsImage(xformsImage const &);
|
2002-03-06 12:07:23 +00:00
|
|
|
|
|
|
|
/// The xforms container.
|
|
|
|
FL_IMAGE * image_;
|
|
|
|
|
|
|
|
/// The pixmap itself.
|
|
|
|
Pixmap pixmap_;
|
|
|
|
|
|
|
|
/// Is the pixmap initialized?
|
|
|
|
enum PixmapStatus {
|
|
|
|
///
|
|
|
|
PIXMAP_UNINITIALISED,
|
|
|
|
///
|
|
|
|
PIXMAP_FAILED,
|
|
|
|
///
|
|
|
|
PIXMAP_SUCCESS
|
|
|
|
};
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-03-06 12:07:23 +00:00
|
|
|
PixmapStatus pixmap_status_;
|
|
|
|
};
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
2002-03-06 12:07:23 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
#endif // XFORMSIMAGE_H
|