40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
PImage Slide(int notebookID, int pageNumber) {
|
|
PImage leftPage, rightPage;
|
|
PGraphics result;
|
|
String path = notebooks.get(notebookID).notebookpath + "/";
|
|
leftPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber]);
|
|
rightPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber+1]);
|
|
result = createGraphics(width, height);
|
|
result.beginDraw();
|
|
result.image(leftPage, 0, 0, result.width/2, result.height);
|
|
result.image(rightPage, result.width/2, 0, result.width/2, result.height);
|
|
result.endDraw();
|
|
PImage res = createImage(width, height, ARGB);
|
|
res = result.get();
|
|
return res;
|
|
}
|
|
|
|
boolean transition;
|
|
|
|
void nextSlide() {
|
|
transition = true;
|
|
startTransitionTime = millis();
|
|
|
|
if (mode == NORMAL) {
|
|
currentSlideNo+=2;
|
|
if (currentSlideNo > notebooks.get(currentNotebookNo).imagepaths.length-1) {
|
|
currentSlideNo = 0;
|
|
currentNotebookNo++;
|
|
}
|
|
} else if (mode == RANDOM) {
|
|
currentNotebookNo = (int)random(notebooks.size());
|
|
currentSlideNo = (int)random(notebooks.get(currentNotebookNo).imagepaths.length);
|
|
if (currentSlideNo %2 != 0) {
|
|
currentSlideNo -= 1;
|
|
}
|
|
}
|
|
|
|
nextSlide = Slide(currentNotebookNo, currentSlideNo);
|
|
//currentSlide = Slide(currentNotebookNo, currentSlideNo);
|
|
}
|