![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Image. (Rotate) [D6]
Artur © (2003-11-15 18:33:00)Здравствуйте мастаки, подскажите пожалуйста как осуществить переворот просматриваемой картинки (Rotate) в Image. Может кто процедуру знает ?
Спасибо.
Fenik (2003-11-22 11:48:00) [1]Да.
Artur (2003-11-18 12:36:00) [2]А можно рабатать только с bmp форматом?
Fenik (2003-11-16 12:04:00) [3]procedure RotateBitmap(Bitmap: TBitmap; Angle: Integer; BackColor: TColor);
Точнее так
procedure RotateBitmap(Bitmap: TBitmap; Angle: Integer);
То было от старой процедуры.
Fenik (2003-11-16 11:05:00) [4]
procedureRotateBitmap(Bitmap: TBitmap; Angle: Integer; BackColor: TColor);
typeTRGB = record
B, G, R: Byte;
end;
pRGB = ^TRGB;
pByteArray = ^TByteArray;
TByteArray = array[0..32767] ofByte;
varx, y, W, H, v1, v2: Integer;
Dest, Src: pRGB;
VertArray: array ofpByteArray;
Bmp: TBitmap;
begin
Bitmap.PixelFormat := pf24Bit;
Bmp := TBitmap.Create;
try
Bmp.Assign(Bitmap);
W := Bitmap.Width - 1;
H := Bitmap.Height - 1;
caseAngle of
90, 270: begin
Bitmap.Width := H + 1;
Bitmap.Height := W + 1;
SetLength(VertArray, H + 1);
v1 := 0;
v2 := 0;
ifAngle = 90.0 thenv1 := H
elsev2 := W;
fory := 0 toH doVertArray[y] := Bmp.ScanLine[Abs(v1 - y)];
forx := 0 toW do begin
Dest := Bitmap.ScanLine[x];
fory := 0 toH do begin
v1 := Abs(v2 - x)*3;
withDest^ do begin
B := VertArray[y, v1];
G := VertArray[y, v1+1];
R := VertArray[y, v1+2];
end;
Inc(Dest);
end;
end
end;
180: begin
fory := 0 toH do begin
Dest := Bitmap.ScanLine[y];
Src := Bmp.ScanLine[H - y];
Inc(Src, W);
forx := 0 toW do begin
Dest^ := Src^;
Dec(Src);
Inc(Dest);
end;
end;
end;
end;
finally
Bmp.Free;
end;
end;
MBo (2003-11-16 10:53:00) [5]90: NewPixel[i,j]:=oldpixel[j,i]
180: NewPixel[i,j]:=oldpixel[width-i,height-j]
Artur (2003-11-16 08:48:00) [6]На повророт 90; 180;
miek (2003-11-15 21:03:00) [7]В KOL есть процедуры для поворота на 90 градусов
MBo (2003-11-15 18:38:00) [8]На какой угол?
Если именно переворот - TCanvas.StretchDraw или StretchBlt c отрицательной высотой