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.

Program Announcements / Take control of your printer with Dark Ink

Author
Message
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 4th Mar 2008 05:11
Hi everyone,
I have written a plug-in for dark basic pro called dark ink. Dark ink can print text, bitmaps and images, lines, rectangles, ellipses. You can output pretty much anything you like to the printer. I have created a BETA trial release as it is impossible for me to test it againt all the computer/ printer combinations that exist. I have tested it with an epson c64 printer and microsofts XPS document writer under windows 64 bit version of windows. The plug-in is fully documented and can be downloaded from my web site.

http://www.zogtrog.plus.com/darkink/

http://www.zogtrog.plus.com/darkink/

The following commands have been implemented


TEXT COMMANDS

CENTER LTEXT - draws centreted text at coords x,y
LPRINT - prints a string to the printer
LPRINTNL - as ltext but advances a new line
LTEXT - outputs text at coords x,y
GET PTEXT HEIGHT - gets the height of a piece of text
GET PTEXT WIDTH - gets the width of a piece of text
PRINTER INK - sets printer (fore & back)ground colours
SET PTEXT OPAQUE - makes text have an opaque background
SET PTEXT TRANSPARENT - makes text have a transparent back ground
SET PTEXT SIZE - sets the size of the printed text
SET PTEXT TO BOLD - printer text style bold
SET PTEXT TO ITALIC - printer text style italic
SET PTEXT TO BOLDITALIC - printer text style bold & italic
SET PTEXT FONT - sets the font for the printer
SET PTEXT TO NORMAL - sets text style to normal

GRAPHICS COMMANDS

PLOT BITMAP IN MEMORY BLOCK - draws a bitmap or image to printer
PLOT CIRCLE - draws a circle on the printer
PLOT DOT - plots a dot
PLOT LINE - draws a line
PLOT BOX - draws a rectangle on the printer
PLOT ELLIPSE - draws an ellipse on the printer

CONTROL COMMANDS

DISPLAY PRINTER SETUP DIALOG - display the printer setup dialog
GET PRINTER COUNT - counts the printers
GET PRINT CURSOR X - gets the x cursor
GET PRINT CURSOR Y - gets the y cursor
GET LINE SPACING - set line spacing using the current
GET PAGE COUNT - counts the number of pages in the print job
GET PRINTER NAME - returns the current printers name
GET PRINTER ORIENTATION - get page orientation
GET PRINTER PAGE HEIGHT - returns page height
GET PRINTER PAGE WIDTH - gets the page width

SET LINE SPACING - sets line spacing based on current font
SET PRINTER CURSOR - positions the print cursor
SET PRINTER INDEX - sets the current printer
SET PRINTER ORIENTATION - sets the printers page orientation
PRINTER COPIES - sets / gets printer copies
PRINTER STATE - printing or idle
PRINTER NEW PAGE - starts a new page
PRINTER GO - completes a print job
PRINTER STOP - aborts a print job




Extended font commands

Setup up stored fonts for ease of use

DESTROY ALL PRINTER FONTS
DESTROY PRINTER FONT
GET PRINTER FONT FLAGS
GET PRINTER FONT NAME
GET PRINTER FONT SIZE
SET PRINTER FONT
SETUP PRINTER FONT

see web site

Miscellaneous Commands

DARKINK - Displays text on the screen to show if version info and copyright info

Best Regards,

Jack Taylor


http://www.zogtrog.plus.com/darkink/

Jack Taylor
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 4th Mar 2008 17:07
Sounds neat.

Quote: "PLOT BOX - draws a rectangle on the printer
PLOT ELLIPSE - draws an ellipse on the printer"


Oh no! Ink leak!


I fail at life. No, really.
Anonymous User
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location:
Posted: 5th Mar 2008 20:44
Some very nice commands there, great for printing off a simple diagnostic or printing off custom made graphs, even a screen of your game if you had enough ink

???
tschwarz
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location: 127.0.0.1
Posted: 5th Mar 2008 22:40
I get:

"This application has failed to start because rtl100.bpl was not found"

If you need more info let me know.
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 6th Mar 2008 06:30
Thanks for bringing this problem to my attention. The reason why darkink failed was, because it was missing some dynamic link libraies.
I have compiled my project differently, so hopefully this should elimate the need for any external files. I have updated my files BETA version 1.0.1.1

You can get the latest version from

http://www.zogtrog.plus.com/darkink/page55.html

Jack Taylor

Jack Taylor
tschwarz
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location: 127.0.0.1
Posted: 6th Mar 2008 07:24
Version 1.0.1.1 works.

You can add an IP based HP 1200 Laserjet to your list of tested printers. I'll play around with it for a few days and then let you know how it goes.
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 6th Mar 2008 11:02 Edited at: 6th Mar 2008 11:07
That's great news! Thanks for testing out DarkInk. If anyone would one like me to add any extra features or functions feel free to request them and I will have a think about implementing them.

Jack Taylor



Jack Taylor
Anonymous User
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location:
Posted: 7th Mar 2008 20:53
Being able to print an image that's loaded into DBPro would be nice

???
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 8th Mar 2008 07:18
The good news is that you can already do this. I have included an example in a zip file on how to do it.

You can convert any image to a memblock which has the same structure as that for a bitmap using the

MAKE MEMBLOCK FROM IMAGE command, and then you can then use the

PLOT BITMAP IN MEMBLOCK command to send the picture to the printer

See the documentation on these commands before using them!

Best Regards,


Jack Taylor

Jack Taylor

Attachments

Login to view attachments
tschwarz
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location: 127.0.0.1
Posted: 8th Mar 2008 23:08
Tested with an epson stylus color printer and that is working also. Printing a color image came out really good and fast.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Mar 2008 14:00
fantastic zog some thing that will be on my list to get.

Tested on an all in one HP PSC 750, tired the image print and that was spot on, only thing was I was expecting the size on screen to come out on print out. but no worries just not reading the code until after its run, now I see why it came out that size.

plus have tried it with chr$() codes and they came out as expected now I can print out forms that can have boxes around titles.

one command I thougth of, is a scan to printer, if that out of your range at this time it can wait.

cheers.

Dark Physics makes any hot drink go cold.
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 10th Mar 2008 13:30 Edited at: 10th Mar 2008 13:32
Do you mean that you want to get an image from your scanner and send it to the printer ?
If you do then that would be beyond the scope of my project, as I am only concerning myself with printing. I know there is a plugin for getting web cam images into dbpro, but I don't know if there is one for use with scanners. Web cameras and scanners tend to use the same software layer to interact with windows.
There are several different collections of microsoft APIs for aquiring still images, some of which I have had a play with in the past.
If anyone knows of such a plugin for acquiring scanned images then maybe they could enlighten us.

Best Regards,


Jack Taylor

Jack Taylor
Thebeely
18
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 12th Mar 2008 00:01
Wow, just what I was looking for

Is it going to be free or commercial?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Mar 2008 12:50 Edited at: 12th Mar 2008 13:02
Would you be able to put together a little demo that shows shapes, text and graphics? It would be nice to feature in the newsletter. Do you aalso have any information on how you intend to make the final product available (costwise etc)?

I was thinking something along these lines for a demo A4 page...

Attachments

Login to view attachments
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 13th Mar 2008 07:56 Edited at: 13th Mar 2008 07:57
There is a new beta update available that has four new commands in it.

PRINTED LENGTH X - gets the length of n number of pixels in n given units
PRINTED LENGTH Y - gets the length of n number of pixels in n given units

PRINTER PIXELS IN LENGTH X - returns the number of pixels in a given distance in the x direction

PRINTER PIXELS IN LENGTH Y - returns the number of pixels in given distance in the y direction

These commands allow you to convert between real measurements and pixels.





See the rulers example


Documentation

http://www.zogtrog.plus.com/darkink/page22.html


Download can be found here

http://www.zogtrog.plus.com/darkink/page55.html

Jack Taylor

Attachments

Login to view attachments
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 15th Mar 2008 06:57
Dear all,
Darkink is going to be a commercial product. I have not decided on a price yet or how it is going to be sold. I will try to ensure that the price is fair so that the product is not beyond anybody's reach.
I have no idea what to code for a demo program. I would appreciate any suggestions that any of you may have, as to what you would like to see a demo of darkink doing ?

Best Regards,


Jack Taylor

Jack Taylor
Thebeely
18
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 15th Mar 2008 15:18
You could make some kind of drawing program. I can help you if you want
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 22nd Mar 2008 08:05
That's very nice of you to offer Mr Thebeely.

I have had a very good idea for a demo program, although it will take a while to code.
However at the moment I would like to concentrate on getting this project ready for commercial release. I have a few things to do like integrating my help files into the DBPro help system.

Best Regards,


Jack Taylor

Jack Taylor
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 1st May 2008 06:55
The DarkInk Beta version is no longer available for download.
Please watch this space for more news in the near future.

Best Regards,


Jack Taylor

Jack Taylor
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st May 2008 21:55
trogdor
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: Portsmouth, VA, USA
Posted: 6th May 2008 17:14
lprint demo works fine the other three throw this error.

Constant name 'TRUE' cannot share the name of a reserved word or command.

Let them hate as long as they fear -Caligula
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 7th May 2008 09:04
Hi Trogdor,
I don't get this error, but it sounds like you have a plug-in that defines the TRUE / FALSE constants as keywords.

Try commenting out the first two lines in the DPIncludes.dba file.

I am setting TRUE to 1 and FALSE to 0


Jack Taylor

Jack Taylor
trogdor
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: Portsmouth, VA, USA
Posted: 15th May 2008 23:00
Thanks zog, that took care of that message.
I've been testing this on 36 printers and it's been good till I got to printImage.dbpro virtual printers like Adobe FlashPaper and Acrobat8 Pro. I got the attached messages.
On the other hand MS_Office Imaging worked fine.

Let them hate as long as they fear -Caligula

Attachments

Login to view attachments
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 16th May 2008 20:47 Edited at: 16th May 2008 20:47
Okay I will look into this problem. I will probably get back to you some time next week. The first error box is one of mine the second one however isn't.
The second box suggests the adobe driver has tried to construct a path by concatenating strings, one string has become corrupted with garbage. Please try re-installing your adobe products and see if this solves your problem as the second box suggests. I will check the adobe web site, and news groups to see if this sort of error has occurred anywhere else.


Jack Taylor

Jack Taylor
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 21st May 2008 08:59 Edited at: 21st May 2008 09:19
Well done trogdor, I can confirm that Flash Paper 2 causes an exception in Dark Ink. However I got the Acrobat PDF printer to work on vista 64 bit, providing it is set as your system default printer, otherwise it crashes as well!

There is lots of info on these Adobe drivers causing problems on various newsgroups on the internet. My software depends on these driver behaving in a conformant and predictable manner. The mere fact that other XPS drivers work, and that these drivers sometimes, work depending on how you have configured them suggests that they are in my opinion only that, they are a bit 'flakey'. However I will try to write patch code to get them to work properly with Dark Ink.

I have posted a detailed error report to my known issues page online http://www.superbitysoft.co.uk/darkink/page64.html

This is the sort of problem I was hoping was going to come to light in the Beta testing period.

There is also an issue with the documentation of the commands Printed Pixels In Length X and Printed Pixels In Length Y.
These two commands should read Printer Pixels In Length X and Printer Pixels In Length Y respectively. These two commands won't be highlighted in blue in the IDE, but they will compile correctly once changed to the correct syntax.

I will try to resolve the above problems and release a new version of Dark Ink.

I am also going to experiment with other PDF writers and swf creators which there are plenty of to see if these also have problems.

Best Regards,

Jack Taylor

Adobe newsgroup links
http://www.adobeforums.com/webx?14@@.3bc44b15/2

Jack Taylor
JDforce
19
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 7th Jun 2008 19:49
Hi Zog, I just purchased Dark Ink. What I really would like is a sample program to print whatever is on the current game render. I mean, not only pure printing functions but a game with a print-this-capture option.
This is a feature announced in the publicity, but samples are very simple.
I know it can be made assigning a camera to a bitmap and so on, but it would be best to have a good sample to start on, just like they are in any other DarkBasic Plugin documentation. Its best to see what the master do in order to learn.

May the 3d force B with U
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 9th Jun 2008 13:45 Edited at: 9th Jun 2008 14:07
Dear JDForce,
The code you require is given below, use the Bitmap_To_Printer function in the DPIncludes.dba module attached to this message. Include the DPIncludes.dba file in your project.
If you place the code below in your main game loop when you press the "P" key this will dump the screens bitmap to the printer.



If you want to create a snap shot from a camera then try following function also included in the new DPIncludes.dba module

Note if you use camera 0 you will lose the output to the screen. I suggest you set up a duplicate camera.



The insert the following again into your main game loop. Create a second camera



The snap image function will create a screen sized image from the named camera. If you don't want to print the image straight away it is stored in bitmap 31.

I tested this code with the SphereMapping demo program. Note I have scaled my screen dump to save ink.





With regards to my samples being simple, it is best if they are kept simple. What people normally want to know is how to use the commands in question quickly. Most people would not want to trawl through several thousand lines of code in order to learn how one or two commands work.

Best Regards,


Jack Taylor

Jack Taylor

Attachments

Login to view attachments
trogdor
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: Portsmouth, VA, USA
Posted: 10th Jun 2008 00:09
Instead of


I use the following to keep a 4:3 ratio



I noticed that sprites, and on screen text do not print. I think saw a code snippet on how to get sprites to capture with the screen.

Let them hate as long as they fear -Caligula
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 10th Jun 2008 01:45
Yeah I noticed that to.
Unfortunately you have to overlay any sprites you have created manually over your bitmap using the paste sprite command. The code below will work in the sphere mapping demo, but needs to be tailored to your own programs.

Beware the code below will print out a full sized picture with trogdor scaling.

Adjust the scaling factors to save ink!



here is the link to the screen shot function you are talking about trogdor.

http://forum.thegamecreators.com/?m=forum_view&t=128546&b=6

Feel free to invent your own scaling functions.

Jack Taylor

Jack Taylor
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 10th Jul 2008 09:19 Edited at: 11th Jul 2008 07:04
Dark Ink for Dark GDK is now available for download for registered users. If any of you experience any problems with the GDK version of Dark Ink in please could you email me at

darkink@superbitysoft.co.uk

Best Regards,


Jack Taylor

Jack Taylor
wh1sp3r
20
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 3rd Sep 2008 22:30 Edited at: 3rd Sep 2008 22:42
I have problem. I have just bought Dark Ink, installed. I ran TGConline.exe to activate program, but program says: "Unknown product". What I should do now ?

EDIT: solved. I moved all certificates away, activated Dark Ink, and moved all certificates back. Its ok now, but Its strange, why it did this.


PS: Real programmers aren't afraid of math!.
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 28th Sep 2008 18:39
Your plugin is very useful, especially since it works with USB printers. There is a slight inaccuracy, though.
The following code should display a ruler in centimetres:



I don't know whether it's your plugin or my printer, but it is only accurate to within 1 part in 400.

The optomist's right, The pessimist's right.
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 28th Sep 2008 20:01
Here's a function to print graph paper:



The optomist's right, The pessimist's right.
zog
16
Years of Service
User Offline
Joined: 13th Dec 2007
Location: Southport UK
Posted: 13th Oct 2008 07:13
Dear calcyman,
Thanks for buying my plug in. I have had a look at your code snippet that was producing the inaccuracy. I have modified it to make it accurate. I have checked the accuracy with the best standard I have which is a steel ruler with an accuracy
of 0.5 mm. The overall printing accuracy will be governed by the manufacturing tolerances your printer was built to.



I think because you incremented you nextint counter variable before you test it to see if it perfectly divisible by 10 this has lead to an error. You should post increment this variable after testing it, you want a long line at zero cm after all. Also your test condition was wrong, because you needed to use a greater than or equal to test condition not a greater than test condition. I would also advise you to use distinct variable names in your programs. Using both u as an integer and u# to represent a floating point number is confusing, it may also confuse the compiler.

Best Regards,


Jack Taylor

Jack Taylor

Login to post a reply

Server time is: 2024-04-16 13:10:35
Your offset time is: 2024-04-16 13:10:35