You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FullFramePixelBuffer.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  16. * USA.
  17. */
  18. package com.tigervnc.rfb;
  19. import java.awt.image.*;
  20. public class FullFramePixelBuffer extends ModifiablePixelBuffer {
  21. public FullFramePixelBuffer(PixelFormat pf, int w, int h,
  22. WritableRaster data_) {
  23. super(pf, w, h);
  24. data = data_;
  25. }
  26. protected FullFramePixelBuffer() {}
  27. public WritableRaster getBufferRW(Rect r)
  28. {
  29. synchronized(image) {
  30. return data.createWritableChild(r.tl.x, r.tl.y,
  31. r.width(), r.height(),
  32. 0, 0, null);
  33. }
  34. }
  35. public void commitBufferRW(Rect r)
  36. {
  37. }
  38. public Raster getBuffer(Rect r)
  39. {
  40. synchronized(image) {
  41. Raster src =
  42. data.createChild(r.tl.x, r.tl.y, r.width(), r.height(), 0, 0, null);
  43. WritableRaster dst =
  44. data.createCompatibleWritableRaster(r.width(), r.height());
  45. dst.setDataElements(0, 0, src);
  46. return dst;
  47. }
  48. }
  49. protected WritableRaster data;
  50. }