Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 57a3c599205d916ce14443e202bd949c204156a0 @thp thp committed May 18, 2012
Showing with 10,252 additions and 0 deletions.
  1. +50 −0 ClassicPrintProvider.h
  2. +10 −0 README
  3. +139 −0 classicprint-0.1/BlendFilter.cpp
  4. +59 −0 classicprint-0.1/BlendFilter.h
  5. +844 −0 classicprint-0.1/ClassicPrint.cpp
  6. +354 −0 classicprint-0.1/ClassicPrint.h
  7. +227 −0 classicprint-0.1/ClassicPrintFilm.cpp
  8. +155 −0 classicprint-0.1/ClassicPrintFilm.h
  9. +290 −0 classicprint-0.1/ClassicPrintLens.cpp
  10. +204 −0 classicprint-0.1/ClassicPrintLens.h
  11. +380 −0 classicprint-0.1/ClassicPrintProcessing.cpp
  12. +224 −0 classicprint-0.1/ClassicPrintProcessing.h
  13. +207 −0 classicprint-0.1/ColourLookupFilter.cpp
  14. +63 −0 classicprint-0.1/ColourLookupFilter.h
  15. +136 −0 classicprint-0.1/ContrastFilter.cpp
  16. +58 −0 classicprint-0.1/ContrastFilter.h
  17. +129 −0 classicprint-0.1/FrameFilter.cpp
  18. +65 −0 classicprint-0.1/FrameFilter.h
  19. +31 −0 classicprint-0.1/LICENSE
  20. +223 −0 classicprint-0.1/LevelsFilter.cpp
  21. +72 −0 classicprint-0.1/LevelsFilter.h
  22. +153 −0 classicprint-0.1/NoiseFilter.cpp
  23. +59 −0 classicprint-0.1/NoiseFilter.h
  24. +241 −0 classicprint-0.1/VignetteFilter.cpp
  25. +81 −0 classicprint-0.1/VignetteFilter.h
  26. +45 −0 classicprint-0.1/classicPrintData/colour_profile/colour_profiles.xml
  27. BIN classicprint-0.1/classicPrintData/light_leak/Light Leak 1.jpg
  28. BIN classicprint-0.1/classicPrintData/light_leak/Light Leak 2.jpg
  29. BIN classicprint-0.1/classicPrintData/light_leak/Light Leak 3.jpg
  30. BIN classicprint-0.1/classicPrintData/noise/noise.jpg
  31. +34 −0 classicprint-0.1/classicPrintData/settings.xml
  32. +10 −0 classicprint-0.1/classicprint.qrc
  33. +57 −0 classicprint-0.1/photolabel.cpp
  34. +61 −0 classicprint-0.1/photolabel.h
  35. +155 −0 classicprint-0.1/utils.cpp
  36. +59 −0 classicprint-0.1/utils.h
  37. +21 −0 classicprintqml.cpp
  38. +31 −0 classicprintqml.pro
  39. +7 −0 classicprintqml.qml
  40. +5 −0 classicprintqml.qrc
  41. +254 −0 imagefilters-2.1/INSTALL.TXT
  42. +23 −0 imagefilters-2.1/LGPL_EXCEPTION.txt
  43. +674 −0 imagefilters-2.1/LICENSE.GPL3
  44. +504 −0 imagefilters-2.1/LICENSE.LGPL
  45. +10 −0 imagefilters-2.1/README.TXT
  46. +13 −0 imagefilters-2.1/buildlib/buildlib.pro
  47. +6 −0 imagefilters-2.1/common.pri
  48. +112 −0 imagefilters-2.1/configure
  49. +139 −0 imagefilters-2.1/doc/html/classic.css
  50. BIN imagefilters-2.1/doc/html/images/lena-edge.jpg
  51. BIN imagefilters-2.1/doc/html/images/qt-logo.png
  52. +41 −0 imagefilters-2.1/doc/html/index.html
  53. +33 −0 imagefilters-2.1/doc/html/qtimagefilter-members.html
  54. +173 −0 imagefilters-2.1/doc/html/qtimagefilter.html
  55. +30 −0 imagefilters-2.1/doc/html/qtimagefilterfactory-members.html
  56. +106 −0 imagefilters-2.1/doc/html/qtimagefilterfactory.html
  57. +40 −0 imagefilters-2.1/doc/html/qtimagefilters.dcf
  58. +60 −0 imagefilters-2.1/doc/html/qtimagefilters.index
  59. BIN imagefilters-2.1/doc/html/qtimagefilters.qch
  60. +56 −0 imagefilters-2.1/doc/html/qtimagefilters.qhp
  61. BIN imagefilters-2.1/doc/images/lena-edge.jpg
  62. BIN imagefilters-2.1/doc/images/qt-logo.png
  63. +41 −0 imagefilters-2.1/doc/index.qdoc
  64. +3 −0 imagefilters-2.1/examples/examples.pro
  65. BIN imagefilters-2.1/examples/imagetool/images/lena.jpg
  66. BIN imagefilters-2.1/examples/imagetool/images/logo.png
  67. BIN imagefilters-2.1/examples/imagetool/images/mandrill.jpg
  68. +12 −0 imagefilters-2.1/examples/imagetool/imagetool.pro
  69. +197 −0 imagefilters-2.1/examples/imagetool/imagetoolwidget.cpp
  70. +70 −0 imagefilters-2.1/examples/imagetool/imagetoolwidget.h
  71. +224 −0 imagefilters-2.1/examples/imagetool/imagetoolwidget.ui
  72. +59 −0 imagefilters-2.1/examples/imagetool/main.cpp
  73. +123 −0 imagefilters-2.1/examples/imagetool/mirrorfilter.h
  74. +5 −0 imagefilters-2.1/qtimagefilters.pro
  75. +1 −0 imagefilters-2.1/src/QtImageFilter
  76. +1 −0 imagefilters-2.1/src/QtImageFilterFactory
  77. +429 −0 imagefilters-2.1/src/convolutionfilter.cpp
  78. +132 −0 imagefilters-2.1/src/convolutionfilter.h
  79. +153 −0 imagefilters-2.1/src/gaussfilter.h
  80. +302 −0 imagefilters-2.1/src/punchfilter.cpp
  81. +73 −0 imagefilters-2.1/src/punchfilter.h
  82. +241 −0 imagefilters-2.1/src/qtimagefilter.cpp
  83. +144 −0 imagefilters-2.1/src/qtimagefilter.h
  84. +486 −0 imagefilters-2.1/src/qtimagefilterfactory.cpp
  85. +15 −0 imagefilters-2.1/src/qtimagefilters.pri
  86. +328 −0 imagefilters-2.1/src/qtmatrix.h
@@ -0,0 +1,50 @@
+#ifndef CLASSICPRINTQML_CLASSICPRINTPROVIDER_H
+#define CLASSICPRINTQML_CLASSICPRINTPROVIDER_H
+
+#include <QtCore>
+#include <QtGui>
+#include <QtDeclarative>
+
+#include "ClassicPrint.h"
+
+class ClassicPrintProvider : public QDeclarativeImageProvider {
+ private:
+ ClassicPrint classicPrint;
+
+ public:
+ ClassicPrintProvider()
+ : QDeclarativeImageProvider(QDeclarativeImageProvider::Image),
+ classicPrint()
+ {
+ classicPrint.load(":/classicPrintData/settings.xml");
+ }
+
+ QImage requestImage(const QString &id, QSize *size,
+ const QSize &requestedSize)
+ {
+ Q_UNUSED(size);
+
+ QImage source("/" + id);
+ size->setWidth(source.width());
+ size->setHeight(source.height());
+
+ QImage destination(requestedSize, source.format());
+ classicPrint.process(source,
+ requestedSize.width(),
+ requestedSize.height(),
+ destination);
+
+ return destination;
+ }
+
+ static void init() {
+ ClassicPrint::init();
+ }
+
+ static void addToView(QDeclarativeView *view) {
+ view->engine()->addImageProvider(QLatin1String("classicPrint"),
+ new ClassicPrintProvider);
+ }
+};
+
+#endif
10 README
@@ -0,0 +1,10 @@
+
+ QML port of Roy Hopkins' ClassicPrint
+ =====================================
+
+This is the port of "ClassicPrint" for the N900 to QML. It re-uses most of the
+C++/Qt backend, but adds a QML interface (image provider + other object) to
+utilize the ClassicPrint core from a QML application on e.g. MeeGo Harmattan.
+
+ Contact information: Thomas Perl <thp.io/about>
+
@@ -0,0 +1,139 @@
+/*!
+** @file BlendFilter.cpp
+**
+** @brief QtImageFilter to blend an image on disk with the current image
+**
+*/
+
+/*---------------------------------------------------------------------------
+** Includes
+*/
+#include "BlendFilter.h"
+#include "utils.h"
+#include <stdint.h>
+
+/*---------------------------------------------------------------------------
+** Defines and Macros
+*/
+
+/*---------------------------------------------------------------------------
+** Typedefs
+*/
+
+/*---------------------------------------------------------------------------
+** Local function prototypes
+*/
+
+/*---------------------------------------------------------------------------
+** Data
+*/
+
+QtImageFilter*
+register_blend_filter() {
+ return new BlendFilter();
+}
+
+BlendFilter::BlendFilter() {
+}
+
+QImage BlendFilter::apply(
+ const QImage &img,
+ const QRect& clipRect
+ ) const {
+ int x;
+ int y;
+ int top = 0;
+ int bottom = img.height();
+ int left = 0;
+ int right = img.width();
+
+ if (!clipRect.isNull()) {
+ // If we have a cliprect, set our coordinates to our cliprect
+ // and make sure it is within the boundaries of the image
+ top = qMax(top, clipRect.top());
+ bottom = qMin(bottom, clipRect.bottom());
+ left = qMax(left, clipRect.left());
+ right = qMin(right, clipRect.right());
+ }
+
+ QImage::Format fmt = img.format();
+ QImage resultImg = img.convertToFormat(QImage::Format_ARGB32);
+
+ // Resize the blend image to match the source image
+ QImage resized_image(m_blend_image.scaled(img.width(), img.height(),Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+
+ uchar* bits = resultImg.bits();
+ const uchar* bits_blend = resized_image.bits();
+
+ for (y = top; y < bottom; y++) {
+ for (x = left; x < right; x++) {
+ // Read the pixel data
+ QRgb rgb_image = ((uint32_t*)bits)[x];
+ QRgb rgb_blend = ((uint32_t*)bits_blend)[x];
+
+ int red = qRed(rgb_image) + qRed(rgb_blend) -
+ (qRed(rgb_blend) * qRed(rgb_image) / 255.0);
+ int green = qGreen(rgb_image) + qGreen(rgb_blend) -
+ (qGreen(rgb_blend) * qGreen(rgb_image) / 255.0);
+ int blue = qBlue(rgb_image) + qBlue(rgb_blend) -
+ (qBlue(rgb_blend) * qBlue(rgb_image) / 255.0);
+
+ ((uint32_t*)bits)[x] = qRgb(red, green, blue);
+ }
+ bits += resultImg.bytesPerLine();
+ bits_blend += resized_image.bytesPerLine();
+ }
+
+ if (resultImg.format() != fmt) {
+ resultImg = resultImg.convertToFormat(fmt);
+ }
+ return resultImg;
+}
+
+QString
+BlendFilter::name(
+) const {
+ return QLatin1String("Blend");
+}
+
+QVariant
+BlendFilter::option(
+ int filteroption
+) const {
+ if (filteroption == BlendImage) {
+ return QVariant(m_blend_filename);
+ }
+ return QVariant();
+}
+
+bool
+BlendFilter::setOption(
+ int filteroption,
+ const QVariant &value
+) {
+ if (filteroption == BlendImage) {
+ m_blend_filename = value.toString();
+ m_blend_image.load(m_blend_filename);
+ if (m_blend_image.isNull()) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool
+BlendFilter::supportsOption(
+ int option
+) const {
+ if (option == BlendImage) {
+ return true;
+ }
+ return false;
+}
+
+QString
+BlendFilter::description(
+) const {
+ return QObject::tr("Blend an image on disk with the current image");
+}
+
@@ -0,0 +1,59 @@
+/*!
+** @file BlendFilter.h
+**
+** @brief QtImageFilter to blend an image on disk with the current image
+**
+*/
+#ifndef __blendfilter__h
+#define __blendfilter__h
+
+/*---------------------------------------------------------------------------
+** Includes
+*/
+#include <QtImageFilter>
+#include <QImage>
+
+/*---------------------------------------------------------------------------
+** Defines and Macros
+*/
+#define REGISTER_BLEND_FILTER QtImageFilterFactory::registerImageFilter("Blend", register_blend_filter)
+
+/*---------------------------------------------------------------------------
+** Typedefs
+*/
+
+/*---------------------------------------------------------------------------
+** Local function prototypes
+*/
+
+/*---------------------------------------------------------------------------
+** Data
+*/
+
+QtImageFilter* register_blend_filter();
+
+class BlendFilter : public QtImageFilter {
+public:
+ enum BlendFilterOption {
+ BlendImage = UserOption
+ };
+ BlendFilter();
+
+ virtual QImage apply(const QImage &img, const QRect& clipRect = QRect()) const;
+
+ virtual QString name() const;
+
+ virtual QVariant option(int filteroption) const;
+
+ virtual bool setOption(int filteroption, const QVariant &value);
+
+ virtual bool supportsOption(int option) const;
+
+ virtual QString description() const;
+
+private:
+ QImage m_blend_image;
+ QString m_blend_filename;
+};
+
+#endif
Oops, something went wrong.

0 comments on commit 57a3c59

Please sign in to comment.