Hi Christian Sakowski,

I analyzed this issue in 9.3 and changes were made in 9.3 itself in our
project.

Podofo 9.4 released and didnt made any changes for softmask.



On Tue, Aug 16, 2016 at 12:57 PM, Christian Sakowski <
christian.sakow...@heubach-media.de> wrote:

> Hi all,
>
> was this issue fixed in 0.7.4?
>
> I used „LoadFromPngData“ but no alpha channel was used.
> --
>
> Grüße/Regards,
> [heubach-media] | Christian Sakowski
> christian.sakow...@heubach-media.de
> iChat/AIM: SakowskiF
> Tel: +49/(0)40/52 10 59-23
>
>
>
> > Am 13.08.2015 um 11:59 schrieb ram yd <ydramku...@gmail.com>:
> >
> > Hi All,
> >
> > I myself fixed this issue in PODOFO.
> >
> > Issue : Transparency mask is stripped off and not exported as smask.
> >
> > Solution : I have converted 8 bit images to RGBA image and convert the
> transparency stream as a /smask stream in pdf.
> >
> > Tested with 8 bit pallete transparency image and RGBA transparency images
> >
> > I dont know how to merge this changes to PODOFO codebase.
> >
> >
> > void PdfImage::LoadFromPng(const char* pszFilename)
> > {
> >     if( !pszFilename )
> >     {
> >         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> >     }
> >
> >     FILE* hFile = fopen(pszFilename, "rb");
> >     if( !hFile )
> >     {
> >         PODOFO_RAISE_ERROR_INFO( ePdfError_FileNotFound, pszFilename );
> >     }
> >
> >     png_byte header[8];
> >     fread(header, 1, 8, hFile);
> >     if( png_sig_cmp(header, 0, 8) )
> >     {
> >         fclose( hFile );
> >         PODOFO_RAISE_ERROR_INFO( ePdfError_UnsupportedImageFormat, "The
> file could not be recognized as a PNG file." );
> >     }
> >
> >     png_structp pPng = png_create_read_struct(PNG_LIBPNG_VER_STRING,
> NULL, NULL, NULL);
> >     if( !pPng )
> >     {
> >         fclose( hFile );
> >         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> >     }
> >
> >     png_infop pInfo = png_create_info_struct(pPng);
> >     if( !pInfo )
> >     {
> >         png_destroy_read_struct(&pPng, (png_infopp)NULL,
> (png_infopp)NULL);
> >         fclose( hFile );
> >         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> >     }
> >
> >     if( setjmp(png_jmpbuf(pPng)) )
> >     {
> >         png_destroy_read_struct(&pPng, &pInfo, (png_infopp)NULL);
> >         fclose( hFile );
> >         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> >     }
> >
> >     png_init_io(pPng, hFile);
> >     png_set_sig_bytes(pPng, 8);
> >     png_read_info(pPng, pInfo);
> >
> > // Begin
> >     png_uint_32 width;
> >     png_uint_32 height;
> >     int depth;
> >     int color_type;
> >     int interlace;
> >
> >     png_get_IHDR (pPng, pInfo,
> >                   &width, &height, &depth,
> >                   &color_type, &interlace, NULL, NULL);
> >
> >     /* convert palette/gray image to rgb */
> >     if (color_type == PNG_COLOR_TYPE_PALETTE)
> >         png_set_palette_to_rgb(pPng);
> >
> >     if( color_type == PNG_COLOR_TYPE_GRAY_ALPHA )
> >         png_set_gray_to_rgb(pPng);
> >
> > #if 0
> >     /* expand gray bit depth if needed */
> >     if (color_type == PNG_COLOR_TYPE_GRAY) {
> > #if PNG_LIBPNG_VER >= 10209
> >         png_set_expand_gray_1_2_4_to_8 (pPng);
> > #else
> >         png_set_gray_1_2_4_to_8 (pPng);
> > #endif
> >     }
> > #endif
> >     /* transform transparency to alpha */
> >     if (png_get_valid (pPng, pInfo, PNG_INFO_tRNS))
> >         png_set_tRNS_to_alpha (pPng);
> >
> >     if (depth == 16)
> >         png_set_strip_16(pPng);
> >
> >     if (depth < 8)
> >         png_set_packing(pPng);
> > #if 0
> >     /* convert grayscale to RGB */
> >     if (color_type == PNG_COLOR_TYPE_GRAY ||
> >     color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
> >     {
> >     png_set_gray_to_rgb (pPng);
> >     }
> > #endif
> >     if (interlace != PNG_INTERLACE_NONE)
> >         png_set_interlace_handling(pPng);
> >
> >     //png_set_filler (pPng, 0xff, PNG_FILLER_AFTER);
> >
> >     /* recheck header after setting EXPAND options */
> >     png_read_update_info(pPng, pInfo);
> >     png_get_IHDR (pPng, pInfo,
> >                   &width, &height, &depth,
> >                   &color_type, &interlace, NULL, NULL);
> > // End //
> >
> >     // Read the file
> >     if( setjmp(png_jmpbuf(pPng)) )
> >     {
> >         png_destroy_read_struct(&pPng, &pInfo, (png_infopp)NULL);
> >         fclose( hFile );
> >         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> >     }
> >
> >
> >     long lLen = static_cast<long>(png_get_rowbytes(pPng, pInfo) *
> height);
> >     char* pBuffer = static_cast<char*>(malloc(sizeof(char) * lLen));
> >     png_bytepp pRows = NULL;
> >     if (pBuffer)
> >     {
> >         pRows = static_cast<png_bytepp>(malloc(sizeof(png_bytep)*
> height));
> >         if (pRows)
> >         {
> >             for (unsigned int y = 0; y < height; y++)
> >             {
> >                 pRows[y] = reinterpret_cast<png_bytep>(pBuffer + (y *
> png_get_rowbytes(pPng, pInfo)));
> >             }
> >
> >             png_read_image(pPng, pRows);
> >
> >             png_bytep *row_ptr, row;
> >             row_ptr = pRows;
> >             char* smask_data = static_cast<char*>(malloc(sizeof(char) *
> (width*height)));
> >             if (smask_data)
> >             {
> >                 int row_len = 3 * width * sizeof(png_byte);
> >
> >                 for (int j = 0; j < height; j++) {
> >                     row = pRows[j];
> >                     for (int i = 0; i < width; i++) {
> >                         smask_data[width * j + i] = row[4 * i + 3];
> >                     }
> >                 }
> >                 char* image_data_ptr = pBuffer;
> >                 for (int i = 0; i < width*height; i++)
> >                 {
> >                     memmove(image_data_ptr + (3 * i), image_data_ptr +
> (4 * i), 3);
> >                 }
> >
> >                 fclose(hFile);
> >
> >                 m_rRect.SetWidth(width);
> >                 m_rRect.SetHeight(height);
> >
> >                 this->SetImageColorSpace(ePdfColorSpace_DeviceRGB);
> >
> >
> >                 // Set the image data and flate compress it
> >                 PdfMemoryInputStream stream(pBuffer, row_len * height);
> >                 this->SetImageData(width, height, depth, &stream);
> >
> >                 PdfMemoryInputStream smaskstream(smask_data, width *
> height);
> >                 PdfImage smakeImage(this->pCurDocParent);
> >                 smakeImage.SetImageColorSpace(
> ePdfColorSpace_DeviceGray);
> >                 smakeImage.SetImageData(width, height, depth,
> &smaskstream);
> >                 this->SetImageSoftmask(&smakeImage);
> >             }
> >             free(smask_data);
> >         }
> >     }
> >
> >     free(pBuffer);
> >     free(pRows);
> >
> >     png_destroy_read_struct(&pPng, &pInfo, (png_infopp)NULL);
> >
> > }
> >
> > On Fri, Aug 7, 2015 at 4:23 PM, ram yd <ydramku...@gmail.com> wrote:
> > Hi
> > In our project, we are using PODOFO library to create PDF file. When I
> was trying to add the PNG image with transparency, it exported the png
> image without transparency in PDF file.
> >
> > Further analysis shows that PODOFO lib is converting transparency to
> alpha channel. But similar code is not exist in LibHaru. Libharu exporting
> the transparency mask as xref.
> >
> > Please let me know, how to export transparency png image by using PODOFO.
> >
> >
> >
> > --
> > Regards,
> > Ramkumar Y.D
> >
> >
> >
> > --
> > Regards,
> > Ramkumar Y.D
> > ------------------------------------------------------------
> ------------------
> > _______________________________________________
> > Podofo-users mailing list
> > Podofo-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/podofo-users
>
>
> --
> heubach media
> Osterfeldstr. 12-14 | Haus 1 | Eingang Nord
> 22529 Hamburg
> tel: 040 / 52 10 59 - 10 | fax: -99
> mail: i...@heubach-media.de
> home: www.heubach-media.de
> Geschäftsführer|CEO: Matthias Heubach
>
> Mieten Sie Ihre Computer, iPads & Drucker für Ihre Events bei:
> http://www.milo-rental.com
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
> erhalten haben,
> informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist
> nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this e-mail in
> error)
> please notify the sender immediately and destroy this e-mail.
> Any unauthorized copying, disclosure or distribution of the
> material in this e-mail is strictly forbidden.
>



-- 
Regards,
Ramkumar Y.D
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to