Guest User

Untitled

a guest
Jan 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. byte[] bs = { (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x00, (byte) 0x00,
  2. (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x01,
  3. (byte) 0x10, (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x00, (byte) 0x22,
  4. (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x00, (byte) 0x11, (byte) 0x10, (byte) 0x02,
  5. (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x30, (byte) 0x01, (byte) 0x10,
  6. (byte) 0x22, (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x33, (byte) 0x01,
  7. (byte) 0x10, (byte) 0x22, (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x33,
  8. (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
  9. (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x01, (byte) 0x10,
  10. (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x01,
  11. (byte) 0x10, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
  12. (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x44,
  13. (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x55, (byte) 0x01, (byte) 0x10,
  14. (byte) 0x44, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x55, (byte) 0x01,
  15. (byte) 0x10, (byte) 0x04, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x50,
  16. (byte) 0x01, (byte) 0x11, (byte) 0x00, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55,
  17. (byte) 0x00, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x01, (byte) 0x10,
  18. (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x00,
  19. (byte) 0x00, (byte) 0x11, (byte) 0x11, (byte) 0x11, };*/
  20.  
  21. Color white = display.getSystemColor(SWT.COLOR_WHITE);
  22. Color black = display.getSystemColor(SWT.COLOR_BLACK);
  23. Color yellow = display.getSystemColor(SWT.COLOR_YELLOW);
  24. Color red = display.getSystemColor(SWT.COLOR_RED);
  25. Color green = display.getSystemColor(SWT.COLOR_GREEN);
  26. Color blue = display.getSystemColor(SWT.COLOR_BLUE);
  27. // Create a source ImageData of depth 4
  28. PaletteData palette = new PaletteData(new RGB[] { black.getRGB(), white.getRGB(),
  29. yellow.getRGB(), red.getRGB(), blue.getRGB(), green.getRGB() });
  30.  
  31.  
  32.  
  33. ImageData sourceData = new ImageData(16, 16, 4, palette, 1, b);
  34.  
  35. InputStream in = new ByteArrayInputStream(imageDataByteArray);
  36. BufferedImage bufImg = ImageIO.read(in);
  37. ImageIcon icon = new ImageIcon(bufImg);
  38. myButton.setIcon(icon);
  39.  
  40. contact.setImage(pCur.getBlob(0));
  41. publishProgress("befor compress");
  42. Bitmap image = BitmapFactory.decodeByteArray(contact.getImage(), 0, contact.getImage().length);
  43. ByteArrayOutputStream stream = new ByteArrayOutputStream();
  44. image.compress(Bitmap.CompressFormat.JPEG, 50, stream); //JPEG or what you want
  45. contact.setImage(stream.toByteArray());
  46. stream.close();
Add Comment
Please, Sign In to add comment