Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I try to run the code which attached below. But i dont have idea what i need
to write on playground to run the code. can anyone explain what happen actually using this class>>primImage: aFormat width: aWidth height:aHeight <http://forum.world.st/file/t372453/prob.png> -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi What are you trying to do ? To use Athens ? Do you want to use it with Morphic ? Renaud Apr. 7, 2020, 08:59 by [hidden email]:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
actually i am just exploring UFFI from the pdf "Calling Foreign Functions
with Pharo" there one section is for external objects so i cant understand that code what i attach as screenshot above. can u able to explain what actually happen here ?? -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Shawon,
where did you get the docs? Have you tried the latest version (january/february this year) ?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by shawon58
Hi I'm not a FFI expert, and you code may not be the latest FFI version. However, If I look at it from Pharo side: When you want to use Athens with Cairo backend, you have to initialize its surface using a call like: surface := AthensCairoSurface extent: self extent Note that I'm calling a class method of AthensCairoSurface. In this example, 'self extent' will give you the size of the rectangle used by Morph for its bounds size. This, in turn, will call AthensCairoSurface class >> extent: anExtent ^self extent: anExtent format: CAIRO_FORMAT_ARGB32 and you reach: AthensCairoSurface class >> extent: anExtent format: aFormat ^ ( self primImage: aFormat width: anExtent x height: anExtent y + 1) initialize Which lead you to: primImage: aFormat width: aWidth height: aHeight ^ self ffiCall: #(AthensCairoSurface cairo_image_surface_create (int aFormat, int aWidth, int aHeight) ) From there, you have linked your pharo code done to initialize a Cairo surface. This will do a C call like: cairo_image_surface_create(CAIRO_FORMAT_ARGB32, aWidth, aHeight) This C call is documented here: https://www.cairographics.org/manual/cairo-Image-Surfaces.html, with surface enum here: https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t Through the magic of FFI, It'll return an instance of AthensCairoSurface you''ll be able to use directly in your Pharo code. You can have a look to AthensFlakeDemo in Athens-Demo for a full working example. Renaud Apr. 7, 2020, 22:44 by [hidden email]:
|
Free forum by Nabble | Edit this page |