Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

printing global palettes

  • Loading branch information...
commit d507c5431c6c699d0a8a172319fe248b7bcff890 1 parent f55b685
@jesusgollonet authored
Showing with 13 additions and 14 deletions.
  1. +12 −10 example/testApp.cpp
  2. +1 −4 example/testApp.h
View
22 example/testApp.cpp
@@ -8,7 +8,7 @@ void testApp::setup(){
gifs.push_back(dcd.getFile());
}
}
- sizeMult = .2f;
+ sizeMult = .3f;
}
//--------------------------------------------------------------
@@ -18,17 +18,19 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
+ float mousePct = (float)mouseY/ofGetWindowHeight();
for (int i = 0; i < gifs.size(); i++) {
- for (int j = 0; j < gifs[i].getNumFrames(); j++) {
- ofSetColor(255, 255, 255, 255);
- gifs[i].drawFrame(
- j,
- j * gifs[i].getWidth() * sizeMult,
- i * gifs[i].getHeight() * sizeMult,
- gifs[i].getWidth() * sizeMult,
- gifs[i].getHeight() * sizeMult
- );
+
+ int frameIndex =MIN((int)( mousePct * gifs[i].getNumFrames()-1), gifs[i].getNumFrames()-1);
+ //printf("frameIndex %i \n", frameIndex);
+ int gifW = gifs[0].getWidth()*sizeMult;
+ int gifH = gifs[i].getHeight()*sizeMult;
+ gifs[i].drawFrame(frameIndex, i * gifW, 0, gifW, gifH);
+
+ for (int j = 0; j < gifs[i].getPalette().size(); j++) {
+ ofSetColor(gifs[i].getPalette()[j].r, gifs[i].getPalette()[j].g, gifs[i].getPalette()[j].b);
+ ofRect(i * gifW + j%15*10, gifH + j/15*10 , 10, 10);
}
}
}
View
5 example/testApp.h
@@ -25,10 +25,7 @@ class testApp : public ofBaseApp{
ofxGifDecoder dcd;
vector <ofxGifFile> gifs;
- float sizeMult;
- vector <ofxGifFrame * > gifFrames;
- vector <ofImage > gifRawFrames;
-
+ float sizeMult;
};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.