Bug Report T618329
Visible to All Users

8-bit grayscale masked images are incorrectly displayed in certain cases

created 7 years ago (modified 7 years ago)

Hello,

I have a pdf file from a customer who does not display correctly in the Devexpress PDF viewer, half of the pdf is shown black (see attachment).
Can you please check the attached pdf to see why it is not displayed properly?

In the Windows default Edge app the pdf opens without problem.
Also the pdf is strictly confidential, it contains customer info, please keep this ticket private until the attached pdf and screenshot is removed, thanks.

Show previous comments (2)
DevExpress Support Team 7 years ago

    Please try using the following test and keep us informed of your results:

    Delphi
    dxPDFCore.pas function TdxPDFDocumentImage.ToRGB(const AData: TBytes; APixelFormat: TdxPDFPixelFormat; AWidth, AHeight: Integer): TBytes; var AZero, AOne, B, AMask, AComponent: Byte; ADataLength, Y, ASrc, ADest, X, ASize, I, AIndex: Integer; ARGBData: TBytes; begin AZero := 0; AOne := 255; case APixelFormat of pfGray1bit: begin ADataLength := Length(AData); SetLength(ARGBData, AWidth * AHeight * 3); ASrc := 0; ADest := 0; for Y := 0 to AHeight - 1 do begin B := AData[ASrc]; AMask := $80; for X := 0 to AWidth - 1 do begin AComponent := IfThen((B and AMask) = 0, AZero, AOne); ARGBData[ADest] := AComponent; ARGBData[ADest + 1] := AComponent; ARGBData[ADest + 2] := AComponent; Inc(ADest, 3); AMask := AMask shr 1; if AMask = 0 then begin AMask := $80; Inc(ASrc); if ASrc >= ADataLength then Break; B := AData[ASrc]; end; end; if AMask <> $80 then Inc(ASrc); end; Result := ARGBData; end; pfGray8bit: begin ASize := Length(AData); SetLength(ARGBData, ASize * 3); AIndex := 0; for I := 0 to ASize - 1 do begin B := AData[I]; ARGBData[AIndex] := B; ARGBData[AIndex + 1] := B; ARGBData[AIndex + 2] := B; Inc(AIndex, 3); end; Result := ARGBData; end; else Result := AData; end; end;

      Hi Mikhail,

      the solution above works.
      Can you inform me when it will be added into the devexpress release (which version of VCL in other words)?

      thanks, regards,
      Glenn

      DevExpress Support Team 7 years ago

        It will be added to the next minor version of our controls.

        Answers approved by DevExpress Support

        created 7 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.