|
Post by bigbass on Jan 29, 2018 9:15:35 GMT 1
Hey Guys We may run into this type of problem again somewhere else and here is a possible solution made a demo from this info www.fltk.org/articles.php?L415+I0+T+P1+Q'ported from '---http://www.fltk.org/articles.php?L415+I0+T+P1+Q 'by bigbass
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Box.H> PRAGMA INCLUDE <FL/Fl_Button.H> PRAGMA INCLUDE <FL/Fl_Group.H>
PRAGMA LDFLAGS -lfltk -lfltk_images -L. -lbacon++ PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith OPTION PARSE FALSE
DECLARE win TYPE Fl_Double_Window* DECLARE icon ,msg , r TYPE Fl_Box* DECLARE btns TYPE Fl_Group* DECLARE ok TYPE Fl_Button*
'*=========================================* 'H *=============================* H 'H H No Memory ----> H H 'H *=============================* H 'H *=====* *========* H 'H H ! H H STAY! H H 'H *=====* *========* H '*=========================================* win = new Fl_Double_Window(300, 100) '--- X Y W H icon = new Fl_Box(0, 0, 50, 50, "!")
'--- give the msg some extra space to stretch from 50--->250 msg = new Fl_Box(50,0, 250,50, "No Memory ----> ")
'--- parenting group btns = new Fl_Group(50, 50, 250, 50) ok = new Fl_Button(200, 50, 100, 50, "STAY!") '--- invisible box "r" '--- X Y W H r = new Fl_Box(50, 50, 150, 50) '--- make sure its invisible r->hide()
'--- make "R" parent group resizable 'comment out next line to see the button deform its size btns->resizable(r) btns->end() win->resizable(msg) win->end() win->show(argc, argv) Fl::run()
|
|
|
Post by vovchik on Jan 29, 2018 13:47:17 GMT 1
Dear Joe (and Peter), Thanks for that demo. I think I have more or less finished with the rudiments of TEXT_SVG and will now work on rotation, before incorporation into hug-fltk. Here is the latest, with 16 effects. I think that suffices for most purposes -- if you have to create a logo for a game or other app and you want some nice eye-candy. Incidentally, effects 6 (Lumi) and 15 (Icy) aren't the same (one has more alpha seepage, which you can't really see on an aqua background). With kind regards, vovchik Attachments:
text-svg-16fx.tar.gz (19.23 KB)
|
|
|
Post by Pjot on Jan 29, 2018 16:25:35 GMT 1
Thanks vovchik,
All works nicely on my 64bit Linux now, using FLTK 1.3.4.
BR Peter
|
|
|
Post by bigbass on Jan 29, 2018 18:06:10 GMT 1
Hey vovchik Since we may have default fltk users until we have the official upgrade I will try to make 1.3.3 compatible versions for 64 bit too here is all your work only *minor math edits and a resize forced the window size a minimum range this fixed the bug on 64 bit still room to tweak but the idea works P.S could you test on your box and see if it works with the latest version too the X size is a little bigger but you can see nicely without the pixel garbage showing though if it was a single text line all would show cleanly without an x offset fix win->size_range(win->w(), win->h(),0,0) ' TEXTSVG(txt, font, height, weight, stroke-width, filter-effect, color1, color2, opacity, rotation) ' version 1.3.3 compatible INCLUDE hug-fltk.bac INCLUDE function_text_svg.bac
DECLARE win TYPE Fl_Double_Window* DECLARE box, vsep TYPE Fl_Box* DECLARE svgtext[15] TYPE Fl_Box* DECLARE bg_img TYPE Fl_RGB_Image* DECLARE bg$ TYPE STRING DECLARE ii TYPE int bg$ = "<svg width='580' height='660' viewBox='0 0 3 3' " \ " preserveAspectRatio='none'> " \ "<image x='0' y='0' width='3' height='3' " \ "xlink:href='data:image/png;base64," \ "iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAIAAADZSiLoAAADAFBMVEUAAAD/" \ "AAAA/wD//wAAAP//AP8A///////b29u2traSkpJtbW1JSUkkJCTbAAC2AACS" \ "AABtAABJAAAkAAAA2wAAtgAAkgAAbQAASQAAJADb2wC2tgCSkgBtbQBJSQAk" \ "JAAAANsAALYAAJIAAG0AAEkAACTbANu2ALaSAJJtAG1JAEkkACQA29sAtrYA" \ "kpIAbW0ASUkAJCT/29vbtra2kpKSbW1tSUlJJCT/trbbkpK2bW2SSUltJCT/" \ "kpLbbW22SUmSJCT/bW3bSUm2JCT/SUnbJCT/JCTb/9u227aStpJtkm1JbUkk" \ "SSS2/7aS25Jttm1JkkkkbSSS/5Jt221JtkkkkiRt/21J20kktiRJ/0kk2yQk" \ "/yTb2/+2ttuSkrZtbZJJSW0kJEm2tv+SktttbbZJSZIkJG2Skv9tbdtJSbYk" \ "JJJtbf9JSdskJLZJSf8kJNskJP///9vb27a2tpKSkm1tbUlJSST//7bb25K2" \ "tm2SkkltbST//5Lb2222tkmSkiT//23b20m2tiT//0nb2yT//yT/2//bttu2" \ "kraSbZJtSW1JJEn/tv/bktu2bbaSSZJtJG3/kv/bbdu2SbaSJJL/bf/bSdu2" \ "JLb/Sf/bJNv/JP/b//+229uStrZtkpJJbW0kSUm2//+S29tttrZJkpIkbW2S" \ "//9t29tJtrYkkpJt//9J29sktrZJ//8k29sk////27bbtpK2km2SbUltSSRJ" \ "JAD/tpLbkm22bUmSSSRtJAD/ttvbkra2bZKSSW1tJElJACT/krbbbZK2SW2S" \ "JEltACTbtv+2ktuSbbZtSZJJJG0kAEm2kv+SbdttSbZJJJIkAG222/+Stttt" \ "krZJbZIkSW0AJEmStv9tkttJbbYkSZIAJG22/9uS27ZttpJJkm0kbUkASSSS" \ "/7Zt25JJtm0kkkkAbSTb/7a225KStm1tkklJbSQkSQC2/5KS221ttklJkiQk" \ "bQD/tgDbkgC2bQCSSQD/ALbbAJK2AG2SAEkAtv8AktsAbbYASZIAAAAAAADP" \ "KgIEAAAAKUlEQVQIHQEeAOH/AQDb223b27fc3AJt29u33NwlJCQD7jc3JSQk" \ "AElJ+AYNqV/dpEYAAAAASUVORK5CYII=" \ "'/>" \ "</svg>" bg_img = SVG2IMG(bg$)
' global FLTK settings VISUAL(FL_RGB8) STYLE("gleam") INITFONTS() MK_FONTLIST() SETFONT(FL_HELVETICA, "DejaVu Sans") win = WINDOW("SVG Text: 16 text effects", 680, 680) SETPROPERTY(win, box, FL_GLEAM_UP_BOX) SETPROPERTY(win, color, NAMED2RGB("darkgray")) SETPROPERTY(win, icon, bg_img) box = BOX("", 580, 660)
SETPROPERTY(box, box, FL_NO_BOX) SETPROPERTY(box, image, bg_img) SETPROPERTY(box, align, \ FL_ALIGN_IMAGE_BACKDROP|box->align()) ATTACH(box, 10, 10) vsep = VSEPARATOR(GET(win, h) - 20) ATTACH(vsep, 280, 10) FOR ii = 0 TO 7 svgtext[ii] = TEXT_SVG("My fx: " & STR$(ii), "Arial", \ 64, 500, 3.5, ii, "#535151", "#59A2A2", 0.96, 0) ATTACH(svgtext[ii], 25, ii * 80 + 10) svgtext[ii + 8] = TEXT_SVG("My fx: " & STR$(ii + 8), "Arial", \ 64, 500, 3.5, ii + 8, "#535151", "#59A2A2", 0.96, 0) ATTACH(svgtext[ii + 8], 310, ii * 80 + 10) NEXT ii win->size_range(win->w(), win->h(),0,0) win->resizable(win) SHOW(win) DISPLAY()
|
|
|
Post by vovchik on Jan 29, 2018 19:42:17 GMT 1
Dear Joe (and all),
Your code compiles fine and the result is exactly as in your screenshot. I am surprised that (a) the 1.3.3 tester did not notice the bug before relase and (b) most debs are still 1.3.3, since 1.3.4 has been out for a while. It is easy to compile and install. I did it twice, once for Mint and once for RPI3 Raspbian. I used the following configure line:
./configure --enable-shared --enable-threads --enable-xdbe --enable-xft --prefix=/usr
and then sudo make install.
With kind regards, vovchik
|
|
|
Post by bigbass on Jan 30, 2018 18:40:15 GMT 1
Hey vovchik Thanks for the suggestion to be on the same page with you with fltk versions I removed the official packages from the install script (I will do it manually now ) it is important we are on the same page making demos and testing code I have this script I use and you can see exactly how my box is set up always if you remember long ago when we were setting up different versions of mint to debug why somethings weren't working with different desktops I keep it all organized and easy to upgrade basic-converter.proboards.com/post/10826Joe
|
|
|
Post by bigbass on Jan 30, 2018 21:22:51 GMT 1
Hey vovchik
All the html label work you did is excellent! Now we have high quality looking widgets and I know there are still many undiscovered advantages that will come from this
maybe even partial widgets in widgets using html
all is possible ... just have to try
Joe
|
|
|
Post by vovchik on Jan 30, 2018 22:21:04 GMT 1
Dear Joe, One nice little feature of html text is that we can use <b>, <i>, <u>, etc (and bulleted lists), and change the color and font of certain words in a text, so html markup brings nice advantages. With kind regards, vovchik
|
|
|
Post by bigbass on Jan 31, 2018 9:10:14 GMT 1
Hey Guys I still think there is a reason to show one more resize with a little math demo of placement I made this so you could test with the official docs as a reference and experiment a bit show the widget placement first two values of x and y I made a widget demo that has the same values with callbacks www.fltk.org/articles.php?L415+I0+T+P1+QWe always have docs to read and piece together something and hope it works but simple code is always the best way to get right to the point
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Box.H> PRAGMA INCLUDE <FL/Fl_Button.H> PRAGMA LDFLAGS -lfltk -lfltk_images -L. -lbacon++ PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith OPTION PARSE FALSE
SUB E_CB(Fl_Widget* o, void*) PRINT "E" END SUB
SUB C_CB(Fl_Widget* o, void*) PRINT "C" END SUB
SUB G_CB(Fl_Widget* o, void*) PRINT "G" END SUB
SUB A_CB(Fl_Widget* o, void*) PRINT "A" END SUB
SUB R_CB(Fl_Widget* o, void*) PRINT "R" END SUB
SUB B_CB(Fl_Widget* o, void*) PRINT "B" END SUB
SUB F_CB(Fl_Widget* o, void*) PRINT "F" END SUB
SUB D_CB(Fl_Widget* o, void*) PRINT "D" END SUB
SUB H_CB(Fl_Widget* o, void*) PRINT "H" END SUB
DECLARE WIN TYPE Fl_Double_Window* DECLARE E,C,G,A,R,B,F,D,H TYPE Fl_Button*
WIN = new Fl_Double_Window(300, 150) WIN->box(FL_GLEAM_UP_BOX) E = new Fl_Button(0, 0, 100, 50, "E") E->box(FL_GLEAM_ROUND_UP_BOX) E->labelsize(10) E->callback(E_CB) C = new Fl_Button(0, 50, 100, 50, "C vertical") C->box(FL_GLEAM_ROUND_UP_BOX) C->labelsize(10) C->callback(C_CB) G = new Fl_Button(0, 100, 100, 50, "G") G->box(FL_GLEAM_ROUND_UP_BOX) G->labelsize(10) G->callback(G_CB) A = new Fl_Button(100, 0, 100, 50, "<- A ->") A->box(FL_GLEAM_ROUND_UP_BOX) A->labelsize(10) A->callback(A_CB) R = new Fl_Button(100, 50, 100, 50, "R") R->box(FL_GLEAM_ROUND_UP_BOX) R->labelsize(10) R->callback(R_CB) B = new Fl_Button(100, 100, 100, 50, "<- B ->") B->box(FL_GLEAM_ROUND_UP_BOX) B->labelsize(10) B->callback(B_CB) F = new Fl_Button(200, 0, 100, 50, "F") F->box(FL_GLEAM_ROUND_UP_BOX) F->labelsize(10) F->callback(F_CB) F->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)) D = new Fl_Button(200, 50, 100, 50, "D vertical") D->box(FL_GLEAM_ROUND_UP_BOX) D->labelsize(10) D->callback(D_CB) H = new Fl_Button(200, 100, 100, 50, "H") H->box(FL_GLEAM_ROUND_UP_BOX) H->labelsize(10) H->callback(H_CB)
WIN->end() WIN->resizable(WIN) WIN->show() Fl::run()
|
|
|
Post by vovchik on Jan 31, 2018 14:48:44 GMT 1
Dear Joe (and all), Thanks for that code. Every bit is useful. Here is a little diversion I once did using HUG GTK and just ported it now to FLTK. Porting was pretty easy, by the way, using hug-fltk. Enjoy. With kind regards, vovchik Attachments:
bmsw-fltk-src.tar.gz (15.97 KB)
|
|
|
Post by bigbass on Jan 31, 2018 17:09:14 GMT 1
Hey vovchik Compiled cleanly and runs correctly Nice demo of moving the text with html coloring and it all looks good too we need complex and simple demos to show how to get started and how to give it a finished look I believe we both have a lot of things to do I went through many official gtk2 and gtk3 widgets in C and made stand alone code for testing each widget in bacon one by one but gtk is so ugly however fltk even though its a bit odd to start with is much cleaner and right to the point and once you pass the class hurdle it is easy to keep original fltk code classes and call them from bacon making life MUCH easier to port code quickly and as a big bonus we get fluid GUI too I really like working with fluid Hope I can help out and add some of that to the mix later you have hundreds of demos you did and if they were updated at least the ones you want to update in the end we are much better off than when we started with this a long time ago I believe all the pieces have finally fallen in place and it is all FUN again I look forward to your demos and code ideas Joe
|
|
|
Post by bigbass on Feb 3, 2018 17:15:38 GMT 1
Hey Guys If we are going to compile fltk why not go DEV version and get the latest SVG going too www.fltk.org/software.php?VERSION=1.3.4&FILE=fltk/snapshots/fltk-1.4.x-r12643.tar.gzThis makes svg very easy (why not go cutting edge ) '---ported from
'--- http://seriss.com/people/erco/fltk/ '--- Demonstrate how to use FLTK's nanosvg support (new in 1.4.0) --erco 10/29/2017 '--- to bacon by bigbass show a simple demo inline svg very easy to use this
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Box.H> PRAGMA INCLUDE <FL/Fl_SVG_Image.H> PRAGMA INCLUDE <FL/Fl_Shared_Image.H> PRAGMA LDFLAGS -lfltk -lfltk_images -L. -lbacon++ PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith OPTION PARSE FALSE
DECLARE WIN TYPE Fl_Double_Window* DECLARE BOX TYPE Fl_Box* DECLARE SVG TYPE Fl_SVG_Image* DECLARE svg_logo$ TYPE STRING svg_logo = \ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \ "<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->\n" \ "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" \ "<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n" \ " width=\"640px\" height=\"480px\" viewBox=\"0 0 640 480\" enable-background=\"new 0 0 640 480\" xml:space=\"preserve\">\n" \ "<path transform=\"rotate(-45 320 240)\" d=\"M282.658,250.271c0,5.31-1.031,10.156-3.087,14.543c-2.059,4.387-4.984,8.152-8.774,11.293\n" \ " c-3.793,3.144-8.477,5.58-14.055,7.312c-5.581,1.731-11.836,2.601-18.767,2.601c-9.968,0-18.605-1.572-25.917-4.713\n" \ " s-13.299-6.986-17.955-11.536l13.812-15.111c4.116,3.684,8.584,6.499,13.405,8.449c4.819,1.95,9.993,2.925,15.518,2.925\n" \ " c5.525,0,9.856-1.219,12.999-3.656c3.141-2.438,4.712-5.769,4.712-9.993c0-2.056-0.3-3.844-0.894-5.361\n" \ " c-0.596-1.517-1.653-2.925-3.168-4.226c-1.518-1.3-3.549-2.519-6.093-3.655c-2.546-1.138-5.768-2.301-9.668-3.494\n" \ " c-6.5-2.056-11.943-4.25-16.33-6.58c-4.387-2.328-7.937-4.9-10.643-7.719c-2.709-2.815-4.659-5.931-5.849-9.343\n" \ " c-1.193-3.412-1.788-7.23-1.788-11.455c0-5.2,1.082-9.831,3.25-13.893c2.166-4.062,5.144-7.5,8.937-10.318\n" \ " c3.791-2.815,8.178-4.956,13.162-6.418c4.981-1.462,10.343-2.193,16.086-2.193c8.449,0,15.842,1.247,22.179,3.737\n" \ " c6.337,2.493,11.997,6.121,16.98,10.887l-12.674,14.624c-7.583-6.281-15.655-9.424-24.21-9.424c-4.875,0-8.721,0.95-11.537,2.844\n" \ " c-2.818,1.896-4.225,4.578-4.225,8.043c0,1.843,0.297,3.412,0.894,4.712c0.594,1.3,1.65,2.519,3.168,3.656\n" \ " c1.516,1.137,3.656,2.249,6.418,3.331c2.763,1.084,6.309,2.33,10.643,3.736c5.306,1.734,10.046,3.631,14.218,5.688\n" \ " c4.169,2.06,7.662,4.524,10.48,7.394c2.815,2.871,4.981,6.174,6.5,9.911C281.898,240.603,282.658,245.071,282.658,250.271z\n" \ " M335.953,260.833l20.637-90.181h27.46l-32.011,112.604h-33.634l-32.173-112.604h28.598l20.311,90.181H335.953z M437.832,286.019\n" \ " c-16.357,0-28.896-5.01-37.615-15.03c-8.722-10.019-13.081-24.779-13.081-44.278c0-9.531,1.407-17.98,4.225-25.348\n" \ " c2.815-7.366,6.688-13.54,11.618-18.524c4.928-4.981,10.668-8.747,17.223-11.293c6.555-2.544,13.568-3.818,21.043-3.818\n" \ " c8.23,0,15.436,1.3,21.611,3.899c6.174,2.6,11.537,5.959,16.086,10.075l-14.137,14.624c-3.467-3.032-6.906-5.281-10.318-6.744\n" \ " s-7.393-2.193-11.941-2.193c-4.01,0-7.693,0.731-11.051,2.193s-6.256,3.793-8.691,6.987c-2.438,3.196-4.334,7.287-5.688,12.268\n" \ " c-1.355,4.984-2.031,10.996-2.031,18.037c0,7.367,0.486,13.567,1.463,18.604c0.975,5.037,2.408,9.1,4.305,12.187\n" \ " c1.895,3.087,4.307,5.309,7.23,6.662c2.926,1.355,6.338,2.031,10.238,2.031c5.631,0,10.613-1.244,14.947-3.737v-25.186h-14.785\n" \ " l-2.6-18.849h43.547v55.57c-5.85,3.793-12.297,6.718-19.336,8.774C453.051,284.987,445.631,286.019,437.832,286.019z M523.5,151.5\n" \ " c0-6.627-5.373-12-12-12h-343c-6.627,0-12,5.373-12,12v150c0,6.627,5.373,12,12,12h343c6.627,0,12-5.373,12-12V151.5z\"/>\n" \ "</svg>\n"
SVG = new Fl_SVG_Image(NULL, (char*)svg_logo) WIN = new Fl_Double_Window(720, 486, "svg test") BOX = new Fl_Box(10,10,720-20,486-20) BOX->image(SVG) WIN->end() WIN->show() Fl::run()
|
|
|
Post by vovchik on Feb 3, 2018 17:27:24 GMT 1
Dear Joe,
I have posted quite of few examples of fltk and nano svg. Nano is fine for simple images but cannot handle text, gaussian filters, patterns, and a few other substantive things. It is for that reason, after lots of testing, I decided to use rsvg and pango/cairo, which is much more flexible and gives us a full svg rendering implementation. Moreover, pango/cairo also gives us cairo surfaces, which we can exploit for markup text and cairo drawing. Nano is OK for the odd simple svg, though.
With kind regards, vovchik
PS. None of those text effects in TEXT_SVG will work with nano, incidentally.
|
|
|
Post by bigbass on Feb 3, 2018 18:17:58 GMT 1
Hello vovchik I am looking at this from a tutorial aspect at the moment just porting the demos to bacon in its simplest form (sometimes we lack a simple snippet just to get the idea quickly) later we can add all kinds of effects and advancements showing a final full featured product I think there is still some room to focus on editing the code in the svg though to replace the look of those ugly xpm icons that we could easily resize too So you know where I am going with the easy svg idea I was thinking about the fluid GUI replacing those micro xpm icons to something easier on the eyes better images in svg but since I have to do that in c++ I want to keep it easy Joe
|
|
|
Post by vovchik on Feb 3, 2018 19:41:03 GMT 1
Dear Joe, I see what you mean. Those xmp icons are small, ugly and hard to distinguish. SVGs would be much better. With some minimal coding, I am certain you could get a modded fluid to compile nicely with 1.3.4, too. G++ will know what to do with the two nano files (nanosvg.h and nanosvgrast.h), and you need to define three pragma options (-DNANOSVG_IMPLEMENTATION -DNANOSVGRAST_IMPLEMENTATION -DNANOSVG_ALL_COLOR_KEYWORDS). And that would amke a nice contribution to fltk in general. With kind regards, vovchik
|
|