Using DIB with Builder Controls

Using DIB with Builder Controls

Post by B. Herre » Tue, 11 Jan 2000 04:00:00



(Note, this was inadvertently posted in borland.public.cppbuilder.language
and is not a cross-post).

We are attempting to use a combination of Builder controls and standard
Windows calls to display Device Independent Bitmaps (DIB).  If you
are familiar with Ghostscript(a screen RIP for Postscript), this is to
allow us to access a DIB created by the Ghostscript DLL and display it in a
Builder window.

We create a paintbox and grab the the device context from Handle:

        HDC hdc = PaintBox1->Canvas->Handle.

The DLL is called to create the DIB and then a call is made to draw the
bitmap to the paintbox.  The call to the DLL confirms that it is a valid
device context, but the call to the windows routine SetDIBitsToDevice fails
and does not draw to the PaintBox1.  BTW, we don't seem to have any
problems with VC++

I gather I am missing the obvious here, and the Borland Documentation
isn't too great here, either....

BTW, we are still using Builder 1.0 which may be part of our problem..

Thanks for any help....
Brant Herrett

 
 
 

Using DIB with Builder Controls

Post by Damon Chandle » Wed, 12 Jan 2000 04:00:00


Hi Brant,

Quote:> We create a paintbox and grab the the device context from Handle:

>         HDC hdc = PaintBox1->Canvas->Handle.

> The DLL is called to create the DIB and then a call is made to draw the
> bitmap to the paintbox.  The call to the DLL confirms that it is a valid
> device context, but the call to the windows routine SetDIBitsToDevice fails
> and does not draw to the PaintBox1.  BTW, we don't seem to have any
> problems with VC++

Is the DLL returning a HDIB (i.e., a handle to a LPBITMAPINFO)?  Have
you tried using the StretchDIBits() function instead?  Since the
TPaintBox control simply uses the device context of its Parent control,
it is odd that the code fails for Builder, but works for VC++.  You may
also consider using a TImage control and the SetDIBits() function.

Good luck!

--
Damon Chandler
http://bcbcaq.freeservers.com

 
 
 

1. Draw DIB to picture control?

Hi,
I have a problem drawing a bitmap and would be very thankful if someone had
an idea what I'm doing wrong.

hDIB points to a DIB (I know widht and height, even the palette, if any)
Now I would like to draw this bitmap on a picture control (the standard one
shipped with VB)

I guess I have to start with something like
hDC = CreateCompatibleDC(Picture1.hDC)     "GDI call, I have defined all
relevant GDI functions

Then call BitBlt? All I tried did not work.
It works when I use the form itself (Me.hwnd), but it does not work with
Picture1.hdc.

Kind regards,
Andreas

2. opengl performance - polys per second

3. GIF Animator control with C++ Builder 3

4. Anyone heard of VIFF?

5. OpenGL in a Builder control

6. "Hello World" for OpenGL

7. Rendering a Scene to BMP/DIB using DirectX 6.1

8. TDXWaveList at runtime

9. Using a DIB handle

10. How to display larger image using DIB?

11. ASM Code to copy DIB to DIB, 16Bit

12. Translating a Windows DIB to an OpenGL DIB

13. Get DIB Info from a Clipboard DIB