revisione ortografica e grammaticale
[capturemjpeg.git] / docs / relazione / sources / basic_usage.pde
blobd3b1c53e71fb28da49658b4bd4d51a560307c27e
1 import it.lilik.capturemjpeg.*;
3 private CaptureMJPEG capture;
4 private PImage next_img = null;
6 void setup() {
7   size(400, 300);
8   background(0);
9   capture = new CaptureMJPEG
10         (this,
11          "http://mycamera.foo/image?speed=20"),
12          "user",
13          "password");
14   // or this if you don't need auth
15   // capture = new CaptureMJPEG
16   // (this, "http://mycamera.foo/image?speed=20");
18   capture.startCapture();
19   frameRate(20);
22 void draw() {
23   if (next_img != null) {
24     image(next_img, 0, 0);
25   }
28 // callback method
29 void captureMJPEGEvent(PImage img) {
30   next_img = img;