Vector Printing Image

Mac OSX specific forum
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Vector Printing Image

Post by coder14 »

I am trying the new vector printing in 5.40 LTS and it is great. But this example prints well in Windows but on Mac the image gets cropped:

Code: Select all

UseJPEGImageDecoder()
DefaultPrinter()
If StartPrinting("Vector Print")
  If StartVectorDrawing(PrinterVectorOutput())
    ;replace with your own jpg image
    LoadImage(0, "A4_Letter.jpg")
    DrawVectorImage(ImageID(0), 255, VectorOutputWidth(), VectorOutputHeight())
    StopVectorDrawing()
  EndIf
  StopPrinting()
EndIf
Use any size jpg image to test and draw vector image will resize it.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Vector Printing Image

Post by wilbert »

I don't see it being cropped, only stretched. :?
Windows (x64)
Raspberry Pi OS (Arm64)
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Re: Vector Printing Image

Post by coder14 »

wilbert wrote:I don't see it being cropped, only stretched. :?
Mac OSX 10.7.5 and PureBasic 5.40 LTS 64bit:

Code: Select all

UseJPEGImageDecoder()

CreateImage(0, 300, 300)
StartDrawing(ImageOutput(0))
Box(0, 0, 300, 300, RGB(255, 255, 255))
DrawText(0, 0, "A line of text", RGB(0, 0, 0), RGB(255, 255, 255))
StopDrawing()

If PrintRequester()
  If StartPrinting("Vector Print")
    If StartVectorDrawing(PrinterVectorOutput())
      DrawVectorImage(ImageID(0), 255, VectorOutputWidth(), VectorOutputHeight())
      StopVectorDrawing()
    EndIf
    StopPrinting()
  EndIf
EndIf
Image

The rendering size is also different on the same printer.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Vector Printing Image

Post by collectordave »

Have you looked at this topic?

http://www.purebasic.fr/english/viewtop ... 01#p472701

Shows a preview as well.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Re: Vector Printing Image

Post by coder14 »

collectordave wrote:Have you looked at this topic?

http://www.purebasic.fr/english/viewtop ... 01#p472701

Shows a preview as well.
Thank you but I am trying to confirm the issue that I reported above.

I tried your code on my MacBook Air but it keeps crashing. :shock:
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Vector Printing Image

Post by collectordave »

Hi

Looking at the example, the DrawVectorImage() procedure will resize the image to the size specified. So could you first run the same programme but use debug to see what size the image is to be on each platform? Windows reports a setting for DPI on a printer and MAC appears to report the actual DPI so some error can creep in.

Debug VectorOutputWidth() etc and compare on each platform?

A second thing is that the code uses the default for StartVectorDrawing(PrinterVectorOutput()) which displays the image in points. Can you try this with mm?

Code: Select all

         StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Millimeter))

         MovePathCursor(10, 10) ;Move cursor to 10mm from left and 10mm from top
         
         DrawVectorImage(ImageID(0), 255,100,15) ;draw image 100mm wide and 15mm high

         StopVectorDrawing()
Both should then print the same as you are giving definate sizes for DrawVectorImage to use.

Please let me know how you get on.

__________________________________________________
Code tags added
21.12.2015
RSBasic
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply