SRL Archive - Help and Support

Problems with GetDIBits


R0b0t1

2007-12-02 21:24:15

Well, its just returning zero for everything.

(Don't forget to install plugin below; and actually, the problems are in the plugin…)


program New;
{$Def UsingRGB}
var
{$IfDef UsingRGB}
ColorArray: T2DRGBQuadArray;
{$Else}
ColorArray: T2DIntArray;
{$EndIf}
X, Y, I: Integer;

begin
{$IfDef UsingRGB}
DumpPixelsRGB(ColorArray, GetClientCanvas.handle, 0, 0, 10, 10);
SetArrayLength(ColorArray, 10);
for I:= 0 to 9 do //We need to set the length of the arrays
SetArrayLength(ColorArray[I], 10);
for X:= 0 to 9 do //If you happen to know the size before hand.
for Y:= 0 to 9 do //X loop is first, then Y.
begin
WriteLn('ColorArray['+IntToStr(X)+']['+IntToStr(Y)+'].rgbRed:= '+
IntToStr(ColorArray[X][Y].rgbRed));
WriteLn('ColorArray['+IntToStr(X)+']['+IntToStr(Y)+'].rgbGreen:= '+
IntToStr(ColorArray[X][Y].rgbGreen));
WriteLn('ColorArray['+IntToStr(X)+']['+IntToStr(Y)+'].rgbBlue:= '+
IntToStr(ColorArray[X][Y].rgbBlue));
WriteLn('ColorArray['+IntToStr(X)+']['+IntToStr(Y)+'].rgbReserved:= '+
IntToStr(ColorArray[X][Y].rgbReserved));
end;
{$Else}
DumpPixels(ColorArray, GetClientCanvas.handle, 0, 0, 10, 10);
SetArrayLength(ColorArray, 10);
for I:= 0 to 9 do //We need to set the length of the arrays
SetArrayLength(ColorArray[I], 10);
for X:= 0 to 9 do //If you happen to know the size before hand.
for Y:= 0 to 9 do //X loop is first, then Y.
begin
WriteLn('ColorArray['+IntToStr(X)+']['+IntToStr(Y)+']:= '+
IntToStr(ColorArray[X][Y]));
{$EndIf}
end.

mastaraymond

2007-12-03 04:20:43

From: R0b0t1
Well, its just returning zero for everything.

(Don't forget to install plugin below; and actually, the problems are in the plugin…)

Thats my error to when i was using GetDiBits.. Its only returning zero's.. Be sure you put in a canvas + bitmap that actually HOLD something.. If you put in emtpy canvesses\bitmaps..

Oh ofcourse.. Dude.. GetDiBits won't work on the ClientCanvas only.. GetDiBits dumps the Bitmaps of a Bitmap.. You need to enter 2 value's. Bitmap.Handle (HBitmap) and Bitmap.Canvas.Handle (HDC).. Thats the only way it will work, if im right..

Santa_Clause

2007-12-03 05:16:41

I have no idea what you two nerds are talking about.

mastaraymond

2007-12-03 06:32:40

From: Santa_Clause
I have no idea what you two nerds are talking about.

Spam! *cough * API Calls *cough*

Google it.

The Claw

2007-12-03 08:18:26

From: Santa_Clause
I have no idea what you two nerds are talking about.


D:<


R0b0t1

2007-12-03 17:09:22

Oh. Oh…


Let me get this. HBitmap is not like a C++ version, but a BitmapHandle?


Thats why its type is 0..8000something!

Town

2007-12-03 17:15:54

Hey! I just learned something! :)

mastaraymond

2007-12-03 17:18:37

From: Town
Hey! I just learned something! :)


Oh oh.. Take cover ^^

R0b0t1

2007-12-03 17:25:24


Oh. Oh…


Let me get this. HBitmap is not like a C++ version, but a BitmapHandle?


Thats why its type is 0..8000something!


Is me right?

mastaraymond

2007-12-03 17:36:16

From: R0b0t1
Is me right?


HBitmap

Handle Bitmap


Yeah it does.. Types are declared by a Objects\Records are mostly called "T" + something..
"TBitmap" Type Bitmap or Object Bitmap

Pointer type's got a P in front of it..
PBitmap, Pointer Bitmap..

R0b0t1

2007-12-03 20:29:46

I'd guessed the naming conventions, but thanks.


Wuahahahaha! This code was SantyProof! Just like n3ss3s said his was!

Crap. That made me think about the game.




EDIT: I'm still having problems… It's strange…

mastaraymond

2007-12-04 09:40:58

From: R0b0t1
I'd guessed the naming conventions, but thanks.


Wuahahahaha! This code was SantyProof! Just like n3ss3s said his was!

Crap. That made me think about the game.




EDIT: I'm still having problems… It's strange…

I never got GetDiBits to work either..

You could do, a BitBlt to copy a canvas on a empty TBitmap. Then dump the pixels..

Bobarkinator

2007-12-04 14:18:39

From: R0b0t1
I'd guessed the naming conventions, but thanks.


Wuahahahaha! This code was SantyProof! Just like n3ss3s said his was!

Crap. That made me think about the game.




EDIT: I'm still having problems… It's strange…


Ugh, you just made me lose. :(

R0b0t1

2007-12-04 16:47:47

I'm trying to make a version in pure C++, but the real reason I wanted to post is because I loose.