2024-05-11 22:10:54 +00:00
|
|
|
#pragma once
|
|
|
|
#include "../shape/Point.h"
|
|
|
|
#include <JuceHeader.h>
|
|
|
|
#include "../shape/Shape.h"
|
|
|
|
#include "../svg/SvgParser.h"
|
|
|
|
#include "../shape/Line.h"
|
|
|
|
|
|
|
|
class OscirenderAudioProcessor;
|
|
|
|
class ImageParser {
|
|
|
|
public:
|
|
|
|
ImageParser(OscirenderAudioProcessor& p, juce::String fileName, juce::MemoryBlock image);
|
|
|
|
~ImageParser();
|
|
|
|
|
|
|
|
void setFrame(int index);
|
|
|
|
Point getSample();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void findNearestNeighbour(int searchRadius, float thresholdPow, int stride, bool invert);
|
|
|
|
void resetPosition();
|
2024-06-02 16:15:04 +00:00
|
|
|
float getPixelValue(int x, int y, bool invert);
|
|
|
|
void findWhite(double thresholdPow, bool invert);
|
2024-06-01 20:50:56 +00:00
|
|
|
bool isOverThreshold(double pixel, double thresholdValue);
|
2024-05-12 20:12:35 +00:00
|
|
|
int jumpFrequency();
|
2024-05-11 22:10:54 +00:00
|
|
|
|
|
|
|
OscirenderAudioProcessor& audioProcessor;
|
|
|
|
juce::Random rng;
|
|
|
|
int frameIndex = 0;
|
|
|
|
std::vector<std::vector<uint8_t>> frames;
|
|
|
|
std::vector<bool> visited;
|
|
|
|
int currentX, currentY;
|
|
|
|
int width, height;
|
|
|
|
int count = 0;
|
2024-06-01 20:50:56 +00:00
|
|
|
};
|