Board index » delphi » StretchDIBits and Win200/Win98

StretchDIBits and Win200/Win98


2003-07-04 11:46:46 PM
delphi98
Hello
I have a problem with StretchDIBits with Windows 2000 but not with Win98
Principe:
I have 4 Tables, each filled with a constant value
When I try to display one with StretchDIBits, appearance is good when
size of Table is small (100*100) but the display is not refresh when
size is bigger(1000*1000) on win2000, but it is ok on win98.
Does any one know why? How to do?
Thanks for any help
Here is the code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
type tVector = array of Byte;
type tImage = array of tVector;
var Image: tImage;
NbImage, WidthImage, HeightImage, Num: dWord;
PimHeader: tBitMapInfo;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i, j: LongInt;
begin
// Fill Each Image with a constant byte
for i:=0 to NbImage-1 do
for j:=0 to WidthImage*HeightImage-1 do
Image[i,j]:=i*64;
PimHeader.BmiHeader.biSize := sizeof(tBITMAPINFOHEADER);
PimHeader.BmiHeader.biWidth := WidthImage;
PimHeader.BmiHeader.biHeight := HeightImage;
PimHeader.BmiHeader.biPlanes := 1;
PimHeader.BmiHeader.biBitCount := 8;
PimHeader.BmiHeader.biCompression := 0;
PimHeader.BmiHeader.biSizeImage := (HeightImage*WidthImage);
PimHeader.BmiHeader.biXPel{*word*237}eter := 0;
PimHeader.BmiHeader.biYPel{*word*237}eter := 0;
PimHeader.BmiHeader.biClrUsed := 0;
PimHeader.BmiHeader.biClrImportant := 0;
{$r-}
for i := 0 to 255 do begin
PimHeader.BmiColors[i].rgbBlue :=i;
PimHeader.BmiColors[i].rgbGreen:=i;
PimHeader.BmiColors[i].rgbRed :=i;
PimHeader.BmiColors[i].rgbReserved:=0;
end;
{$r+}
Num:=0;
end;
procedure TForm1.Button1Click(Sender: TObject);
var hdc_local: hdc;
begin
Num := (Num+1) mod NbImage;
Form1.Button1.Caption:=IntToStr(Num);
hdc_local := GetDc(Form1.Handle);
StretchDIBits( hdc_local,
0, 0, Form1.Width, Form1.Height,
0, 0, WidthImage, HeightImage,
Image[Num],
PimHeader,
DIB_RGB_COLORS,
SRCCOPY);
ReleaseDC(Form1.Handle, hdc_local);
GdiFlush;
Application.ProcessMessages;
end;
Initialization
NbImage := 4;
// OK
WidthImage := 100;
HeightImage := 100;
// FAIL
WidthImage := 1000;
HeightImage := 1000;
//
SetLength(Image, NbImage, WidthImage*HeightImage);
Finalization
SetLength(Image, 0);
end.
 
 

Re:StretchDIBits and Win200/Win98

I tried VirtualAlloc, but I got new errors with some "move" instructions
later
I am not clever enough to well anderstand the discussions in referenced links
Perhaps with new release/version of delphi?
Thanks in any way
 

Re:StretchDIBits and Win200/Win98

"Peter Haas" <XXXX@XXXXX.COM>writes
Quote
there are known problems with the allocation
method of Delphi's Memory Manager and GDI functions under WinNT and
later.
Care to elaborate?
Joris
 

Re:StretchDIBits and Win200/Win98

Hi Joris,
Joris wrote in <XXXX@XXXXX.COM>:
Quote
>there are known problems with the allocation
>method of Delphi's Memory Manager and GDI functions under WinNT and
>later.

Care to elaborate?
Currently, I have very few free time, please follow the both links in my
first posting, there the problem is elaborate. If you have furthermore
questions, please ask here, but I don't can answer before monday.
Bye Peter.
--
Why should we be interested is someone who considers us a waste basket?
Robert Marquardt (Team JEDI) in <b4mf4g$u0k$XXXX@XXXXX.COM>to me
regarding JEDI's disinterest on my contribution attempts.
Maybe JEDI users have more interest: jediplus.pjh2.de/index.php
 

Re:StretchDIBits and Win200/Win98

Hi Joris,
Joris wrote in <XXXX@XXXXX.COM>:
Quote
That's why I thought 'AH' when I saw a link to a project of yours that
claims to reproduce the problem... but then I discovered the link is
dead.
I have move my homepage, the new link is
delphi.pjh2.de/demos/download/SetDIBitsToDeviceBug.zip
Bye Peter.
--
Why should we be interested is someone who considers us a waste basket?
Robert Marquardt (Team JEDI) in <b4mf4g$u0k$XXXX@XXXXX.COM>to me
regarding JEDI's disinterest on my contribution attempts.
Maybe JEDI users have more interest: jediplus.pjh2.de/index.php
 

Re:StretchDIBits and Win200/Win98

"Peter Haas" <XXXX@XXXXX.COM>writes
Quote
delphi.pjh2.de/demos/download/SetDIBitsToDeviceBug.zip
Interesting, to say the least. Has anyone ever nailed down the problem in
this one? Did you report this to Borland, together with this source? What
did they have to say?
Joris
 

Re:StretchDIBits and Win200/Win98

Thanks for all
I solved my problem with FastShareMem