From: Pablo d'A. <da...@us...> - 2006-03-04 02:08:36
|
Update of /cvsroot/hugin/hugin/src/foreign/vigra In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28755/vigra Modified Files: Tag: vigra140-branch codec.hxx imageinfo.hxx impex.hxx Log Message: added support for icc profiles in png (partially tested) and jpeg (totally untested) files. Index: imageinfo.hxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra/imageinfo.hxx,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- imageinfo.hxx 3 Mar 2006 00:30:59 -0000 1.2.2.1 +++ imageinfo.hxx 4 Mar 2006 02:08:27 -0000 1.2.2.2 @@ -266,17 +266,24 @@ */ Diff2D getPosition() const; - /** Returns the size of the ICC profile + /** Returns the size of the ICC profile, if available + * Note: the returned size will become invalid if setICCProfile + * is called, or the ImageExport object is destroyed. **/ UInt32 getICCProfileLength() const; /** Returns a pointer to the beginning of the ICC profile data. + * Note: the returned pointer will become invalid if setICCProfile + * is called, or the ImageExport object is destroyed. **/ const unsigned char *getICCProfile() const; /** Sets the ICC profile to a copy of the given profile. + * Note: the profile will be copied by setICCProfile. \p buf + * does not need to be valid during the whole lifetime of the + * ImageExport object. **/ - void setICCProfile(const UInt32 length, const unsigned char * const buf); + ImageExportInfo & setICCProfile(const UInt32 length, const unsigned char * const buf); private: std::string m_filename, m_filetype, m_pixeltype, m_comp; @@ -413,6 +420,8 @@ UInt32 getICCProfileLength() const; /** Returns a pointer to the beginning of the ICC profile data. + * Note: the returned ICC profile is only valid during the lifetime of + * the ImageExport object. **/ const unsigned char *getICCProfile() const; Index: codec.hxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra/codec.hxx,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- codec.hxx 3 Mar 2006 00:30:59 -0000 1.2.2.1 +++ codec.hxx 4 Mar 2006 02:08:27 -0000 1.2.2.2 @@ -141,12 +141,11 @@ // Decoder and Encoder are pure virtual types that define a common // interface for all image file formats impex supports. // - // dangelo: added a simple, string based property interface to - // to support importing complex image formats, like tiff. - // - // todo: support subimages as well. - // dangelo: not pure virtual, because the catch access - // to more exotic property not supported by most codecs. + // dangelo: not pure virtual anymore, because some image formats + // do not offer access to more exotic properties like + // offset, resolution and icc profile. + // This avoid having to implement stubs for these in + // all children struct Decoder { Index: impex.hxx =================================================================== RCS file: /cvsroot/hugin/hugin/src/foreign/vigra/impex.hxx,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- impex.hxx 3 Mar 2006 00:30:59 -0000 1.2.2.1 +++ impex.hxx 4 Mar 2006 02:08:27 -0000 1.2.2.2 @@ -484,10 +484,10 @@ *scanline2 = a.template getComponent<SrcRowIterator, 2>( xs ); *scanline3 = a.template getComponent<SrcRowIterator, 3>( xs ); */ - *scanline0 = a.getComponent( xs, 0); - *scanline1 = a.getComponent( xs, 1); - *scanline2 = a.getComponent( xs, 2); - *scanline3 = a.getComponent( xs, 3); + *scanline0 = detail::RequiresExplicitCast<DstValueType>::cast(a.getComponent( xs, 0)); + *scanline1 = detail::RequiresExplicitCast<DstValueType>::cast(a.getComponent( xs, 1)); + *scanline2 = detail::RequiresExplicitCast<DstValueType>::cast(a.getComponent( xs, 2)); + *scanline3 = detail::RequiresExplicitCast<DstValueType>::cast(a.getComponent( xs, 3)); scanline0 += offset; scanline1 += offset; scanline2 += offset; @@ -644,7 +644,11 @@ FindMinMax<SrcComponent> minmax; for(unsigned int i=0; i<sget.size(sul); ++i) { - VectorElementAccessor<SrcAccessor> band(i, sget); + // FIXME dangelo - This will break with vector accessors that have a "by value" interface. + // use VectorComponentValueAccessor instead, since it should work in both cases, even + // if it might be a bit slower.. + //VectorElementAccessor<SrcAccessor> band(i, sget); + VectorComponentValueAccessor<typename SrcAccessor::value_type> band(i); inspectImage( sul, slr, band, minmax ); } double scale = (double)NumericTraits<DestValue>::max() / (minmax.max - minmax.min) - @@ -655,7 +659,9 @@ for(unsigned int i=0; i<sget.size(sul); ++i) { BasicImageView<DestValue> subImage = makeBasicImageView(array.bindOuter(i)); - VectorElementAccessor<SrcAccessor> band(i, sget); + // FIXME dangelo: use VectorComponentValueAccessor + //VectorElementAccessor<SrcAccessor> band(i, sget); + VectorComponentValueAccessor<typename SrcAccessor::value_type> band(i); transformImage( sul, slr, band, subImage.upperLeft(), subImage.accessor(), linearIntensityTransform( scale, offset ) ); } |