Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   Покрытие image в Делфи (https://forum.antichat.xyz/showthread.php?t=180990)

SultanOFF 22.02.2010 15:54

Покрытие image в Делфи
 
Здравствуйте. Пытаюсь покрыть image сеткой, делаю это так
Код:

procedure TForm4.DrawVisor(_B_in: TBitmap; rect: trect);
const
  MaxPixelCountA = MaxInt div SizeOf(TRGBQuad);
type
  PRGBAArray = ^TRGBAArray;
  TRGBAArray = array[0..MaxPixelCountA-1] of TRGBQuad;
var i,ii,ix,iy,CenterPointY,CenterPointX:integer;
    RowOut: PRGBAArray;
begin
_B_in.Canvas.Pen.Width:=1;
_B_in.Canvas.Pen.Color:=rgb(0,20,0);
CenterPointX:=rect.Left+((rect.Right-rect.Left) div 2);
CenterPointY:=rect.Top+((rect.Bottom-rect.Top) div 2);
ix:=CenterPointX-(CenterPointX div 24)*24;
iy:=CenterPointY-(CenterPointY div 24)*24;
for i:=rect.Top to rect.Bottom-1 do  begin
  RowOut:=_B_in.ScanLine[i];
  for ii:=rect.Left to rect.Right-1 do begin
  if ((ii=(ii div 24)*24+ix))or((i=(i div 24)*24+iy)) then begin
    RowOut[ii].rgbBlue:=trunc(RowOut[ii].rgbBlue*0.8);
    RowOut[ii].rgbGreen:=trunc(RowOut[ii].rgbGreen*0.8);
    RowOut[ii].rgbRed:=trunc(RowOut[ii].rgbRed*0.8);
  end;
  end;
end;
end;

Однако вылетает страшная ошибка. Причем в Вин7 ошибки не наблюдается, а в ХП присутсвует. Кто может подсказать из за чего это? Или может предложите свой способ покрытия image чем нибудь наподобии сетик?

RDL_Rider 23.02.2010 01:54

Код:

var i,j, GridSize: Integer;

for i := 0 to Image.Width
if i mod GridSize = 0 then
for j := 0 to Image.Height
if j mod GridSize = 0 then
Image.Canvas.Rectangle(i,j,i+GridSize-1,j+GridSize-1);

Чёт типа того. GridSize - размер стороны квадратной клетки.

SultanOFF 23.02.2010 15:57

проблему решил, ошибка заключалась в том что для этой процедуры был необходим битмап 32бит а у Меня был 24бита.


Время: 19:09