User avatar
Paeryn
Posts: 2634
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Thu Nov 05, 2015 4:45 pm

Which fontinfo files were missing? I've just downloaded the version off github and installed it just in case something from my working directory hadn't been included, everything seems to be working fine. I did a few updates last night that you might not have got when you downloaded but I don't think they should have made any difference (I merged in an update from ajstarks' master which was different from how I'd fixed a problem, and altered the README.md file a bit).

In your own program you are still using the functions that I used in shapes_plus (ClearWindow, HideWindow etc), they are different in my fork of libshapes :-
ClearWindow() is now WindowClear()
ClearWindowRGB() and ClearWindowRGBA() no longer exist - the existing Start(), Background() and BackgroundRGB() all set the clear colour that WindowClear() uses.
HideWindow() is replaced with WindowOpacity(int alpha) where alpha is the opacity for the whole window (going from 0 = transparent to 255 = opaque). You have to put the window back to opaque when you want to re-show it rather than the old method of having it re-appear at the next End(). The advantage is now you can have a semi-transparent window and it doesn't have the side effect of clearing the window's contents.
She who travels light — forgot something.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Thu Nov 05, 2015 5:32 pm

ok, thank you, I missed that the old function names are no longer available.
For fontinfo it might be because I started it by Geany, not by command line.
I'll check it again and report ASAP!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 06, 2015 8:15 am

yes, with the commnd syntax changes it works!

Just for completion,
we now have this:

Code: Select all

initWindowSize(x, y, w, h);
// request window size and position on screen,
// call before init(), size cannot be altered after opening.

Code: Select all

WindowClear();
// clears the window to the last colour given to Background() so
// call that once right at the start (or whenever you want to change
// the background colour)..
// Use in place of Start() to clear the full window and nothing else.

Code: Select all

WindowPosition(x, y);
// Move window to given coordinates, -ve values upto -width,-height allow the window to be partially off the left/top of the screen.

Code: Select all

WindowOpacity(int alpha) //  (going from 0 = transparent to 255 = opaque)
// HideWindow() is replaced with WindowOpacity(int alpha) where alpha is the opacity for the whole window (going from 0 = transparent to 255 = opaque).

Code: Select all

#define HideWindow()  WindowOpacity(0)

Code: Select all

#define ShowWindow()  WindowOpacity(255)

I lost the overview over former commands - are they still the same as before, as once originally described by ajstarks?

Code: Select all

    Start();             
    Init();
    Background();     
    Fill();
    Stroke( );   
    End();         
    Finish();

 
BTW,
has WindowClear() to be callde before or after WindowOpacity() ?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
Paeryn
Posts: 2634
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 06, 2015 11:03 am

Yes all the ajstarks' original functions are there.
You only need to use WindowClear if you want to clear the window. WindowOpacity just alters how the window is blended with the framebuffer below it, it doesn't affect the contents of the window like HideWindow did.
She who travels light — forgot something.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 06, 2015 11:43 am

thanks for clarification!

Now this is for your convienience to drag and drop or copy and paste it for your own documentation purposes 8-)

Code: Select all

initWindowSize(x, y, w, h);
// request window size and position on screen,
// call before init(), size cannot be altered after opening.

Code: Select all

WindowClear();
// clears the window to the last colour given to Background() so
// call that once right at the start (or whenever you want to change the background colour)..
// Use in place of Start() to clear the full window and nothing else.
// You only need to use WindowClear if you want to clear the window.

Code: Select all

WindowPosition(x, y);
// Move window to given coordinates, -ve values upto -width,-height allow the window to be partially off the left/top of the screen.

Code: Select all

WindowOpacity(int alpha) //  (going from 0 = transparent to 255 = opaque)
// HideWindow() is replaced with WindowOpacity(int alpha) where alpha is the opacity for the whole window (going from 0 = transparent to 255 = opaque).
// WindowOpacity just alters how the window is blended with the framebuffer below it, it doesn't affect the contents of the window like HideWindow did.

Code: Select all

#define HideWindow()  WindowOpacity(0)

Code: Select all

#define ShowWindow()  WindowOpacity(255)


additional outlined shapes:

Code: Select all

CircleOutline(x, y, r);       // circles
        
RectOutline(x, y, w, h);      // rectangles        

RoundrectOutline(x, y, w, h, rw, rh)

EllipseOutline(x, y, w, h);   // ellipse

Last edited by davenull on Fri Nov 06, 2015 2:44 pm, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 06, 2015 11:57 am

(updated)


now had you time to think about my proposal for adding color name constants (Decimal Color Codes) to your lib?

Code: Select all

// decimal Color Codes


#define RED         255,  0, 0
#define SIGNRED     175, 30, 45
#define STRAWBERRY  190, 38, 37
#define RASPBERRY   135, 38, 87

#define MAGENTA     255, 0, 255
#define DARKMAGENTA 139, 0, 139
#define ROSE        255, 0, 204
#define PURPLE      160, 32, 240
#define PINK        255, 192, 203
#define DEEPPINK    255, 20, 147

#define YELLOW      255, 255, 0
#define SIGNYELLOW  255, 209, 22
#define LIGHTYELLOW 255, 255, 224
#define PAPAYA      255, 255, 126
#define PEACH       254, 240, 219
#define COPPER      184, 115, 51
#define LIGHTCOPPER 237, 195, 147
#define GOLD        255, 215, 0
#define ORANGE      255, 102, 0
#define SIGNORANGE  221, 117, 0
#define TANGERINE   255, 114, 22
#define SALMON      250, 128, 114
#define APRICOT     251, 161, 108

#define LIME          0, 255, 0
#define SIGNGREEN     0, 107, 87
#define GREEN         0, 128, 0
#define LIGHTGREEN  144, 238, 144
#define DARKGREEN    47,  79, 47
#define MINTGREEN   189, 252, 201

#define CYAN          0, 255, 255
#define LIGHTCYAN   224, 255, 255

#define BLUE          0,  0, 255
#define SIGNBLUE      0, 63, 135
#define DARKBLUE      0,  0, 139
#define NAVY          0,  0, 128
#define ULTRAMARINE  18,  10, 143
#define SKYBLUE     135, 206, 235
#define LIGHTBLUE   173, 216, 230
#define BLUEBERRY   117, 161, 208
#define AQUA        102, 204, 204
#define AQUAMARINE  112, 219, 147
#define VIOLET      143,  94, 153
#define WILDVIOLET  130,  11, 187

#define BROWN       128,  42, 42
#define SIGNBROWN    96,  51, 17
#define OCHRE       204, 119, 34
#define BRONZE      140, 120, 83

#define BLACK         0,  0,  0
#define WHITE       255, 255, 255
#define GRAY25       64,  64, 64
#define GRAY50      127, 127, 127
#define GRAY75      191, 191, 191
#define LIGHTGRAY   211, 211, 211
#define SILVER      192, 192, 192

source: http://www.december.com/html/spec/colordeccompact.html

what do you think about it?

(updated)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 06, 2015 7:08 pm

is it not possible to drop all those parameters for compile and build?

why is it not possible to just
#include <openvg.h>
and nothing else, and use them system-wide?

not like this medium-sized novel:

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -c "%f" -lshapes -lpthread -lrt -lwiringPi

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "%e" "%f" -lshapes -L/opt/vc/lib -lOpenVG -lEGL -lpthread -lrt -lwiringPi

Just as I
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

and nothing else for this purpose to use them system-wide ?
?

I hate those endless -l*** -I*** lines, can't the openvg libs just be included statically just by #include in the proprietary C source code?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
Paeryn
Posts: 2634
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Sat Nov 07, 2015 1:34 am

If you get rid of all the include directory parameters on the command line then you need some other way of telling the compiler where they can be found. You can't always put things like that in the usual paths that gcc searches by default because sometimes you need to be able to use different versions of the same include files, so you need some way of telling the compiler which set to use at compile time - hence storing them in paths that aren't searched by default.

You can probably get rid of two of the longer include parameters (-I/opt/vc/include/interface/vmcs_host/linux and -I/opt/vc/include/interface/vcos/pthreads) in what you are doing as they are mainly needed for interfacing with the VC4 but libshapes is handling that for you (creating and handling the window).

Usually people make use of tools like Make or more advanced IDEs that can easily handle long lists of parameters.

There is no linkage between a header file and an object file, that's just the way it is with C. There's no mechanism for a header file to tell the linker what the required object file(s) is/are, you might even have different versions of a library that share common header files.

Oh, and as to the colours - I'd rather not just add in colour names in #defines, I've an idea though that should also improve on the constant create/delete paint mechanism currently used.
She who travels light — forgot something.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Sat Nov 07, 2015 7:57 am

1st, about the color codes:

but if you don't use #include, would it be possible then to access colors by color identifiers like e.g.,

MAGENTA
DARKMAGENTA
ROSE
PURPLE
PINK
DEEPPINK

and nevertheless, will it be then also possible to #define one's own proprietary colors like, e.g.
PALEEGGSHELL
or
INDIANSUMMERRED

as easy and quick as done by #defines?
(IMO, #defines are a perfect way to handle this issue though... )
----------------------------------------------------------

2nd,
is it not possible to put all and everything which has to be included for openvg into 1 standard subdir
/pi/openvg/libraries
or
/pi/C/libraries/

and then define system wide paths like for the Windows environment
path=/pi/openvg/libraries; /pi/C/libraries/
in which the compiler searches it's libs automatically?

like Arduino searches all it's libs automatically in
c:\program files\arduino\libraries\
?

And in case of concurrent versions, just define exact pathnames with the #includes

#include "/pi/openvg/libraries/*.*"
or
#include "/pi/openvg/libraries/shapes_old"
#include "/pi/openvg/libraries/fonts_new"
#include "/pi/openvg/libraries/whatever"


but anyway, drop those endless lines of humorless and annoying tons of parameters for compile and build, nevertheless remaining just 1 simple short command line configuration to work with Geany as I won't ever use this confusing "make" or "makefile" or "make install" ?
No dynamical linking by -l and -I any more for now and for ever?
(BTW, just encountered even 1 more of those effing parameters to be included. i.e.
-lrotaryencoder.c
(WTF!!)

just at most
g++ -Wall -c "%f" -lpthread -lrt

( I wish I could even drop that -lpthread and -lrt if possible, because it finally is already included by
#include <pthread.h>)


:?:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
Paeryn
Posts: 2634
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Sat Nov 07, 2015 12:36 pm

davenull wrote:drop those endless lines of humorless and annoying tons of parameters for compile and build, nevertheless remaining just 1 simple short command line configuration to work with Geany as I won't ever use this confusing "make" or "makefile" or "make install" ?
No dynamical linking by -l and -I any more for now and for ever?
Good luck on ever managing anything more than a simple single file project then. Geany itself recommends using make to handle building C programs comprising more than one source file or complex command line parameters.
A lot of the time a simple makefile is all that is needed, it's not rocket science and then your simple short command line gets even simpler - make.
davenull wrote:(BTW, just encountered even 1 more of those effing parameters to be included. i.e.
-lrotaryencoder.c
Did you type that correctly? You're linking in a library named "rotaryencoder.c"?
She who travels light — forgot something.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Sat Nov 07, 2015 12:49 pm

yes, I think it's this way - but I think I won't use that lib anyway, it's too confusing with those structure instances.

but about Geany: I will stick to it, never using make, but then compellingly having to endure these tons of parameters

:( *sigh* how awesome it was to work with the Ardiuino IDE instead *sigh* :(
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
ajstarks
Posts: 129
Joined: Fri Jun 22, 2012 2:14 am

Re: HDMI graphic lib: openvg syntax questions

Tue Nov 10, 2015 10:03 am

@devnull: you may be interested in the Go version of the OpenVG library.

It contains some of the features you have requested (like named colors), and offers a different programming workflow than C. (as has been stated, the conventional method is to use Makefiles for C development.)

In Go you just: say "go install" or "go build" and you don't worry about include paths and such.
In your program you simply write import "github.com/ajstarks/openvg".

The go-client directory of the repo has example programs.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Tue Nov 10, 2015 11:24 am

is Go accessable by gcc C/C++ and the Geany IDE ? (as I actually understood, it wouldn't be...)
Finally all my programs are coded in C and edited and compiled and built via Geany!

(the display task of course is just an infinitesimal tiny part of the whole project, just in order to display all the calculated values and to draw graphs and maps of the environment)

anyway, thankfully to your basic lib and Paeryn's extensions, there are just minor problems currently which are due to my poor skills about Linux and embedded C more in general (I'm more used to simplificated programming environments of bytecode interpreters and /or the Arduino C/C++ Sketch IDE) :roll:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
ajstarks
Posts: 129
Joined: Fri Jun 22, 2012 2:14 am

Re: HDMI graphic lib: openvg syntax questions

Wed Nov 11, 2015 9:55 am

I understand your affinity for simple programming environments.
I'm a fan of environments like Processing (http://processing.org)

For doing graphics programming on the web there is SVGo with svgplay: (https://github.com/ajstarks/svgo) See the Graphics Sketching with SVGo and svgplay section of the README. See also: http://mindchunk.blogspot.com/2011/05/s ... fonts.html

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Wed Nov 11, 2015 10:27 am

yes, Processing is great and it finally was also already the "mother of invention" to the Arduino IDE and API (Wiring / Sketch), although the underlying C language itself which Arduino is using is perfecty applying to the C standards, which is a really quick and powerful language, much more powerful than Python, and for Arduino also providing a really simple API and a really simple IDE.

Also using 3rd party libs is extremely simple: just copy them into the arduino\libraries installation folder and #include them in your program - that's it !!

I wish we had this Arduino-like Wiring/Processing IDE for Raspberry, providing a full ANSI C functionality, and feat. easy-to-use API-wraps around all the overcomplicated and obfuscating C configuration stuff!

Actually I needed this quick and poweful C functionality, I wrote all my programs in C for my Arduinos, and I wish I could do this for Raspberry Pi too, by a simple IDE and API - then I could focus on my own coding and didn't have to struggle with the basic lowest-level embedded-C implementations before... :-/
Processing.jpg
Processing.jpg (14.31 KiB) Viewed 1579 times
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
ajstarks
Posts: 129
Joined: Fri Jun 22, 2012 2:14 am

Re: HDMI graphic lib: openvg syntax questions

Fri Nov 13, 2015 5:51 pm

Recently announced: Processing for Raspberry Pi

https://www.raspberrypi.org/blog/now-av ... rocessing/

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI graphic lib: openvg syntax questions

Thu Nov 26, 2015 3:56 pm

yes, at the 1st glance it looks quite Arduino-IDE-like ("Wiring"), but it provides by far less features than the Arduino IDE and API (e.g., no multitasking)
and additionally:
unfortunately it's not C but Java.... :(
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Return to “C/C++”