VoyForums

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 12345678[9]10 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 07:50:00 11/10/00 Fri
Author: Michel
Subject: Re: How to deal with 1bit color depth graphic?
In reply to: batter 's message, "How to deal with 1bit color depth graphic?" on 21:54:14 11/09/00 Thu


Hi,

I think the problem is that you are using the RGBTRIPLE type. You cannot use that with 1 bit images because a 1 bit scanline does not contain RGB values.

A 1 bit scan line is much shorter than a RGB (true color) scan line because each byte of a 1 bit scan line holds 8 pixels (1 for each bit of the byte).

You need to have code that handles this separately for different image formats.

Best regards,

Michel

> Please Read These Code
> -------------------------------------------------------
> -
> TTiffGraphic *SrcGraphic, *TarGraphic;
> SrcGraphic = new TTiffGraphic();
> TarGraphic = new TTiffGraphic();
> SrcGraphic->LoadFromFile("xxxxxxxx.tif");
> RGBTRIPLE *SrcRow, *DesRow;
> TarGraphic->NewImage(Width,Height,SrcGraphic->ImageForm
> at,NULL
> ,SrcGraphic->XDotsPerInch,SrcGraphic->YDotsPerInch);
> int Width;
> Width = SrcGraphic->Width;
> Height = SrcGraphic->Height;
>
> for (int y = 0; y < Height; y++) {
> DesRow = (RGBTRIPLE*)TarGraphic->ScanLine[y];
> SrcRow = (RGBTRIPLE*)SrcGraphic->ScanLine[y];
> for (int x = 0; x < Width; x++) {
> DesRow[x] = SrcRow[Width - x - 1];
> }
> }
>
> -------------------------------------------------------
> While Tif file not black&white , Run Sucessfully.
> but Tif file is black&white, Crash in For{For{}}.
>
> Thanks a lot

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:

  • Re: How to deal with 1bit color depth graphic? -- Michel, 07:50:00 11/10/00 Fri
    [ Contact Forum Admin ]


    Forum timezone: GMT-5
    VF Version: 3.00b, ConfDB:
    Before posting please read our privacy policy.
    VoyForums(tm) is a Free Service from Voyager Info-Systems.
    Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.