VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

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.