Page 2 of 2
Re: Squirrel static lib
Posted: Wed Oct 10, 2012 1:22 pm
by grabiller
wilbert wrote:For the box with 'subscription' inside it, the problem indeed still exists.
The other controls are looking better now. I don't know if that one is drawn in another way.
It seems there is still something wrong in v5b4, but with the alpha channel.
It's like the alpha channel of the images is affected by the color space. This should not be, alpha channel must stay untouched and in linear space.
My controls are looking better but in fact if you look at the top and bottom side of the button, there are 'bold' lines which do not look this way on Windows and Linux.
It's like the alpha channel is 'stronger' on Mac, that's what makes me think the alpha channel is affected by the color space.
Re: Squirrel static lib
Posted: Wed Oct 10, 2012 1:47 pm
by wilbert
I agree the problem is not fixed yet and it is still a bug.
What you can do for now, as a temporary fix, is overwrite the DrawImage command with cocoa calls.
If you insert this code in the beginning of your application and have the lib with the CocoaMessage command installed, it will overwrite the DrawImage command.
Code: Select all
; *** DrawImage rewrite ***
Procedure DrawImgEx(ImageID, x, y, Width, Height)
Protected srcRect.NSRect, dstRect.NSRect, delta.CGFloat = 1.0
CocoaMessage(@srcRect\size, ImageID, "size")
If Width < 0 Or Height < 0
dstRect\size = srcRect\size
Else
dstRect\size\width = Width
dstRect\size\height = Height
EndIf
dstRect\origin\x = x
dstRect\origin\y = OutputHeight() - dstRect\size\height - y
CocoaMessage(0, ImageID, "drawInRect:@", @dstRect, "fromRect:@", @srcRect, "operation:", #NSCompositeSourceOver, "fraction:@", @delta)
EndProcedure
Macro DrawImage(ImageID, x, y, Width = -1, Height = -1)
DrawImgEx(ImageID, x, y, Width, Height)
EndMacro
; *** End of DrawImage rewrite ***
It doesn't fix the bug, it's only a workaround.
Edit :
I updated the code because there was a bug in my code resulting in the wrong drawing coordinates.
I also want to point out that it doesn't respect the PureBasic drawing mode.
#NSCompositeSourceOver has the same effect as #PB_2DDrawing_AlphaBlend.
#NSCompositeCopy has the same effect as #PB_2DDrawing_AllChannels.
Re: Squirrel static lib
Posted: Wed Oct 10, 2012 2:27 pm
by grabiller
Thanks wilbert.
Indeed that fixes the problem, as a workaround that is.
My images are now correctly drawn with proper alpha channel, including the 'Subscription' disabled button.
I hope it's straightforward to fix in PB for a beta 5.
Re: Squirrel static lib
Posted: Wed Oct 10, 2012 4:02 pm
by grabiller
Here is the result for you to check:
http://www.raafal.org/download/raafal.x ... macosx.zip
Here it works correctly now.
Re: Squirrel static lib
Posted: Wed Oct 10, 2012 4:31 pm
by wilbert
Yes, this one looks totally fine.
Hopefully Fred will find the solution to the stretched image drawing issue so you don't need a workaround.