RE: Windows bitmaps...
- Posted by Brian Broker <bkb at cnw.com> Apr 04, 2002
- 401 views
Jesus, The code in your onOpen routine is run prior to creating and painting your window. So you are blitting at the wrong time. Try this: procedure start_up(integer x1, integer y1, integer x2, integer y2) -- same code as you have below end procedure -- now, instead of onOpen[MyWin] = routine_id( "start_up" ), do this: onPaint[MyWin] = routine_id( "start_up" ) -- Brian JesusC wrote: > Could any brave graphics soul tell me what I'm doing wrong?. > I'm trying just to draw a tiny bitmap onto the screen... > > ---8<----------------- > -- draw a bitmap in a window > include win32lib.ew > > constant > > MyWin = create(Window,"BitMap Testing", 0, > 10, 10, 300, 320, -- x, y, cx, cy > 0), > -- Pixmap, creates an offscreen pixmap > BaseBMP = create(Pixmap,"", 0, > 0, 0, 300, 320, > 0) > > -- load the bitmap > procedure start_up() > setPixmap (BaseBMP, loadBitmapFromFile( "bitmap.bmp" )) > > -- copy a 40x40 portion of source image to destination > bitBlt( MyWin, -- copy to MyWin > 0, 0, -- put at {0,0} in MyWin > BaseBMP, -- copy from BaseBMP > 0, 0, -- upper left hand corner is {0,0} > 40, 40, -- copy a 40x40 pixel portion > SrcCopy ) -- replace destination with image > > end procedure > > onOpen[MyWin] = routine_id( "start_up" ) > WinMain( MyWin, Normal ) > ---8<------------------------------- > Thanks, > Jesus. > >