BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

StretchDIBits and Win200/Win98

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
jf.jouvet
Guest





PostPosted: Fri Jul 04, 2003 3:46 pm    Post subject: StretchDIBits and Win200/Win98 Reply with quote



Hello
I have a problem with StretchDIBits with Win2000 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.biXPelsPerMeter := 0;
PimHeader.BmiHeader.biYPelsPerMeter := 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.


Back to top
jf.jouvet
Guest





PostPosted: Wed Jul 09, 2003 9:06 am    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote



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


Back to top
Joris
Guest





PostPosted: Wed Jul 09, 2003 9:20 am    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote



"Peter Haas" <newsgroupfeedback (AT) pjh2 (DOT) de> wrote

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





Back to top
Peter Haas
Guest





PostPosted: Wed Jul 09, 2003 11:40 am    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote

Hi Joris,

Joris wrote in <3f0bdebe (AT) newsgroups (DOT) borland.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$1 (AT) talkto (DOT) net> to me
regarding JEDI's disinterest on my contribution attempts.
Maybe JEDI users have more interest: http://jediplus.pjh2.de/index.php

Back to top
Peter Haas
Guest





PostPosted: Wed Jul 09, 2003 11:40 am    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote

Hi,

jf.jouvet wrote in <3F0BDB1C.697275EF (AT) opales (DOT) fr>:
Quote:
I tried VirtualAlloc, but I got new errors with some "move" instructions
later

I thinks this is a other problem. Note, that Move want the contents, not
a pointer, if you use a pointer, you must use a trailing ^.

Quote:
I am not clever enough to well anderstand the discussions in referenced links
Perhaps with new release/version of delphi?

I don't think, that the memory allocation model will be changed.

Bye Peter.
--
Why should we be interested is someone who considers us a waste basket?
Robert Marquardt (Team JEDI) in <b4mf4g$u0k$1 (AT) talkto (DOT) net> to me
regarding JEDI's disinterest on my contribution attempts.
Maybe JEDI users have more interest: http://jediplus.pjh2.de/index.php

Back to top
Peter Haas
Guest





PostPosted: Wed Jul 09, 2003 1:58 pm    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote

Hi Joris,

Joris wrote in <3f0c05cb (AT) newsgroups (DOT) borland.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
http://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$1 (AT) talkto (DOT) net> to me
regarding JEDI's disinterest on my contribution attempts.
Maybe JEDI users have more interest: http://jediplus.pjh2.de/index.php

Back to top
Joris
Guest





PostPosted: Wed Jul 09, 2003 11:51 pm    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote

"Peter Haas" <newsgroupfeedback (AT) pjh2 (DOT) de> wrote

Quote:
http://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




Back to top
jf.jouvet
Guest





PostPosted: Tue Jul 15, 2003 4:25 pm    Post subject: Re: StretchDIBits and Win200/Win98 Reply with quote

Thanks for all
I solved my problem with FastShareMem



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.