AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte Dimmed Sample
Thema durchsuchen
Ansicht
Themen-Optionen

Dimmed Sample

Ein Thema von EWeiss · begonnen am 27. Mär 2012 · letzter Beitrag vom 31. Mär 2012
Antwort Antwort
Gustav.R
(Gast)

n/a Beiträge
 
#1

AW: Dimmed Sample

  Alt 30. Mär 2012, 14:46
[OT]

Gerade in einem alten Projekt (Delphi 5) gefunden:

Delphi-Quellcode:
procedure TeilGrau(b: TBitmap; stufe: byte);
var
  sp1: byte;
  x, y: integer;
  p: PBytearray;
  g: byte;
  function rech(b: byte): byte;
  begin
    result := (b * stufe + g) div sp1;
  end;
begin
  sp1 := succ(stufe);
  for y := 0 to b.height - 1 do
  begin
    p := b.scanline[y];
    x := 0;
    while x < b3 do
    begin
      g := (p[x] + p[x + 1] + p[x + 2]) div 3;
      p[x] := rech(p[x]);
      p[x + 1] := rech(p[x + 1]);
      p[x + 2] := rech(p[x + 2]);
      inc(x, 3);
    end;
  end;
end;

procedure TFormCountDown.MakeDesktopGray(Zeit: Integer);
var
  x, y, z: integer;
  dwStyle: DWord;
  dc, ddc: HDC;
  hbm: HBitmap;
  bmp: TBitmap;
  // b3: integer;
  geschwindigkeit: integer;
begin
  geschwindigkeit := 200;
  dc := createDC('DISPLAY', nil, nil, nil);
  // --- Bildschirm in einer Bitmap sichern ---
  ddc := CreateCompatibleDC(dc);
  hbm := CreateCompatibleBitmap(dc, screen.width, screen.height);
  selectobject(ddc, hbm);
  BitBlt(ddc, 0, 0, screen.width, screen.height, dc, 0, 0, srcCopy);
  // -------------------------------------------
  bmp := TBitmap.create;
  bmp.pixelformat := pf24bit;
  bmp.width := screen.width;
  bmp.height := screen.height;
  b3 := screen.width * 3;
  BitBlt(bmp.canvas.handle, 0, 0, screen.width, screen.height, dc, 0, 0,
    srcCopy);
  z := 255 - geschwindigkeit;
  y := round(2.5 * z / sqrt(z));
  x := 1;
  while x < y do
  begin
    TeilGrau(bmp, z div x);
    BitBlt(dc, 0, 0, screen.width, screen.height, bmp.canvas.handle, 0, 0,
      srcCopy);
    application.processmessages;
    sleep(10);
    inc(x);
  end;
  // etwas den grauen Bildschirm stehen lassen
  sleep(2000);
  // Wiederherstellen des farbigen Desktops
  BitBlt(dc, 0, 0, screen.width, screen.height, ddc, 0, 0, srcCopy);
  // freigeben
  bmp.free;
  deleteobject(hbm);
  deletedc(ddc);
  deletedc(dc);
end;
K.A. wo ich das damals herhatte und ob's bei zwei Monitoren auch klappt

GG
[/OT]
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:37 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz