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

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 9:27 am

davenull wrote:thank you, but I don't understand what to do now, I'm lost in all those explanations, I really needed a step-by-step guide.
How do I get the files on my Raspi,
where to store,
then to apply tar, ok, but by which command exactly?
Is your RPi connected to the internet? If so you should be able to use

Code: Select all

wget https://www.dropbox.com/s/h37po1q305eab17/shapes_plus.tar.gz
to download it. Or else, since it's a small file there's probably enough room on the boot partition of the SD card. Plug your SD card into your windows machine and copy the file onto it. When you boot up your RPi you can extract the files to your current directory with

Code: Select all

tar xvf /boot/shapes_plus.tar.gz
To delete the archive from /boot you'll probably have to use

Code: Select all

sudo rm /boot/shapes_plus.tar.gz
davenull wrote:and then how to push out all unneeded -lxxx and -Ixxx stuff and substitute by what?
I don't know about geany, but the compile line you gave for compiling to object files (where you pass -c) doesn't invoke the linker so the linker options (-lXXX) aren't required. They are for the final line (where you don't pass -c). It doesn't matter if you do pass them on both, they will be ignored if not needed.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 9:35 am

yes, my Raspi is connected to the internet, I will use the command

Code: Select all

wget https://www.dropbox.com/s/h37po1q305eab17/shapes_plus.tar.gz
then

Code: Select all

tar xvf /boot/shapes_plus.tar.gz
then

Code: Select all

sudo rm /boot/shapes_plus.tar.gz

But my question about Geany was how to get rid of the long parameter list at all, it's not a matter what will be needed if included or not, it's simply much too cluttered and much too much to be stored and written there, it would be fine if it could be simplified to just 1 -lxxx and kust 1 -Iyyy if absolutely still required: anyway, the less, the better.
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 9:38 am

No, the lines with /boot were if you were copying from windows onto the sdcard.

Code: Select all

tar xvf shapes_plus.tar.gz
will be enough after wget.

Unfortunately compile lines do get long, especially when you have multiple libraries to include, that's where Makefiles come in handy. I don't tend to use IDEs, just a decent editor and the command line.
Last edited by Paeryn on Wed Oct 28, 2015 9:41 am, edited 1 time in total.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 9:40 am

tar xvf /boot/shapes_plus.tar.gz
tar: /boot/shapes_plus.tar.gz: Funktion open fehlgeschlagen: Datei oder Verzeichnis nicht gefunden (== no such file or directory)
tar: Error is not recoverable: exiting now
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 9:44 am

See previous post, /boot was for if you were copying to the sdcard from windows.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 10:09 am

ok, I've done all that, seems fine, no more errors.
in which directory is now my altered .c file for graphic shapes test to be loaded by Geany?
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 10:47 am

From the new shapes_plus directory run

Code: Select all

make
sudo make install
to compile and install the library (like I assume you did with ajstarks').

The demo is called demo.c, you can either load it into geany, or compile it from the command line with

Code: Select all

make demo
It flickers a lot due to constantly doing End() calls after the ClearWindow() and each draw call, but you wouldn't normally be doing that so many times in rapid succession. Typical usage is ClearWindow(), draw all objects, End().
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 10:52 am

sudo make install

ERROR:
make: *** No rule to make target 'install'. End.

The test is a performance test, also on different platforms (NXT, EV3, Arduino Mega, Due, Zero, and Teensy, and by different operating systems or fw versions) no screen buffer is allowed for testing reasons.

but I meant:

I'm always using Geany for loading, compiling, and making, and starting files.
Which is the name of the subdir of OPENVG where all your files inclusive the demo file are now in?
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 11:04 am

davenull wrote:sudo make install

ERROR:
make: *** No rule to make target 'install'. End.

The test is a performance test, also on different platforms (NXT, EV3, Arduino Mega, Due, Zero, and Teensy) no screen buffer is allowed for testing reasons.

but I meant:

I'm always using Geany for loading, compiling, and making, and starting files.
Which is the name of the subdir of OPENVG where all your files inclusivethe demo file are now in?
Did you go into the shapes_plus directory with

Code: Select all

cd shapes_plus
before running make? All my files are in that directory, and the directory will be in whichever directory you were in when you downloaded and extracted them.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 11:11 am

ok, I expected everything to be in the openvg dir because to this they are actually belonging... :-/
edit, and: no, I didn't use cd...

now I have this:

pi@raspberrypi ~ $ cd shapes_plus
pi@raspberrypi ~/shapes_plus $ sudo make install
install -m 755 -p libshapes_plus.so /usr/lib/libshapes_plus.so.1.0.0
install: der Aufruf von stat für „libshapes_plus.so“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
Makefile:20: recipe for target 'install' failed
make: *** [install] Error 1
pi@raspberrypi ~/shapes_plus $
Last edited by davenull on Wed Oct 28, 2015 11:30 am, 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

Wed Oct 28, 2015 11:25 am

instead, when I load demo.c to Geany and then press F9, I then get

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "demo" "demo.c" -lshapes -L/opt/vc/lib -lEGL -lpthread -lrt -lwiringPi (im Verzeichnis: /home/pi/shapes_plus)
demo.c: In function ‘int main()’:
demo.c:64:11: warning: variable ‘s’ set but not used [-Wunused-but-set-variable]
float s;
^
demo.c:65:11: warning: unused variable ‘buf’ [-Wunused-variable]
char buf[120];
^
/tmp/ccu2ZoMI.o: In function `test_graphics()':
demo.c:(.text+0x7c): undefined reference to `ClearWindow'
demo.c:(.text+0xb4): undefined reference to `CircleOutline'
demo.c:(.text+0x10c): undefined reference to `RectOutline'
demo.c:(.text+0x13c): undefined reference to `EllipseOutline'
/tmp/ccu2ZoMI.o: In function `main':
demo.c:(.text+0x1fc): undefined reference to `ClearWindowRGB'
demo.c:(.text+0x200): undefined reference to `HideWindow'
demo.c:(.text+0x270): undefined reference to `HideWindow'
demo.c:(.text+0x2a8): undefined reference to `HideWindow'
Kompilierung fehlgeschlagen.
collect2: error: ld returned 1 exit status


something still is messed up, I think....
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 12:00 pm

You need to run make on it's own before sudo make install
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 2:13 pm

pi@raspberrypi ~ $ cd shapes_plus
pi@raspberrypi ~/shapes_plus $ make
gcc -O2 -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -c shapes_plus.c
gcc -L/opt/vc/lib -lGLESv2 -lEGL -shared -o libshapes_plus.so shapes_plus.o
pi@raspberrypi ~/shapes_plus $ sudo make install
install -m 755 -p libshapes_plus.so /usr/lib/libshapes_plus.so.1.0.0
strip --strip-unneeded /usr/lib/libshapes_plus.so.1.0.0
ln -f -s /usr/lib/libshapes_plus.so.1.0.0 /usr/lib/libshapes_plus.so
ln -f -s /usr/lib/libshapes_plus.so.1.0.0 /usr/lib/libshapes_plus.so.1
ln -f -s /usr/lib/libshapes_plus.so.1.0.0 /usr/lib/libshapes_plus.so.1.0
install -m 644 -p shapes_plus.h /usr/include/

Geany, demo.c
F9 (make/build)

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "demo" "demo.c" -lshapes -L/opt/vc/lib -lEGL -lpthread -lrt -lwiringPi (im Verzeichnis: /home/pi/shapes_plus)
demo.c: In function ‘int main()’:
demo.c:64:11: warning: variable ‘s’ set but not used [-Wunused-but-set-variable]
float s;
^
demo.c:65:11: warning: unused variable ‘buf’ [-Wunused-variable]
char buf[120];
^
Kompilierung fehlgeschlagen.
/tmp/ccSD6mYr.o: In function `test_graphics()':
demo.c:(.text+0x7c): undefined reference to `ClearWindow'
demo.c:(.text+0xb4): undefined reference to `CircleOutline'
demo.c:(.text+0x10c): undefined reference to `RectOutline'
demo.c:(.text+0x13c): undefined reference to `EllipseOutline'
/tmp/ccSD6mYr.o: In function `main':
demo.c:(.text+0x1fc): undefined reference to `ClearWindowRGB'
demo.c:(.text+0x200): undefined reference to `HideWindow'
demo.c:(.text+0x270): undefined reference to `HideWindow'
demo.c:(.text+0x2a8): undefined reference to `HideWindow'
collect2: error: ld returned 1 exit status

still don't work :(
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 2:21 pm

You need to add -lshapes_plus after -lshapes to the compiler flags in geany.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 2:22 pm

OMG !
volume 4 of the compiler parameter trilogy.... ;)
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 2:27 pm

:-) When you have lots of include and library paths that one command can easily go on for several lines.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 2:29 pm

Y E S !

HURRAY !!

it works!


Image

Image thanks a lot !
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 2:35 pm

Glad to hear it. If there's any little bits you need adding let me know and I'll do what I can.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 3:56 pm

@Paeryn: I added a add-lib-request to ajstarks' openvg lib, I hope you wouldn't mind ... ;)
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 4:00 pm

That's fine, they would be better as part of the main library rather than separate, if he wants to include them.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 28, 2015 4:35 pm

thank you !Image
#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

Wed Oct 28, 2015 4:58 pm

now to the next level:

would it be possible to have an extra small graphic window additionally on the desktop (e.g., like a console window or a Geany window)?

Having a 1080x620 HDMI screen, It could be wishful to generate a 320x240 or even a 480x320 graphic canvas sub-window to watch both the graphic canvas and the terminal console window simultaneously, side by side!

(I once had something similar on my Windows PC using Borland Delphi and Borland C++ Builder)

Would that be possible on the Raspi, too ?
#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: 3091
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HDMI graphic lib: openvg syntax questions

Wed Oct 28, 2015 5:18 pm

The openvg window can be created smaller, ajstarks's library would need slight modifications to allow you to choose it's size and position rather than the full-screen that it currently is. The openvg window would always be on top of the framebuffer (which is where the terminal and/or X window system is drawn on).
It would be a fair bit of work to get the openvg window to act as if it were inside an X window (still with the problem that other windows wouldn't be able to appear infront of the openvg window).
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

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 Oct 31, 2015 7:51 pm

hey,
I just wanted to share a little example program using some additional API functions:

Code: Select all

int  _scrwidth_, _scrheight_;


#define vgHidewindow  HideWindow
#define vgShowwindow  End
#define vgcls()       ClearWindowRGB(_scrwidth_, _scrheight_, 0, 0, 0);	
#define vgStart       Start
#define vgInit        init 
#define vgCleanup     finish

int      _fontsize_ = 10;
Fontinfo _font_     = MonoTypeface;

inline void setfontsize(int size) { _fontsize_ = size; }

inline void setfonttype(Fontinfo myfont) { _font_ = myfont; }

inline void tftprintxytop(float x, float y, char * buf) {
	Text(x, _scrheight_-y, buf, _font_ , _fontsize_); 
}

inline void tftprintxy(float x, float y, char * buf) {
	Text(x, y, buf, _font_ , _fontsize_); 
}

inline void vgInitgraph() {
	vgInit(& _scrwidth_, & _scrheight_);       // Graphics initialization
    // Clear the window to bHideWindowlack, and set the size for subsequent
    // calls to ClearWindow() and HideWindow()    
    vgStart(_scrwidth_, _scrheight_);   // Start the picture
    vgcls();	
    
    Stroke(255, 255, 255, 1);  // Set these at the start, no need to    
    Fill(255,255,255, 1);      // keep calling them if colour hasn't changed
    setfonttype(MonoTypeface);    
    setfontsize(20);
}


this is how
- to use fonts by explicite setting font types and font sizes and
- 2 simplified printxy functions for Text-Out, counting from bottom to top (more convenient for math coordinates) and from top to buttom (more convenient for tables/charts),
- plus a customizable vgInitgraph() function called at program start.

Share and enjoy! 8-)

Code: Select all

// shaple_plus font test
//

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>

#include "VG/openvg.h"
#include "VG/vgu.h"
#include "fontinfo.h"
#include "shapes.h"
#include "shapes_plus.h"

int _scrwidth_, _scrheight_;

#define vgHidewindow  HideWindow
#define vgShowwindow  End
#define vgcls()       ClearWindowRGB(_scrwidth_, _scrheight_, 0, 0, 0);	
#define vgStart       Start
#define vgInit        init 
#define vgCleanup     finish

int      _fontsize_ = 10;
Fontinfo _font_     = MonoTypeface;


inline void setfontsize(int size) { _fontsize_ = size; }

inline void setfonttype(Fontinfo myfont) { _font_ = myfont; }

inline void tftprintxytop(float x, float y, char * buf) {
	Text(x, _scrheight_-y, buf, _font_ , _fontsize_); 
}

inline void tftprintxy(float x, float y, char * buf) {
	Text(x, y, buf, _font_ , _fontsize_); 
}


inline void vgInitgraph() {
	vgInit(& _scrwidth_, & _scrheight_);       // Graphics initialization
    // Clear the window to bHideWindowlack, and set the size for subsequent
    // calls to ClearWindow() and HideWindow()    
    vgStart(_scrwidth_, _scrheight_);   // Start the picture
    vgcls();	
    
    Stroke(255, 255, 255, 1);  // Set these at the start, no need to    
    Fill(255,255,255, 1);      // keep calling them if colour hasn't changed
    setfonttype(MonoTypeface);    
    setfontsize(20);
}

int main() {
    unsigned long timesav;
    char  sbuf[128];
    char  instr[128];
     
    printf("initializing..."); printf("\n");    
    vgInitgraph();
    
    vgHidewindow();         // Hide the graphic screen      
    tftprintxytop(50,  50, "press key to quit");    
    setfonttype(SerifTypeface); 
    tftprintxytop(50, 100, "press key to quit"); 
    setfonttype(SansTypeface); 
    tftprintxytop(50, 150, "press key to quit"); 
    vgShowwindow();         // Show the graphic screen    
    getchar();
    
    vgCleanup();            // Graphics cleanup    
    exit(0);
}


#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

Sun Nov 01, 2015 10:15 am

next question:

what would be the best way to pass "real color names" to the Stroke(r, g, b, x) function?

#define BLACK {0, 0, 0, 1}
#define WHITE {255,255,255, 1}

is this correct?
Stroke( WHITE );

analoguesly, e.g. for:
#define RED ...
#define BLUE
#define GREEN
#define YELLOW
#define MAGENTA
#define BROWN
#define LIME
#define GRAY

- is there already a list of common widely used colors predefined in openvg ?
#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++”