Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can windows dll's be used to write to screen?

Author
Message
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 12th May 2003 20:37
Wow mate!!!!

No crashs, super fast!!

Gona try to incorporate into my colouring book program!!! If I can!!

U must have worked hard on that!

By the way did you test that bit of code on the previous post?
What results did you get?

How come colour values work on this new program and not the other????

Lots of questions??

New to DBPro comin from AMOS on the Amiga!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th May 2003 20:55
That's a bloody clever way of dealing with the problem of speed - precalculate the fill areas. And it has the bonus of not overwriting the black lines.

It works with any colour, because it's not actually looking at the colours when it fills - all that work has been done earlier by detecting all the white areas.

Put the code from the 'lock pixels' through to 'unlock pixels' into it's own subroutine or function and call it immediately after loading your bitmap into bitmap 0.

This is a real neat solution to the problem.
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 12th May 2003 21:46
Cheers m8!

Think I will be able to put that into the program, ran it on its own with one of my pictures and it works a treat, just have to get it onto the main part now!!! LOL that will be fun!!

Think it is goin to sort out the problem so far, will let you know how it goes, me very happy again now!!!

Still think it would be good for a native command though in the format Paint x,y,c as it seems to have got a lot of people thinking!!!

Any ideas though why my colours are messing up!!?

By the way has anyone else had trouble with your own icons for the programs? You notice they mess the colours up every time in windows?

l8rz

New to DBPro comin from AMOS on the Amiga!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th May 2003 22:15
Glad it helps.

I ran out of time which is why the precalc section is not its own subroutine, but would help as you need to run it when you load in a new piccy. I could not also decide which variables to have as global and which ones to pass into the functions but I'm sure you can decide that!

Took me about an hour to sort out.

As IanM points out it also stops people filling in the black dividing lines and messing up the picture.

The only downside is you have to have an array with as many pixels as the piccy but that should not be too big an overhead.

I did lots of testing (see answer a few posts ago) and it appears that 16 bit colours are not drawn accurately, e.g. cls, box, line and dot all draw with a slightly different shade to each other!!! So doing anything that mixes cls, box, line, box and point is onto a big loser. You also HAVE to store all colours in DWORD's otherwise things don't work.

So, just a print routine to go then?

Gronda, Gronda
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 12th May 2003 23:04
WELL......... YOU WILL BE PLEASED TO KNOW THAT IT WORKS GREAT IN MY COLOURING BOOK PROGRAM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Can you tell I'm so happy....?

My kids are too, they have tested the program and I have not had any moaning!!!! Just enjoyment in using the program!!

All I have to do now is draw some more pictures (only 3 at the moment) and get the print thing sorted and thats it!!! Looks like print command might be in patch 5 going off what Rich said??

I did have a one prob putting the routine into my program, when I changed picture and called the _checkscreen routine to read pixels it messed up and coloured nearly all the colouring area (640x430) so what I did was UnDim at the start of the routine Dim them again and it worked a treat, don't know if this is correct? but it worked LOL

Thanks a lot again guys and don't forget to look out for the finished game on my website! I've not forgot a special thanks to you 2 in the end part! (Will post when game is on site)

Thanks again l8rz

New to DBPro comin from AMOS on the Amiga!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th May 2003 23:14
Yeah, as I said, did not have time to explain code as I was falling asleep when I posted!

You are correct in saying you need to clear down BOTH arrays between piccys as both dims are related. Only way is undim and then dim. or loop through and set all the elements back to zero.

Maybe now you will stop posting your fill request in every thread I read!!!



Gronda, Gronda
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 12th May 2003 23:16
LOL LOL LOL LOL LOL

Yup thats correct but.............. you might see PRINT request in every post LOL only joking, will see what happens in patch 5 eh?

Thanks again m8!!!!!

New to DBPro comin from AMOS on the Amiga!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th May 2003 23:51
patch 5! Oh well I suppose it will give you something to do over Christmas which is probably when patch 5 will come out, immediately followed a month or two later by patch 5.1 to fix the bugs that patch 5 will 'introduce'.

Gronda, Gronda
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th May 2003 00:20
Hooray! No more 'paint' posts
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 13th May 2003 02:44
LOL don't know if I can wait for x-mas!!!! come on PRINT posts!!!



New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 13th May 2003 12:40
Do you mean printing to a printer ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 13th May 2003 20:39
Thats right m8, need print command of a bitmap or portion of a bitmap to the printer, eg

printout bitmap 1

or

printout bitmap 1,0,0,100,100



New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 01:04 Edited at: 14th May 2003 01:10
Unfortunately my plug-in can only print a bitmap from a file... You could dump an area from the screen to a file and do it that way. Alternatively you could create a bitmap header + get the data from the screen and save to a file.

Alernatively, if someone could create C code to read the screen, create the bitmap header + data, I can dump that to a file and then read it back in.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 14th May 2003 04:22


Printing from a file is a good substitute for the moment, I could save the porting of the screen to a file and then print it out.

How do I use your stuff to do it then?



New to DBPro comin from AMOS on the Amiga!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 12:12
I do have an example program (along with the plug-in) on my web site. I suggest you head straight over there and have a look...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th May 2003 15:34 Edited at: 14th May 2003 15:35
That, combined with the bitmap saving function that I put together should do the job then.



It ain't quick, but it does the job.
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 16th May 2003 14:48
Thanks guys will check it out very soon!

New to DBPro comin from AMOS on the Amiga!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th May 2003 04:03
I've been playing with my flood-fill routine tonight, and I've just managed to get a 62% increase in speed - what used to take 220ms on a fairly complex and large shape now only takes 83ms.

Unfortunately, the code ain't pretty - I've used every optimisation trick I know - and it uses an extra half a meg of system memory, but it is the speed that counts ... isn't it?

Login to post a reply

Server time is: 2026-07-11 03:38:22
Your offset time is: 2026-07-11 03:38:22