1. createDIB() in Win32Lib needs a doctor!

------=_NextPart_000_0010_01BED45C.7E6858C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

createDIB() doesn't work.  Try this example, and I bet you won't get a =
box with upper 1/2 blue and lower 1/2 red.  You'll probably get a red =
blob with blue lines...but try it out, or if I'm doing this wrong, =
please let me know.

--EXAMPLE
without warning
include win32lib.ew

constant win=3Dcreate(Window,"Test Window",0,50,50,300,200,0),
img=3D{ {1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2} },
pal=3D{{0,0,255},{255,0,0}},
BMP=3DcreateDIB(img,pal)

procedure onPaint_win(integer x,integer y,integer x2,integer y2)
drawBitmap(win,BMP,5,5)
end procedure
onPaint[win]=3Droutine_id("onPaint_win")

WinMain(win)
--END EXAMPLE


Mike Hurley

------=_NextPart_000_0010_01BED45C.7E6858C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>createDIB() doesn't work.&nbsp; Try =
this=20
example, and I bet you won't get a box with upper 1/2 blue and lower 1/2 =

red.&nbsp; You'll probably get a red blob with blue lines...but try it =
out, or=20
if I'm doing this wrong, please let me know.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>--EXAMPLE</FONT></DIV>
<DIV><FONT size=3D2>without warning</FONT></DIV>
<DIV><FONT size=3D2>include win32lib.ew</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>constant win=3Dcreate(Window,&quot;Test=20
Window&quot;,0,50,50,300,200,0),</FONT></DIV>
<DIV><FONT size=3D2>img=3D{ {1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{1,1,1,1,1,1,1,1,1,1},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2},</FONT></DIV>
<DIV><FONT size=3D2>{2,2,2,2,2,2,2,2,2,2} },</FONT></DIV>
<DIV><FONT size=3D2>pal=3D{{0,0,255},{255,0,0}},</FONT></DIV>
<DIV><FONT size=3D2>BMP=3DcreateDIB(img,pal)</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>procedure onPaint_win(integer x,integer y,integer =
x2,integer=20
y2)</FONT></DIV>
<DIV><FONT size=3D2>drawBitmap(win,BMP,5,5)</FONT></DIV>
<DIV><FONT size=3D2>end procedure</FONT></DIV>
<DIV><FONT =
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>WinMain(win)</FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT color=3D#000000 size=3D2>--END =
EXAMPLE</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>

------=_NextPart_000_0010_01BED45C.7E6858C0--

________________________________________________________
NetZero - We believe in a FREE Internet.  Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download/index.html

new topic     » topic index » view message » categorize

2. Re: createDIB() in Win32Lib needs a doctor!

Mike Hurley wrote:

> createDIB() in Win32Lib needs a doctor!

Thanks for the example. I'll see if I can recreate/fix the problem.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: createDIB() in Win32Lib needs a doctor!

Mike

The CBM_CREATEDIB ( create bitmap message ) that david has defined in
win32lib.ew does not exist in win95 or win32; He probably has to use
something else. That is probably why it doesn't work.

Bernie

new topic     » goto parent     » topic index » view message » categorize

4. Re: createDIB() in Win32Lib needs a doctor!

Mike Hurley wrote:

> createDIB() doesn't work.

Specifically, it has trouble with DIB that only contain two colors. The
following will "fix" the problem:

   pal={{0,0,255},{255,0,0}, {0,0,0}},

It forces the palette to use the 16 color palette code, which works.

I'll take a look at the pixel packing routine. Someone had corrected the 16
color palette code some time back; I should have paid more attention to it.
It looks like the 2 color palette needs a similar fix.

Thanks!

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

5. Re: createDIB() in Win32Lib needs a doctor!

Mike Hurley wrote:

> createDIB() doesn't work.

Oooops. Ignore my last fix. The problem is that (unlike what the
documentation says), the palette indexes are zero-based, so they would match
Euphoria's palette. So just subtract 1 from the image, and everything is
fine.

I'll send Robert the corrected documentation.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

6. Re: createDIB() in Win32Lib needs a doctor!

Bernie Ryan wrote:

> The CBM_CREATEDIB ( create bitmap message ) that
> david has defined in win32lib.ew does not exist in
> win95 or win32

According to the Win32 Programmer's Reference, it's part of Win32s, Win95
and WinNT.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

7. Re: createDIB() in Win32Lib needs a doctor!

I searched both microsoft include header files and borland header files
and that is not defined in either. ??

PS Using onEvent how do I look at the message come into it ??
Bernie

new topic     » goto parent     » topic index » view message » categorize

8. Re: createDIB() in Win32Lib needs a doctor!

DAVID
I found the problem

new topic     » goto parent     » topic index » view message » categorize

9. Re: createDIB() in Win32Lib needs a doctor!

>> The CBM_CREATEDIB ( create bitmap message ) that
>> david has defined in win32lib.ew does not exist in
>> win95 or win32

David
   I found the problem.
   Your secutary typed it wrong CBM_CREATEDIB.
   IT SHOULD BE CBM_CREATDIB ( NO "E" )
Bernie

PS don't forget to explain how to get the messages from onEvent

new topic     » goto parent     » topic index » view message » categorize

10. Re: createDIB() in Win32Lib needs a doctor!

>> The CBM_CREATEDIB ( create bitmap message ) that
>> david has defined in win32lib.ew does not exist in
>> win95 or win32

David
   I found the problem.
   Your secutary typed it wrong CBM_CREATEDIB.
   IT SHOULD BE CBM_CREATDIB ( NO "E" )
Bernie
PS Using onEvent how do I look at the message coming into it ??

new topic     » goto parent     » topic index » view message » categorize

11. Re: createDIB() in Win32Lib needs a doctor!

Bernie Ryan wrote:

> I found the problem.
> Your secretary typed it wrong CBM_CREATEDIB.
> IT SHOULD BE CBM_CREATDIB ( NO "E" )

You are correct, the constant is spelled incorrectly. But since it's
consistantly wrong, the net effect is zero.

> PS don't forget to explain how to get the messages from onEvent

The onEvent callback passes the parameters:

        onEvent( iMsg, wParam, lParam )

These correspond to the parameters passed by Windows. So you can set it up
like this:

   procedure TrapEvent( integer iMsg, atom wParam, atom lParam )
      -- your code goes here
   end procedure
   onEvent[Win] = routine_id("TrapEvent")

onEvent will trap all events that are sent to the window/control.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

12. Re: createDIB() in Win32Lib needs a doctor!

Thank You David
Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu