ScaleBrush doesn't work for brushes from PDF

Discuss PDF file handling with the Polybios plugin here
Post Reply
User avatar
jPV
Posts: 132
Joined: Sat Mar 26, 2016 11:44 am
Location: RNO
Contact:

ScaleBrush doesn't work for brushes from PDF

Post by jPV » Sun May 20, 2018 10:11 am

Code: Select all

@REQUIRE "polybios"
Repeat
f$=FileRequest("Select a PDF file")
If Not f$ Then End
pdf.OpenDocument(1, f$)
pdf.GetBrush(1, 1, 1)
DebugPrint("Orig dimensions:", GetAttribute(#BRUSH,1,#ATTRWIDTH), GetAttribute(#BRUSH,1,#ATTRHEIGHT))
ScaleBrush(1,"200%",#KEEPASPRAT) ; <- Any kind of scaling results an 1x1 brush always
DebugPrint("New dimensions:", GetAttribute(#BRUSH,1,#ATTRWIDTH), GetAttribute(#BRUSH,1,#ATTRHEIGHT))
DisplayBrush(1, #CENTER, #CENTER) ; <- This doesn't show anything then
FreeBrush(1)
pdf.CloseDocument(1)
WaitLeftMouse
Forever
The output from the previous script is an empty display and this log:

Orig dimensions: 595 842
New dimensions: 1 1


For comparison, RotateBrush does work still...

I don't know if this is only Polybios related bug or generally for all kinds of vector brushes?

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: ScaleBrush doesn't work for brushes from PDF

Post by airsoftsoftwair » Sun May 20, 2018 11:54 pm

No, SVG images work. Only Polybios seems to be affected. Will be fixed, thanks for reporting!

User avatar
jPV
Posts: 132
Joined: Sat Mar 26, 2016 11:44 am
Location: RNO
Contact:

Re: ScaleBrush doesn't work for brushes from PDF

Post by jPV » Mon May 21, 2018 4:51 pm

I also have a problem when I tried to add PDF support to RNOComics, it seems I get crashes with DisplayBrush() if I use Width/Height options in the table... and give values different to original dimensions. For some reason I haven't been able to reproduce it in a simple example... so I'm not sure if I'm doing something else in the code that affects to the result.

But if you have any hunch what it could be, or is it related to the ScaleBrush issue, please let me know. If not, I'll continue random testing :)

Here are some logs how it crashes: link

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: ScaleBrush doesn't work for brushes from PDF

Post by airsoftsoftwair » Wed May 23, 2018 7:57 pm

Very likely to be related to the very same issue but it would still be good if you could provide a reproducable script. Maybe try another platform? MorphOS is very tolerant concerning illegal memory accesses. Maybe try to reproduce it on Linux and Windows which are both much less forgiving than MorphOS :)

Post Reply