掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Bitmapの表示色を変更するには (ID:25163)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
べたなやり方ですが・・・ var y, x: Word; P1, P2 :PByteArray; begin Image1.Picture.Bitmap.LoadFromFile('C:\aaa.bmp'); Image2.Picture.Bitmap.Width := Image1.Picture.Bitmap.Width; Image2.Picture.Bitmap.Height := Image1.Picture.Bitmap.Height; Image1.Picture.Bitmap.PixelFormat := pf24bit; Image2.Picture.Bitmap.PixelFormat := pf24bit; for y := 0 to Pred(Image1.Picture.Bitmap.Height) do begin P1 := Image1.Picture.Bitmap.ScanLine[y]; P2 := Image2.Picture.Bitmap.ScanLine[y]; for x := 0 to Pred(Image1.Picture.Bitmap.Width) do begin if (P1[X*3+0] = 0) and (P1[X*3+1] = 0) and (P1[X*3+2] = 0) then begin P2[X*3+0] := $FF; P2[X*3+1] := $FF; P2[X*3+2] := $FF; end else if (P1[X*3+0] = $FF) and (P1[X*3+1] = $FF) and (P1[X*3+2] = $FF) then begin P2[X*3+0] := 0; P2[X*3+1] := 0; P2[X*3+2] := 0; end else begin P2[X*3+0] := P1[X*3+0]; P2[X*3+1] := P1[X*3+1]; P2[X*3+2] := P1[X*3+2]; end; end; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.