|
Post by rikky on Mar 22, 2021 7:08:56 GMT 1
Thanks Joe, for testing. Since I'm too lazy to compile the whole fossil bacon, I did a fossil bacon.sh but that stucks already with the OPTION GUI TRUE not recognised. But I incorporated the changes. Does this however means that I have to FREE the return variable$ from every FUNCTION? This would make BaCon less intuitive, I suppose. And why should I explicitly declare a variable with TYPE STRING if it normally does this automatically? I have a warning also, already from the beginning. this is presumably for this line: I've got no idea how to FREE this line. But it does not seem to harm. Thanks. Rik.
|
|
|
Post by bigbass on Mar 22, 2021 16:25:56 GMT 1
Hello Rik you can solve all the problems easily by giving a return type to the functions using your original code just this is needed change FUNCTION Y2LAT$(ytile,zoom) for this FUNCTION Y2LAT$(ytile,zoom) TYPE STRING Note:( in other languages such C "the mother language of BaCon " you get punished by the compiler for not declaring types and returns from functions) *BaCon does some of the clean up work for us automatically so we can normally get away without the FREE and warnings to have no warnings you can add FREE img$ here FUNCTION CONVERT_PNG2SVG$(string$) TYPE STRING RETURN header$ & img$ & footer$ FREE img$ P.S I just try to get things to compile and run. and document what I can along the way only Peter knows if there are bugs or not and if there are he is quick to fix them Joe just in case there is a doubt this compiles and runs OPENSEAGUI.tar.gz (4.74 KB)
|
|
|
Post by alexfish on Mar 22, 2021 19:12:57 GMT 1
Hi All Have posted beta testing frame work POST #1, cleaned up version of previous demo's + implemented GPS Position Please Note this will not work on PI3 I will be firing up the PI3 , and possible using original code base from the widget toolkit thread BR Alex Attachments:
|
|
|
Post by alexfish on Mar 23, 2021 4:07:44 GMT 1
As Regards Raspberry Pi3 users = not working I did not receive a reply to this this is not the first instance of a No Reply the post. Oh, Just seen Vovchik's post The Link HEREBR Alex
|
|
|
Post by rikky on Mar 23, 2021 7:06:16 GMT 1
This is when i haven't got a clue.
|
|
|
Post by alexfish on Mar 23, 2021 7:27:39 GMT 1
Hi Rik With reference to PI 3 Let me know if the below archive compiles & the Window shows text + a button This works on My PI 3 and PI 4 similar to what was done on X11 thread started by Vovchik if this does not work then will need to look deeper. saying that , think best option will be to use gtk2 + drawing area which has a cairo back end . the gtk option is mentioned in previous page , which is not done as yet. once window and Drawing area is in , the cairo bits from the x11/cairo demo will just need to be copied over, to run one needs to expose the Cairo Context BR Alex Attachments:cairoX2.bac.bz2 (2.33 KB)
|
|
|
Post by rikky on Mar 23, 2021 7:58:15 GMT 1
Oh, very nice. Mouse works also, so you can drag your chart around and so on. If I can use an SVG on that I will start to learn Cairo. Rik. Btw Bigbass, Thanks for the explanation. This is usefull information. I have now TYPEd all my functions.
|
|
|
Post by vovchik on Mar 23, 2021 13:04:00 GMT 1
Dear Alex,
Thanks for cairoX2 - all works fine on Pi4 and Mint.
With kind regards, vovchik
|
|
|
Post by alexfish on Mar 24, 2021 16:01:55 GMT 1
Hi All
Thanks for testing
Now got Pi3 up + side by side with pi4
so will start modding the X11/cairo
Also done a quick demo of gtk drawing area + Ran Riks Seamap GUI to get composite image
the is a bit rough but , as with me again saying, hot of the press
the image is of the Whitby coords
./OpenSeaGui 54.48774 -0.61498 17
I need the run that command Twice , ?
the code as it is of now
PRAGMA OPTIONS `pkg-config --cflags gtk+-2.0 cairo` PRAGMA LDFLAGS `pkg-config --libs gtk+-2.0 cairo`
PRAGMA INCLUDE <gtk-2.0/gtk/gtk.h> PRAGMA INCLUDE <cairo/cairo.h> OPTION PARSE FALSE DECLARE window TYPE GtkWindow* DECLARE button TYPE GtkWidget* DECLARE drawing TYPE GtkWidget*
SUB cairo_rgba(cairo_t * cr,char r,char g,char b,char a) LOCAL R,G,B,A TYPE double R = r/255.0 G = g/255.0 B = b/255.0 A = a/255.0 PRINT R , ":",G,":",B,":" ,A cairo_set_source_rgba(cr , R ,G ,B,A) END SUB
FUNCTION LOAD_PIX() TYPE int LOCAL pixbuf TYPE GdkPixbuf * LOCAL width, height TYPE int
LOCAL surface TYPE cairo_surface_t * LOCAL cr TYPE cairo_t *
cr = gdk_cairo_create ( (GdkDrawable *) drawing->window) cairo_rgba(cr,255,230,0,255) cairo_paint(cr) cairo_save(cr) cairo_restore(cr)
pixbuf = gdk_pixbuf_new_from_file ("/tmp/plotter/17/65311/41779/street.svg",0) width = gdk_pixbuf_get_width (pixbuf) height = gdk_pixbuf_get_height (pixbuf) PRINT width , ":" , height
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0) cairo_paint(cr) cairo_show_page(cr) RETURN TRUE END FUNCTION
'========================== SUB hello '========================== PRINT "Hello BaCon" END SUB
'========================== SUB delete_event '========================== PRINT "That's all folks!" END END SUB
'========================== SUB end_program '========================== PRINT "end" END END SUB
gtk_init(0, 0) window = gtk_window_new (0) gtk_window_set_default_size (window, 600, 400) gtk_window_set_title (window, "cairo")
'---SIGNAL HANDLERS for the window g_signal_connect(window, "delete-event", G_CALLBACK(delete_event), NULL) g_signal_connect(window, "destroy", G_CALLBACK(end_program), NULL)
drawing= gtk_drawing_area_new()
'---PACK THE BUTTON into the window gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(drawing)) gtk_widget_set_size_request (GTK_WIDGET(drawing), 600, 400) g_signal_connect (G_OBJECT (drawing), "expose_event",G_CALLBACK (LOAD_PIX), NULL) gtk_widget_show_all(GTK_WIDGET(window)) ' gtk_main()
BR Alex
|
|
|
Post by rikky on Mar 24, 2021 17:11:39 GMT 1
Well, yes. I had to invent something to be able to feed new coordinates as you move along. I chose to have the first time you start the program as a sort of daemon. The next time the NEW coordinates are feeded to the first program and then exit. The picture of the first program then changes. Or so is the idea. Of course there are millions of other solutions. You have to choose something. investigating your program, but (un)fortunately I am also drinking beer and talking about nothing. If the police comes, then it will take a few days before I report back.
|
|
|
Post by alexfish on Mar 24, 2021 20:01:40 GMT 1
We need a bigger range of smilies
|
|
|
Post by rikky on Mar 25, 2021 8:49:02 GMT 1
Tried everything. Even did a 'fresh instal' sudo apt-get install gtk+-2.0 libgtk2.0-dev glib-2.0 -y it compiles but I still get (Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed -1:-1
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_pixels_with_length: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_rowstride: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_n_channels: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(Cairo_svg:27721): GLib-ERROR **: /build/glib2.0-TptTYn/glib2.0-2.50.3/./glib/gmem.c:328: overflow allocating 4294967295*4294967295 bytes Trace/breakpoint trap If I remark out line 92 then everything works fine. I get a nice window on my screen, and no errors. Except that there is nothing on it. Well this is probably my fault I still have Stretch with Berryboot on my RPi3 There are some weird things with this system. I will try to put OpenPlotter on it, ..again. First time failed.
|
|
|
Post by alexfish on Mar 25, 2021 10:03:07 GMT 1
Hi Rik
Try Install
libgdk-pixbuf2.0-dev
see what happens
BR Alex
|
|
|
Post by rikky on Mar 25, 2021 14:56:15 GMT 1
|
|
|
Post by bigbass on Mar 25, 2021 15:27:08 GMT 1
Hello Rik I tried the demo Alex sent you of your code openseagui with (gtk2 and cairo) from Alex and it works for me I have these installed (if the problem is only pixbuf) gir1.2-gdkpixbuf-2.0 gtk2-engines-pixbuf libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgdk-pixbuf2.0-dev I would suggest for your RPI3 *that you now can use your RPI4 to make the sd for your RPI3 by installing www.raspberrypi.org/documentation/installation/installing-images/sudo apt install rpi-imager even a video to see whats happening 40 seconds www.youtube.com/watch?v=J024soVgEeMselect about@ 1.171GB Raspberry Pi OS with desktop and life will be good for you on the raspberry pi3 again And if something happens you can just make a new sd and be off sailing again quickly Joe
|
|