C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[62516] 소스 잘못된 부분 수정좀 부탁드립니다....ㅜㅜ
공도리 [] 735 읽음    2010-09-27 11:34
안녕하세요..제가 gamma 2.2 를 적용해서 이미지를 변환하는 프로그램을 만지고 있습니다..

근데 되는 이미지도 있는데 안되는 이미지도 있더라고요...

소스 잘못된 부분 수정좀 부탁드립니다....ㅜㅜ

제발~~~~부탁plz~..ㅋ

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Math.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{
      if(OpenPictureDialog1->Execute())
      {
        Image1->Picture->Bitmap->LoadFromFile(OpenPictureDialog1->FileName);
        Image1->Width=Image1->Picture->Bitmap->Width;
        Image1->Height=Image1->Picture->Bitmap->Height;
      }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
        Graphics::TBitmap *bmp=new Graphics::TBitmap;
        unsigned char *horizontalLine;
        unsigned char *verticalLine;
        bmp=Image1->Picture->Bitmap;
        for(int y=0;y<bmp->Height;y++)
        {
             horizontalLine = (unsigned char *)bmp->ScanLine[y];
             verticalLine = (unsigned char *)bmp->ScanLine[y];
             for(int x=0;x<bmp->Width;x++)
             {
                 verticalLine[x*3+0] = 255*pow(horizontalLine[x*3+0],StrToFloat(Edit1->Text))/pow(255,StrToFloat(Edit1->Text));
                 verticalLine[x*3+1] = 255*pow(horizontalLine[x*3+1],StrToFloat(Edit1->Text))/pow(255,StrToFloat(Edit1->Text));
                 verticalLine[x*3+2] = 255*pow(horizontalLine[x*3+2],StrToFloat(Edit1->Text))/pow(255,StrToFloat(Edit1->Text));
              }

        }
        Image2->Picture->Bitmap=Image1->Picture->Bitmap;
        delete bmp;

}
//---------------------------------------------------------------------------



void __fastcall TForm1::Button2Click(TObject *Sender)
{
        Graphics::TBitmap *bmp=new Graphics::TBitmap;
        unsigned char *horizontalLine;
        unsigned char *verticalLine;
        bmp=Image1->Picture->Bitmap;
        for(int y=0;y<bmp->Height;y++)
        {
             horizontalLine = (unsigned char *)bmp->ScanLine[y];
             verticalLine = (unsigned char *)bmp->ScanLine[y];
             for(int x=0;x<bmp->Width;x++)
             {
                 verticalLine[x*3+0] = 255*pow(horizontalLine[x*3+0],1/StrToFloat(Edit2->Text))/pow(255,1/StrToFloat(Edit2->Text));
                 verticalLine[x*3+1] = 255*pow(horizontalLine[x*3+1],1/StrToFloat(Edit2->Text))/pow(255,1/StrToFloat(Edit2->Text));
                 verticalLine[x*3+2] = 255*pow(horizontalLine[x*3+2],1/StrToFloat(Edit2->Text))/pow(255,1/StrToFloat(Edit2->Text));
              }

        }
         Image3->Picture->Bitmap=Image1->Picture->Bitmap;
         delete bmp;
}
//---------------------------------------------------------------------------




이부분에서 자꾸 문제가 걸리더라고요....

verticalLine[x*3+1] = 255*pow(horizontalLine[x*3+1],StrToFloat(Edit1->Text))/pow(255,StrToFloat(Edit1->Text));
                 verticalLine[x*3+2] = 255*pow(horizontalLine[x*3+2],StrToFloat(Edit1->Text))/pow(255,StrToFloat(Edit1->Text));
고수님들.. 확인부탁드립니다...ㅜ

+ -

관련 글 리스트
62516 소스 잘못된 부분 수정좀 부탁드립니다....ㅜㅜ 공도리 735 2010/09/27
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.