1. RE: Win32Dib: How To Question
Hi Tommy,
I just discovered the answer to this question while working on the
updated FreeImage wrapper. You can copyBlt(PixmapID,0,0,hDIB) to put
your dib into a Pixmap. Because hDIB will not be a valid Win32Lib
control, getDC will assume it is the handle of a bitmap and use
CreateCompatibleDC to allow the blit.
-- Brian
Derek Parnell wrote:
>
>
> posted by: Derek Parnell <ddparnell at bigpond.com>
>
> Tommy Carlier wrote:
> >
> >
> > Tommy Carlier wrote:
> > > Shouldn't it be in the Win32Lib, instead of Win32Dib? You can bitBlt to
> > > a bitmap
> > instead
> > > of a control, but you can't draw lines on a bitmap?
> > > I think Derek could easily implement this by checking if the destination
> > > is a control.
> > > If it's not a control, it must be a bitmap (like in bitBlt).
> > > Derek, if you don't want this to be in Win32Lib, I'll implement it in
> > > Win32Dib, but
> > > I'd rather not do it: the new procedures would need unique names, and
> > > the code inside
> > > those procedures probably look a lot like the Win32Lib drawing
> > > procedures.
> >
> > I just looked at the source code of Win32Lib and noticed that the
> > problem is not in
> > the individual drawing routines (they use getDC, which already checks
> > for bitmaps),
> > but in the createPen- and createBrush-routines, that search for colors
> > in the system-sequences
> > that take a control-integer as index.
> > Derek, is there a way of wrapping a bitmap-handle in a Win32Lib-control?
> >
>
> Hmmmm...let me think on this a bit. I'll let you know in a few days.
>
> --
> Derek Parnell
> Melbourne, Australia
2. RE: Win32Dib: How To Question
Brian Broker wrote:
> I just discovered the answer to this question while working on the
> updated FreeImage wrapper. You can copyBlt(PixmapID,0,0,hDIB) to put
> your dib into a Pixmap. Because hDIB will not be a valid Win32Lib
> control, getDC will assume it is the handle of a bitmap and use
> CreateCompatibleDC to allow the blit.
Yes, that is one of the solutions. Blitting from and to Pixmaps (or other
controls) is not the problem. The problem is that you have to create a Pixmap,
and that you can't draw to a bitmap directly. A nice solution would be if you
could wrap the bitmap in a Win32Lib-control, just like you can wrap a
Windows-created control using the subClassControl-function.
--
tommy online: http://users.pandora.be/tommycarlier