Advertisement
Guest User

Untitled

a guest
Apr 8th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. package stegsolve;
  2.  
  3. import java.awt.image.BufferedImage;
  4.  
  5. public class StereoTransform
  6. {
  7. private BufferedImage originalImage;
  8. private BufferedImage transform;
  9. private int transNum;
  10.  
  11. StereoTransform(BufferedImage bi)
  12. {
  13. this.originalImage = bi;
  14. this.transNum = 0;
  15. calcTrans();
  16. }
  17.  
  18. private void calcTrans()
  19. {
  20. this.transform = new BufferedImage(this.originalImage.getWidth(), this.originalImage.getHeight(), 1);
  21. for (int i = 0; i < this.originalImage.getWidth(); i++) {
  22. for (int j = 0; j < this.originalImage.getHeight(); j++)
  23. {
  24. int col = 0;
  25. int fcol = this.originalImage.getRGB(i, j);
  26. col = fcol ^ this.originalImage.getRGB((i + this.transNum) % this.originalImage.getWidth(), j) & 0xFFFFFF;
  27. this.transform.setRGB(i, j, col);
  28. }
  29. }
  30. }
  31.  
  32. public void back()
  33. {
  34. this.transNum -= 1;
  35. if (this.transNum < 0) {
  36. this.transNum = (this.originalImage.getWidth() - 1);
  37. }
  38. calcTrans();
  39. }
  40.  
  41. public void forward()
  42. {
  43. this.transNum += 1;
  44. if (this.transNum >= this.originalImage.getWidth()) {
  45. this.transNum = 0;
  46. }
  47. calcTrans();
  48. }
  49.  
  50. public String getText()
  51. {
  52. return "Offset: " + this.transNum;
  53. }
  54.  
  55. public BufferedImage getImage()
  56. {
  57. return this.transform;
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement