1. Win32dib?
- Posted by doncole2009 Jul 03, 2009
- 914 views
- Last edited Jul 04, 2009
I am using Win32lib v0.70.3 and Win32Dib 0.5.1.
In the docs for Win32Dib it says:
Creating and deleting a bitmap A Win32Dib-bitmap is a sequence of length 7:
dib[DibHandle] is the bitmap handle (integer) you can use in Win32Lib-routines.
dib[DibMemory] is the address (atom) of the memory block of the bitmap.
dib[DibWidth] is the width of the bitmap in pixels.
dib[DibHeight] is the height of the bitmap in pixels.
dib[DibBytesPerLine] is the amount of bytes per line of the bitmap.
dib[DibBytesTotal] is the total amount of bytes of the bitmap.
dib[DibPadding] is the amount of bytes of padding after each scanline.
This is not true.
mydib = newDib(410 200)
dib=myDib[1]
dib is 1124402745 (an atom)
Don Cole
2. Re: Win32dib?
- Posted by DerekParnell (admin) Jul 03, 2009
- 945 views
- Last edited Jul 04, 2009
I don't know anything about Win32DIB, but handles should always be atoms. I think this is just a documentation error as the sequence element [DibHandle] will be an atom.
3. Re: Win32dib?
- Posted by doncole2009 Jul 03, 2009
- 931 views
- Last edited Jul 04, 2009
Thank you Derek,
Maybe if I said what I'm trying to do.
I want to repaint the window everytime I move the mouse.
But I don't want to repaint the whole window (#1) only a small portion of it.
I suppose this would require another window or bitmap or something.
I don't want any border on the second window.
I want it to look like all one window.
The second window will change size every time I move the mouse.
TIA.
Don Cole
4. Re: Win32dib?
- Posted by Dan_M Jul 06, 2009
- 950 views
Thank you Derek,
Maybe if I said what I'm trying to do.
I want to repaint the window everytime I move the mouse.
But I don't want to repaint the whole window (#1) only a small portion of it.
I suppose this would require another window or bitmap or something.
I don't want any border on the second window.
I want it to look like all one window.
The second window will change size every time I move the mouse.
TIA.
Don Cole
Is the following relevant? It's not involving TWO windows, just one window with only part repainted:
[proc]
repaintRect ( window, x1, y1, x2, y2 )
Force window to be partially repainted.
Category: Graphics
This sends repaints at the specified portion of the window with the background color, erasing that portion of it. It then triggers an Paint event for that window, passing the erased area as parameters.
Example:
repaint only a portion of MyWindow
repaintRect( myWindow, 1, 1, 10, 10 )
If that doesn't do what you want, then a child window, positoned and sized as you wish, with style { WS_CHILD } should work, I think.
dan
5. Re: Win32dib?
- Posted by Dan_M Jul 06, 2009
- 865 views
sorry, didn't read all related posts before I replied to this thread. But I wouldn't have replied if I'd seen your nevermind IN this thread. Just a suggestion.
dan
6. Re: Win32dib?
- Posted by mraley2 Jul 24, 2009
- 869 views
- Last edited Jul 25, 2009
I am using Win32lib v0.70.3 and Win32Dib 0.5.1.
In the docs for Win32Dib it says:
Creating and deleting a bitmap A Win32Dib-bitmap is a sequence of length 7:
dib[DibHandle] is the bitmap handle (integer) you can use in Win32Lib-routines.
dib[DibMemory] is the address (atom) of the memory block of the bitmap.
dib[DibWidth] is the width of the bitmap in pixels.
dib[DibHeight] is the height of the bitmap in pixels.
dib[DibBytesPerLine] is the amount of bytes per line of the bitmap.
dib[DibBytesTotal] is the total amount of bytes of the bitmap.
dib[DibPadding] is the amount of bytes of padding after each scanline.
This is not true.
mydib = newDib(410 200)
dib=myDib[1]
dib is 1124402745 (an atom)
Don Cole
functions like colorizeDib() drawDib() and saveDib() use the sequence mydib not just the handle in the first position. I guess it could be called a reference instance of a bitmap, not the bitmap.
This is what I used in Photuki2
scrndib =newDib(cc*8+1,cc*8+1) -- create a off screen control to hold completed image pixmap = subClassControl({Pixmap, 0}, scrndib[DibHandle]) -- fill the pixmap with background color setBackColor (pixmap, template_bgcolor )
7. Re: Win32dib?
- Posted by mraley2 Jul 24, 2009
- 834 views
- Last edited Jul 25, 2009
I just realized the intended distinction
vis. a vis value returned for dib handle is a full atom not an integer. Got it.
Not an issue unless you define an integer variable specifically for that peice of data, even though you already have that data in a sequence...
8. Re: Win32dib?
- Posted by doncole2009 Jul 24, 2009
- 843 views
- Last edited Jul 25, 2009
Here's the code I finally used in my CrossHairs. It's in the Archives
include win32dib.ew procedure re_instate(sequence dib,sequence oldPos) drawDib(WndMain,dib,oldPos[1], oldPos[2], 0, 0, dib[DibWidth], dib[DibHeight]) killDib(dib) end procedure procedure WndMain_onMouse (integer self, integer event, sequence params)--params is ( int event, int x, int y, int shift, int wheelmove ) sequence pos,c integer hPos,vPos,eLeft,eTop,eRight,eBot,eWidth,eHeight,diff,day atom price re_instate(hLineDib,oldHpos)------re-instate last horz line dib-------- re_instate(hRectDib,oldHRectPos)--re-instate last horz rect dib------- re_instate(vLineDib,oldVpos)------re_instate last vert line------ re_instate(vRectDib,oldVRectPos)--re-instate last vert rect------ ----------------------------------get temp constants------------------------------------ c=getClientRect(WndMain) pos = getPointerPos()--on the screen hPos=pos[1]-HPOS_OFFSET vPos=pos[2]-VPOS_OFFSET--vert position on CHART if vPos<CHART_TOP or vPos>CHART_BOT or hPos<CHART_LEFT or hPos>CHART_RIGHT then return end if eLeft=0 --window part left eTop=vPos-8--window part top eRight=c[5]--window part right eBot=vPos+8--window part bot eWidth=c[3]--window width eHeight=c[4]--window height diff=WIN_BOT-CHART_BOT oldHpos={eLeft,vPos}--HORZ_LINE oldVpos={hPos,CHART_TOP+1}--**--VERT LINE oldHRectPos={CHART_RIGHT,vPos-8}--***--HORZ RECT oldVRectPos={hPos-8,CHART_BOT}--*****--[VERT RECT]--MUST BE CHART_BOT -------------------------create dib------------------------------------------ hLineDib=newDib(eWidth,1) --****--HORZ LINE working hRectDib=newDib(eWidth,16) --***--HORZ RECT working vLineDib=newDib(1,eHeight) --VERT LINE working vRectDib=newDib(17,diff)--*****--[5] VERT RECT working at last ---------------------------------copy window portion to dib----------------------- copyToDib(hLineDib,WndMain,0,0,eLeft,vPos,eRight,vPos)--HORZ LINE working copyToDib(hRectDib,WndMain,0,0,CHART_RIGHT,vPos-8,eRight+10,vPos+8)--***--HORZ RECT working copyToDib(vRectDib,WndMain,0,0,hPos-8,CHART_BOT,hPos+8,eHeight)--*****--[5]--VERT RECT copyToDib(vLineDib,WndMain,0,0,hPos,CHART_TOP+1,hPos,eHeight)--****--VERT LINE --------------------------print the lines------------------------------- setPenColor(WndMain,White) drawHorzLine(WndMain,CHART_LEFT,CHART_RIGHT-1,vPos)------THE HORTZ LINE---- drawVertLine(WndMain,CHART_TOP+1,CHART_BOT,hPos)-- THE VERT LINE-- ------------------------print rectangles---------------------------- setPenColor(WndMain,White) -- drawRoundRect ( window, filled, x1, y1, x2, y2, xc, yc ) drawRoundRect(WndMain,1,CHART_RIGHT+3,vPos-8,CHART_RIGHT+40,vPos+8,5,5)--THE HORZ RECT *** drawRoundRect(WndMain,1,hPos-7,--left CHART_BOT,--top hPos+7,--right WIN_BOT,--bot 5,5)--THE VERT RECT *****[5] working RECT AT END OF VERT LINE -----------------------------print the text in rectangles------------------------------- setTextColor(WndMain,Black) price=getValue(vPos) day=getNum(hPos) mPutsTextHorzCent(WndMain,CHART_RIGHT+3,vPos,special(price))--print TEXT in horz rect mPutsTextVertCent(WndMain,hPos,CHART_BOT,sprintf("%d",day))--print TEXT in vert rect --draw_xy_pos(pos) end procedure setHandler( WndMain, w32HMouse, routine_id("WndMain_onMouse")) Don Cole