X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgraphics%2FGraphicsImage.h;h=6722b87bc03f20637a8450dd7732b58ae5d5c69b;hb=38c2cde0d8695ac5287bae218c4a33a2acf18ef8;hp=5a4ada786635d6cf461a9c46d1b32d8d84f51c8a;hpb=a674f70d4a013e69a88343e5b6d13357d8a33493;p=lyx.git diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 5a4ada7866..6722b87bc0 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -1,116 +1,72 @@ // -*- C++ -*- /** - * \file GraphicsImage.h - * Copyright 2002 the LyX Team - * Read the file COPYING + * \file GraphicsImage.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author Baruch Even - * \author Angus Leeming + * \author Baruch Even + * \author Angus Leeming * - * An abstract base class for the images themselves. - * Allows the user to retrieve the pixmap, once loaded and to issue commands - * to modify it. + * Full author contact details are available in file CREDITS. * - * The signals newImage and loadableFormats are connected to the approriate - * derived classes elsewhere, allowing the graphics cache to access them - * without knowing anything about their instantiation. + * An abstract base class for the images themselves. + * Allows the user to retrieve the pixmap, once loaded and to issue commands + * to modify it. * - * The loading process can be asynchronous, but cropping, rotating and - * scaling block execution. + * The boost::functions newImage and loadableFormats are connected to the + * appropriate derived classes elsewhere, allowing the graphics cache to + * access them without knowing anything about their instantiation. + * + * The loading process can be asynchronous, but cropping, rotating and + * scaling block execution. */ #ifndef GRAPHICSIMAGE_H #define GRAPHICSIMAGE_H -#include "LString.h" - -#include -#include -#include - -#include // for Pixmap :-( +namespace lyx { -#include -#include +namespace support { class FileName; } -#ifdef __GNUG__ -#pragma interface -#endif - -namespace grfx { +namespace graphics { class Params; class Image { public: - /** This is to be connected to a function that will return a new - * instance of a viable derived class. - */ - typedef boost::shared_ptr ImagePtr; - /// - static boost::function0 newImage; - - /// Return the list of loadable formats. - typedef std::vector FormatList; - /// - static boost::function0 loadableFormats; - - /// Must define default c-tor explicitly as we define a copy c-tor. - Image() {} - /// Don't copy the signal finishedLoading - Image(Image const &) {} /// virtual ~Image() {} /// Create a copy virtual Image * clone() const = 0; - /// - virtual Pixmap getPixmap() const = 0; - /// Get the image width - virtual unsigned int getWidth() const = 0; + virtual unsigned int width() const = 0; /// Get the image height - virtual unsigned int getHeight() const = 0; + virtual unsigned int height() const = 0; - /** At the end of the loading process inform the outside world - * by emitting a signal. - */ - typedef boost::signal1 SignalType; - /// - SignalType finishedLoading; + /// Is the image drawable ? + virtual bool isDrawable() const = 0; /** Start loading the image file. * The caller should expect this process to be asynchronous and * so should connect to the "finished" signal above. */ - virtual void load(string const & filename) = 0; + virtual bool load(support::FileName const & filename) = 0; /** Generate the pixmap. * Uses the params to decide on color, grayscale etc. * Returns true if the pixmap is created. */ virtual bool setPixmap(Params const & params) = 0; - - /// Clip the image using params. - virtual void clip(Params const & params) = 0; - - /// Rotate the image using params. - virtual void rotate(Params const & params) = 0; - - /// Scale the image using params. - virtual void scale(Params const & params) = 0; - -protected: - /** Uses the params to ascertain the dimensions of the scaled image. - * Returned as make_pair(width, height). - * If something goes wrong, returns make_pair(getWidth(), getHeight()) - */ - std::pair - getScaledDimensions(Params const & params) const; }; -} // namespace grfx +/// Only way to create a new Image. +/// Implemented in the frontend. +Image * newImage(); + +} // namespace graphics +} // namespace lyx #endif // GRAPHICSIMAGE_H