src/share/classes/sun/swing/LightweightContent.java

Print this page




  68      *
  69      * @see #paintUnlock
  70      */
  71     public void paintLock();
  72 
  73     /**
  74      * {@code JLightweightFrame} calls this method to notify the client
  75      * application that it releases the paint lock. The client application
  76      * should implement the locking mechanism in order to synchronize access
  77      * to the content image data, shared between {@code JLightweightFrame}
  78      * and the client application.
  79      *
  80      * @see #paintLock
  81      */
  82     public void paintUnlock();
  83 
  84     /**
  85      * {@code JLightweightFrame} calls this method to notify the client
  86      * application that a new data buffer has been set as a content pixel
  87      * buffer. Typically this occurs when a buffer of a larger size is
  88      * created in response to a content resize event. The method reports
  89      * a reference to the pixel data buffer, the content image bounds
  90      * within the buffer and the line stride of the buffer. These values
  91      * have the following correlation.
  92      * <p>
  93      * The {@code width} and {@code height} matches the size of the content







  94      * (the component returned from the {@link #getComponent} method). The
  95      * {@code x} and {@code y} is the origin of the content, {@code (0, 0)}
  96      * in the coordinate space of the content, appearing at
  97      * {@code data[y * linestride + x]} in the buffer. All indices
  98      * {@code data[(y + j) * linestride + (x + i)]} where
  99      * {@code (0 <= i < width)} and {@code (0 <= j < height)} will represent
 100      * valid pixel data, {@code (i, j)} in the coordinate space of the content.



 101      *
 102      * @param data the content pixel data buffer of INT_ARGB_PRE type
 103      * @param x the x coordinate of the image
 104      * @param y the y coordinate of the image
 105      * @param width the width of the image
 106      * @param height the height of the image
 107      * @param linestride the line stride of the pixel buffer
















 108      */
 109     public void imageBufferReset(int[] data,
 110                                  int x, int y,
 111                                  int width, int height,
 112                                  int linestride);



 113 
 114     /**
 115      * {@code JLightweightFrame} calls this method to notify the client
 116      * application that the content image bounds have been changed within the
 117      * image's pixel buffer.
 118      *
 119      * @param x the x coordinate of the image
 120      * @param y the y coordinate of the image
 121      * @param width the width of the image
 122      * @param height the height of the image
 123      *
 124      * @see #imageBufferReset
 125      */
 126     public void imageReshaped(int x, int y, int width, int height);
 127 
 128     /**
 129      * {@code JLightweightFrame} calls this method to notify the client
 130      * application that a part of the content image, or the whole image has
 131      * been updated. The method reports bounds of the rectangular dirty region.
 132      * The {@code dirtyX} and {@code dirtyY} is the origin of the dirty




  68      *
  69      * @see #paintUnlock
  70      */
  71     public void paintLock();
  72 
  73     /**
  74      * {@code JLightweightFrame} calls this method to notify the client
  75      * application that it releases the paint lock. The client application
  76      * should implement the locking mechanism in order to synchronize access
  77      * to the content image data, shared between {@code JLightweightFrame}
  78      * and the client application.
  79      *
  80      * @see #paintLock
  81      */
  82     public void paintUnlock();
  83 
  84     /**
  85      * {@code JLightweightFrame} calls this method to notify the client
  86      * application that a new data buffer has been set as a content pixel
  87      * buffer. Typically this occurs when a buffer of a larger size is
  88      * created in response to a content resize event.



  89      * <p>
  90      * When a scale factor greater than one is set on a {@code JLightweightFrame}
  91      * ({@link JLightweightFrame#setScaleFactor}), an {@link OffScreenHiDPIImage}
  92      * is created to server the pixel buffer.
  93      * <p>
  94      * The method reports a reference to the pixel data buffer, the content
  95      * image bounds within the buffer and the line stride of the buffer.
  96      * These values have the following correlation.
  97      * The {@code width} and {@code height} matches the layout size of the content
  98      * (the component returned from the {@link #getComponent} method). The
  99      * {@code x} and {@code y} is the origin of the content, {@code (0, 0)}
 100      * in the layout coordinate space of the content, appearing at
 101      * {@code data[y * scale * linestride + x * scale]} in the buffer.
 102      * A pixel with indices {@code (i, j)}, where {@code (0 <= i < width)} and
 103      * {@code (0 <= j < height)}, in the layout coordinate space of the content
 104      * is represented by a {@code scale^2} square of pixels in the physical
 105      * coordinate space of the buffer. The top-left corner of the square has the
 106      * following physical coordinate in the buffer:
 107      * {@code data[(y + j) * scale * linestride + (x + i) * scale]}.
 108      *
 109      * @param data the content pixel data buffer of INT_ARGB_PRE type
 110      * @param x the logical x coordinate of the image
 111      * @param y the logical y coordinate of the image
 112      * @param width the logical width of the image
 113      * @param height the logical height of the image
 114      * @param linestride the line stride of the pixel buffer
 115      * @param scale the scale factor of the pixel buffer
 116      */
 117     default public void imageBufferReset(int[] data,
 118                                  int x, int y,
 119                                  int width, int height,
 120                                  int linestride,
 121                                  int scale)
 122     {
 123         imageBufferReset(data, x, y, width, height, linestride);
 124     }
 125 
 126     /**
 127      * The default implementation for #imageBufferReset uses a hard-coded value
 128      * of 1 for the scale factor. Both the old and the new methods provide
 129      * default implementations in order to allow a client application to run
 130      * with any JDK version without breaking backward compatibility.
 131      */
 132     default public void imageBufferReset(int[] data,
 133                                  int x, int y,
 134                                  int width, int height,
 135                                  int linestride)
 136     {
 137         imageBufferReset(data, x, y, width, height, linestride, 1);
 138     }
 139 
 140     /**
 141      * {@code JLightweightFrame} calls this method to notify the client
 142      * application that the content image bounds have been changed within the
 143      * image's pixel buffer.
 144      *
 145      * @param x the x coordinate of the image
 146      * @param y the y coordinate of the image
 147      * @param width the width of the image
 148      * @param height the height of the image
 149      *
 150      * @see #imageBufferReset
 151      */
 152     public void imageReshaped(int x, int y, int width, int height);
 153 
 154     /**
 155      * {@code JLightweightFrame} calls this method to notify the client
 156      * application that a part of the content image, or the whole image has
 157      * been updated. The method reports bounds of the rectangular dirty region.
 158      * The {@code dirtyX} and {@code dirtyY} is the origin of the dirty