8Bit Image Filter lazarus / 39-Graphics ---------------------------------------------------------------------- Gigatron · 2025-05-23 15:12 Hi, Lazarus Pascal is perfect for developing utilities. A friend who develops games like 8bit asked me if you can (smooth  anti-aliasing ) lines without going through filters from drawing tools. I just created a program for him. Maybe this information will inspire other developers on the forum and demonstrate that in pascal you can program everything. I could easily code this in c#, java or javascript but with lazarus pascal I go very fast!! The images source from Cpc, C64, Msx , atari .. 8bits console or computer. Original image and filtered image result are attached; Regards Here the code for scale2x routine, the rest is source closed Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TForm1.GetPixelSafe(bmp: TBGRABitmap; x, y: integer): TBGRAPixel;begin  if (x >= 0) and (x < bmp.Width) and (y >= 0) and (y < bmp.Height) then    Result := bmp.GetPixel(x, y)  else    Result := BGRA(0, 0, 0, 0); // Transparent pixels hors limites !!!end; function TForm1.ColorsEqual(c1, c2: TBGRAPixel): boolean;begin  Result := (c1.red = c2.red) and (c1.green = c2.green) and (c1.blue = c2.blue);end; function TForm1.Scale2xFilter(source: TBGRABitmap): TBGRABitmap;var  x, y: integer;  A, B, C, D, E, F, G, H, I: TBGRAPixel;  E0, E1, E2, E3: TBGRAPixel;begin  Result := TBGRABitmap.Create(source.Width * 2, source.Height * 2);   for y := 0 to source.Height - 1 do    for x := 0 to source.Width - 1 do    begin      // recupe  9 pixels voisins  en x,y -1 +1 etc      A := GetPixelSafe(source, x-1, y-1);      B := GetPixelSafe(source, x, y-1);      C := GetPixelSafe(source, x+1, y-1);      D := GetPixelSafe(source, x-1, y);      E := GetPixelSafe(source, x, y);     // Pixel au milieu      F := GetPixelSafe(source, x+1, y);      G := GetPixelSafe(source, x-1, y+1);      H := GetPixelSafe(source, x, y+1);      I := GetPixelSafe(source, x+1, y+1);       // Algorithme Scale2x de m*rde !       if (ColorsEqual(D, B) and not ColorsEqual(D, H) and not ColorsEqual(B, F)) then        E0 := D      else        E0 := E;       if (ColorsEqual(B, F) and not ColorsEqual(B, D) and not ColorsEqual(F, H)) then        E1 := F      else        E1 := E;     if (ColorsEqual(D, H) and not ColorsEqual(D, B) and not ColorsEqual(H, F)) then        E2 := D      else        E2 := E;       if (ColorsEqual(H, F) and not ColorsEqual(H, D) and not ColorsEqual(F, B)) then        E3 := F      else        E3 := E;       // replace les 4 pixel      Result.SetPixel(x*2,   y*2, E0);      Result.SetPixel(x*2+1, y*2, E1);      Result.SetPixel(x*2,   y*2+1, E2);      Result.SetPixel(x*2+1, y*2+1, E3);    end;end;