Einzelnen Beitrag anzeigen

Benutzerbild von Spiderpig_GER_15
Spiderpig_GER_15

Registriert seit: 17. Mär 2008
298 Beiträge
 
Delphi 7 Personal
 
#1

zu Laufzeit erstellter 2D Array mach Unsinn...

  Alt 2. Jul 2009, 18:13
Hi Delphiler,

Mein zur Laufzeit mit lenght() bestimmter 2D Array:
  AssortmentAlphaMap: array of array of boolean; macht nicht nachvollziehbaren Murks:
mit folgender Routine möchte ich bei dem Array, der die gleichen Maße hat wie das Bild, überall dort, wo ein blaues Pixel ist den Wert auf "true" setzten.
Das funktioniert wunderbar:
Delphi-Quellcode:
  for I := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
  begin
    for u := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
    begin
      if bmp.Canvas.Pixels[u,i] = clblue then
        AssortmentAlphaMap[u,i]:= true;
    end;
  end;
jetzt will ich jedoch auf Nummer sichergehen und alle die nicht blau sind auf "false" setzten:
Delphi-Quellcode:
  for I := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
  begin
    for u := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
    begin
      if bmp.Canvas.Pixels[u,i] = clblue then
        AssortmentAlphaMap[u,i]:= true;
      If bmp.Canvas.Pixels[u,i] <> clblue then
        AssortmentAlphaMap[u,i]:= false;
    end;
  end;
bzw:
Delphi-Quellcode:
  for I := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
  begin
    for u := low(AssortmentAlphaMap) to high(AssortmentAlphaMap) do
    begin
      if bmp.Canvas.Pixels[u,i] = clblue then
        AssortmentAlphaMap[u,i]:= true
      else
        AssortmentAlphaMap[u,i]:= false;
    end;
  end;
jetzt stürzt aber das Programm ab (AccesViolation) Hallo???

Kann mir jemand erklären warum das so ist?

Wäre seeehr dankbar,

MfG Spiderpig
---Zufall ist das Inkognito Gottes---
  Mit Zitat antworten Zitat