Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / How use DIB API

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. How use DIB API
#4272
Posted by: dgnoyon 2004-05-28 18:47:28
Hi,
it's me again :)

I would like know how use DIB API (GetDibits; SetDIBitsToDevice; CreateDIBSection; ...)
my problem is because we have declaration of function with ANY

if someone can give me an example
Thank you
Message2. Re: How use DIB API
#4273
Posted by: erdemaal 2004-05-28 19:39:00
All Api Arguments are 4 byte long. It can be anything that hold in 4 bytes.
In your case its a pointer to a memory space : the address of the first byte of that memory space usually.

In your case :
Dim bBytes (anylenght) As Byte
lpvBits = VarPtr (bBytes(1))
... get Bitmap length
Redim bBytes ...

... probably ? :)

Not tested !

Jacques

Message3. Re: How use DIB API
#4274
Posted by: dgnoyon 2004-05-28 20:29:47
thank you, i will test to apply this in example
Message4. Re: How use DIB API
#4276
Posted by: dgnoyon 2004-05-29 01:39:03
arf.... sorry but i don't find solution to use this

Could you give me an example, please
Message5. Re: How use DIB API
#4291
Posted by: erdemaal 2004-05-30 18:52:10
I have no API example for this ... I use that kind of pointer to an array of bytes in RQASM

The Array is :
DefByte myArray (0 To 160)

Then the array is 'passed' with VarPtr(myArray(0))

In previous example VarPtr (MyArray(1)) was used rather than VarPtr(myArray(0)), it could be the error ?

I dont know much about BMP APIs ! Cant help you on that.

Jacques
Message6. Re: How use DIB API
#4339
Posted by: JohnK 2004-06-04 01:55:00
There is a real problem finding the address of the bitmap -- here is an example:

DIM MyBmp AS QBITMAP
MyBmp.Width = 100
MyBmp.Height = 100
MyBmp.FillRect(0,0,100,100,255)    'fill with red
ShowMessage str$(sizeof(MyBmp)) 'won't work
DummyPtr = VARPTR(MyBmp.Pixel(0,0)) 'won't work

MyBmp.Pixel(0,0) should be a pointer but returns the color, which is 255, not an address. I think you need this address for the LPVOID arg in GetDIBits if you want QBITMAP properties to work. Otherwise you have to manually make an array and then copy them pixel by pixel to a QBITMAP. I think a lot of what you need to do will require a lot of work arounds.
JohnK

I'm basic too
Message7. Re: How use DIB API
#4341
Posted by: dgnoyon 2004-06-04 02:02:59
Hi
thank you for your answers
in fact, i would like use
- CreateDIBSection
- SetDIBitstoDevice
- GetDIBits

With this, we can modify quickly an image because we work directly in memory
Message8. Re: How use DIB API
#4459
Posted by: JohnK 2004-06-15 03:18:21
The C structure is
typedef struct tagBITMAPINFO { // bmi
   BITMAPINFOHEADER bmiHeader;
   RGBQUAD          bmiColors[1];
} BITMAPINFO;


You would like this to work:
Type BITMAPINFO
        bmiHeader As BITMAPINFOHEADER
        bmiColors As RGBQUAD
End Type

BUT You CAN'T put BITMAPINFOHEADER inside of BITMAPINFO! Here is the Fix

make separate UDTs
Type BITMAPINFOHEADER '40 bytes
        biSize As Long
        biWidth As Long
        biHeight As Long
        biPlanes As Integer
        biBitCount As Integer
        biCompression As Long
        biSizeImage As Long
        biXPelsPerMeter As Long
        biYPelsPerMeter As Long
        biClrUsed As Long
        biClrImportant As Long
End Type

Type RGBQUAD
        rgbBlue As Byte
        rgbGreen As Byte
        rgbRed As Byte
        rgbReserved As Byte
End Type


TYPE BITMAPINFO
        biSize As Long
        biWidth As Long
        biHeight As Long
        biPlanes As Integer
        biBitCount As Integer
        biCompression As Long
        biSizeImage As Long
        biXPelsPerMeter As Long
        biYPelsPerMeter As Long
        biClrUsed As Long
        biClrImportant As Long
        rgbBlue As Byte
        rgbGreen As Byte
        rgbRed As Byte
        rgbReserved As Byte
END TYPE

instead of coding

BITMAPINFO.BITMAPINFOHEADER.biWidth

You write
BITMAPINFO.biWidth


So it is a little confusing. I think that
- CreateDIBSection
- SetDIBitstoDevice
- GetDIBits
can be implemented in RapidQ without the API anyway!!! Read up on QIMAGE
I'm basic too
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0