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
EWeiss
(Gast)

n/a Beiträge
 
#1

AW: Dynamisches Array Grenze?

  Alt 28. Mär 2012, 21:09
Das Problem wird da eher vorm Bildschirm sitzen
Ach ja?
Dann sag mir doch mal bitte welchen Einfluss ich auf CreateDIBSection nehmen kann
wenn ich nur 131071 Pixel zurück geiefert bekomme?

Bekomme ich mehr gebe ich dir recht .. andernfalls na ja du weist schon

Code? OK!

Delphi-Quellcode:
begin

  hRetBmp := 0;

   if hBmp <> 0 then
   begin
      hBufferDC := CreateCompatibleDC(0);
      if hBufferDC <> 0 then
      begin
      hTmpBitmap := 0;
         if hBmpDC <> 0 then
            if (hBmp = GetCurrentObject(hBmpDC, OBJ_BITMAP)) then
            begin
               hTmpBitmap := CreateBitmap(1, 1, 1, 1, nil);
               SelectObject(hBmpDC, hTmpBitmap);
            end;

         hPrevBufObject := SelectObject(hBufferDC, hBmp);

         hDirectDC := CreateCompatibleDC(0);
         if hDirectDC <> 0 then
         begin
            GetObject(hBmp, sizeof(bm), @bm);

           ZeroMemory(@bmInfo, sizeof(BITMAPINFO));
            bmInfo.bmiHeader.biSize       := sizeof(bmInfo.bmiHeader);
            bmInfo.bmiHeader.biWidth    := bm.bmWidth;
            bmInfo.bmiHeader.biHeight    := bm.bmHeight;
            bmInfo.bmiHeader.biPlanes    := 1;
            bmInfo.bmiHeader.biBitCount   := 32;

            hDirectBitmap := CreateDIBSection(hDirectDC, bmInfo, DIB_RGB_COLORS, Pointer(Pixels), 0, 0);
            if hDirectBitmap <> 0 then

gruss

Geändert von EWeiss (28. Mär 2012 um 21:12 Uhr)
  Mit Zitat antworten Zitat
brechi

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

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
 
#3

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 20:16 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz