AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Dynamisches Array Grenze?

Ein Thema von EWeiss · begonnen am 28. Mär 2012 · letzter Beitrag vom 29. Mär 2012
Antwort Antwort
brechi

Registriert seit: 30. Jan 2004
823 Beiträge
 
#1

AW: Dynamisches Array Grenze?

  Alt 28. Mär 2012, 21:37
Delphi-Quellcode:
var
  tempBitmap: BITMAPINFO;
  pvBits: Pointer;
  mDC: THandle;
  mainBitmap: Thandle;
  x, y: integer;
  q: ^TRGBTriple;
  idx: integer;
begin
  ZeroMemory(@tempBitmap, sizeof(BITMAPINFO));
  tempBitmap.bmiHeader.biSize := SizeOf(BITMAPINFOHEADER);
  tempBitmap.bmiHeader.biBitCount := 24;
  tempBitmap.bmiHeader.biWidth := 1920;
  tempBitmap.bmiHeader.biHeight := 1080;
  tempBitmap.bmiHeader.biPlanes := 1;
  tempBitmap.bmiHeader.biCompression := BI_RGB;
  tempBitmap.bmiHeader.biSizeImage := tempBitmap.bmiHeader.biWidth * tempBitmap.bmiHeader.biHeight * 3;
  mDC := CreateCompatibleDC(0);
  mainBitmap := CreateDIBSection(mDC, tempBitmap, DIB_RGB_COLORS, pvBits, 0, 0);
  SelectObject(mDC, mainBitmap);
  FillChar(pvBits^, tempBitmap.bmiHeader.biWidth * tempBitmap.bmiHeader.biHeight * 3, 255);
  for y := 0 to tempBitmap.bmiHeader.biHeight - 1 do begin
    for x := 0 to tempBitmap.bmiHeader.biWidth - 1 do begin
      idx := y * tempBitmap.bmiHeader.biWidth + x;
      q := Pointer(Integer(pvBits) + idx * 3);
      q.rgbtBlue := Round(x * 255 / tempBitmap.bmiHeader.biWidth);
      q.rgbtRed := Round(y * 255 / tempBitmap.bmiHeader.biHeight);
      q.rgbtGreen := 55;
    end;
  end;
  BitBlt(canvas.Handle, 0, 0, tempBitmap.bmiHeader.biWidth, tempBitmap.bmiHeader.biHeight, mDC, 0, 0, SRCCOPY);
hab mir den aufräum Code jetzt mal gespart

-> du setzt bei dir die Bildgroesse nicht: bmInfo.bmiHeader.biBitCount := tempBitmap.bmiHeader.biWidth * tempBitmap.bmiHeader.biHeight * tempBitmap.bmiHeader.biBitCount div 8
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#2

AW: Dynamisches Array Grenze?

  Alt 28. Mär 2012, 21:48
Nu was ist bei dir anders als bei mir?
Im Pointer(Pixels) ist das array welches von CreateDIBSection zurück geliefert wird.
Das ist ja das schöne daran das ich mir so das suchen der pixels mit GetPixel sparen kann.
Was soll ich nun machen das mir die richtige Anzahl abhängig vom Bild (Bilddimension) zurückgegeben wird?


gruss
  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 04:11 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