Using GDI32.DLL within a canvas

BlitzPlus Forums/BlitzPlus Programming/Using GDI32.DLL within a canvas

terry(Posted 2003) [#1]
Hi all

I'm fairly new

Because I want to work within windows and also because I want maximum graphics capability I am investigating the use of GDI32.DLL

I can get it to work and so far have tested (within the confines of a canvas in a window) Polyline, Polygon, Pens, Brushes and Floodfill - and work progresses nicely.

I have a major problem though -

I can create a Device Context for my canvas and select pen and brush into it by:-

window=CreateWindow( etc )
canvas=CreateCanvas( ... ,window)
canvaswnd=QueryObject(canvas,2)
canvasDC=GetWindowDC(canvaswnd) ; ** from user32.dll
brush=CreateSolidBrush(ColorRef1)
pen=CreatePen(0,1,ColorRef2)
SelectObject(canvasDC,brush)
SelecrtObject(canvasDC,pen)

then e.g.

RoundRect%(canvasDC,50,300,350,350,20,10)

++++

So far so good

UNFORTUNATELY all the drawing is done directly to screen which is not what one wants at all - though it's good enough to help me explore each of the GDI32 routines

What I need to be able to do is to Create a memory Device Context (easy enough using CreateCompatibleDC(canvasDC) but
I have found no way to be able to select into this context a bitmap to receive the results of my drawing. Ideally I would like to select into the DC the bitmap component of my Canvas Buffer so that then the calls to the GDI32.DLL lib routines can mix in with my B+ drawing commands and all be followed by FlipCanvas(canvas)

Someone must have been here before but I have searched the archives and can find no mention of this issue anywhere

Ideas anyone?

Terry (from Tooting, London)