mohmp3
یک شنبه 20 شهریور 1384, 21:18 عصر
سلام
در حال حاضر عنوان بهتر به ذهنم نرسید.
من از تابع زیر استفاده می کنم . با افزایش مقادیر R یا B یا G رنگ تصویر تغییر می کند. اما با کاهش این مقادیر رنگ تصویر به سمت حالت اولیه تغییر نمی کند. ممنون می شوم راهنمایی بفرمایید.
function SetColorValue(Bitmap: TBitmap; Red, Green, Blue: Integer): Boolean;
var
i, j: Integer;
rgbc: array[0..2] of Byte;
c: TColor;
r, g, b: Byte;
begin
if (Red = 0) and (Green = 0) and (Blue = 0) then
begin
Result := False;
Exit;
end;
for i := 0 to Bitmap.Height do
begin
for j := 0 to Bitmap.Width do
begin
c := Bitmap.Canvas.Pixels[j, i];
rgbc[0] := GetRValue(c);
rgbc[1] := GetGValue(c);
rgbc[2] := GetBValue(c);
if not (rgbc[0] + Red < 0) and not (rgbc[0] + Red > 255) then
rgbc[0] := rgbc[0] + Red;
if not (rgbc[1] + Green < 0) and not (rgbc[1] + Green > 255) then
rgbc[1] := rgbc[1] + Green;
if not (rgbc[2] + Blue < 0) and not (rgbc[2] + Blue > 255) then
rgbc[2] := rgbc[2] + Blue;
r := rgbc[0];
g := rgbc[1];
b := rgbc[2];
Bitmap.Canvas.Pixels[j, i] := RGB(r, g, b);
end;
end;
Result := True;
end;
همچنین لطفا اگر ممکنه در مورد تغییرات نور و کنتراست تصویر هم راهنمایی کنید.
تشکر.
در حال حاضر عنوان بهتر به ذهنم نرسید.
من از تابع زیر استفاده می کنم . با افزایش مقادیر R یا B یا G رنگ تصویر تغییر می کند. اما با کاهش این مقادیر رنگ تصویر به سمت حالت اولیه تغییر نمی کند. ممنون می شوم راهنمایی بفرمایید.
function SetColorValue(Bitmap: TBitmap; Red, Green, Blue: Integer): Boolean;
var
i, j: Integer;
rgbc: array[0..2] of Byte;
c: TColor;
r, g, b: Byte;
begin
if (Red = 0) and (Green = 0) and (Blue = 0) then
begin
Result := False;
Exit;
end;
for i := 0 to Bitmap.Height do
begin
for j := 0 to Bitmap.Width do
begin
c := Bitmap.Canvas.Pixels[j, i];
rgbc[0] := GetRValue(c);
rgbc[1] := GetGValue(c);
rgbc[2] := GetBValue(c);
if not (rgbc[0] + Red < 0) and not (rgbc[0] + Red > 255) then
rgbc[0] := rgbc[0] + Red;
if not (rgbc[1] + Green < 0) and not (rgbc[1] + Green > 255) then
rgbc[1] := rgbc[1] + Green;
if not (rgbc[2] + Blue < 0) and not (rgbc[2] + Blue > 255) then
rgbc[2] := rgbc[2] + Blue;
r := rgbc[0];
g := rgbc[1];
b := rgbc[2];
Bitmap.Canvas.Pixels[j, i] := RGB(r, g, b);
end;
end;
Result := True;
end;
همچنین لطفا اگر ممکنه در مورد تغییرات نور و کنتراست تصویر هم راهنمایی کنید.
تشکر.