Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. testapp.cpp:
  2.  
  3. void testApp::draw(){
  4. ofBackground(255, 255, 255);
  5. ofSetColor(0);
  6.  
  7. ifstream file ("Bin/ExText.txt");
  8.  
  9.  
  10. file >> str;
  11. file.open ("bin/ExText.txt");
  12. cout << endl << str;
  13.  
  14.  
  15.  
  16. do{
  17. file >> gType;
  18. if(gType == "img3.jpg")
  19.  
  20. // myImage.loadImage("images/"+imgName);
  21.  
  22. ofImage myImage; // <--- Load an image
  23. myImage.loadImage("bin/"+imgName);
  24. unsigned char * pix = myImage.getPixels();
  25. int iw = myImage.getWidth();
  26. int ih = myImage.getHeight();
  27.  
  28. /* unsigned char* scaled; // <--- create empty image for scaling
  29. ofTexture tex;
  30. scaled = new unsigned char[w*h*3];
  31. tex.allocate(w,h, GL_RGB);*/
  32. {
  33. file >> imgName >> x >> y >> w >> h;
  34. cout << "img3!"; // for debugging pursposes
  35.  
  36. }
  37.  
  38.  
  39. testapp.h:
  40.  
  41. #pragma once
  42.  
  43. #include "ofMain.h"
  44.  
  45.  
  46. class testApp : public ofBaseApp{
  47.  
  48. public:
  49.  
  50. void setup();
  51. void update();
  52. void draw();
  53.  
  54. void keyPressed(int key);
  55. void keyReleased(int key);
  56. void mouseMoved(int x, int y);
  57. void mouseDragged(int x, int y, int button);
  58. void mousePressed(int x, int y, int button);
  59. void mouseReleased(int x, int y, int button);
  60. void windowResized(int w, int h);
  61. void dragEvent(ofDragInfo dragInfo);
  62. void gotMessage(ofMessage msg);
  63.  
  64. ofImage myImage;
  65.  
  66. string str, gType, imgName, x , y, w, h, x2,y2,w2,h2;
  67.  
  68. unsigned char* data;
  69. ofTexture tex;
  70. ofTexture myImageStr;
  71. int pic;
  72. unsigned char* pix[10];
  73. float alpha = 0;
  74. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement