 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.faces;
25 import java.util.HashMap;
26 import java.util.LinkedList;
27 import java.util.List;
29 import javax.swing.ImageIcon;
30 import org.jetbrains.annotations.NotNull;
50 private final Object
sync =
new Object();
99 final int faceNum = face.getFaceNum();
100 if (faceNum <= 0 || faceNum > 65535) {
105 synchronized (
sync) {
127 final int faceNum = face.getFaceNum();
141 private void faceReceived(
final int faceNum,
final int faceSetNum,
final byte @NotNull [] data) {
142 synchronized (
sync) {
145 System.err.println(
"received unexpected image for face "+faceNum);
168 final ImageIcon originalImageIcon;
170 originalImageIcon =
new ImageIcon(data);
171 }
catch (
final IllegalArgumentException ex) {
172 System.err.println(
"Invalid .png data for face "+face+
": "+ex.getMessage());
176 if (originalImageIcon.getIconWidth() <= 0 || originalImageIcon.getIconHeight() <= 0) {
void addFaceReceivedListener(@NotNull AskfaceFaceQueueListener listener)
Registers a listener to be called whenever a face has been received.
final List< Face > pendingFacesQueue
The same elements as pendingFaces in query order.
final Map< Integer, Face > pendingFaces
Face numbers for which an "askface" command should be sent.
void faceReceived(final int faceNum, final int faceSetNum, final byte @NotNull[] data)
Notifies the askface manager that image information have been received from the server.
Utility class for creating FaceImages instances.
void sendAskface()
Sends some pending "askface" commands.
Interface for classes that allow sending "askface" commands.
void fireFaceLoaded(@NotNull final Face face, @NotNull final FaceImages faceImages)
Notify all listener with FaceQueueListener#faceLoaded(Face, FaceImages).
void sendAskface(int faceNum)
Sends an "askface" command.
AskfaceFaceQueue(@NotNull final AskfaceQueue askfaceQueue)
Creates a new instance.
void loadFace(@NotNull final Face face)
Request a face.
final Object sync
The object use for synchronization.
static FaceImages newFaceImages(@NotNull final ImageIcon originalImageIcon)
Creates a new FaceImages instance from an "original" face; the "scaled" and "magic map" sized images ...
void processFaceData(@NotNull final Face face, final byte @NotNull[] data)
Processes face information received from the server.
void reset()
Reset the processing: forget about pending faces.
void fireFaceFailed(@NotNull final Face face)
Notify all listener with FaceQueueListener#faceFailed(Face).
A FaceQueue requesting faces by "askface" commands sent to the Crossfire server.
static final int CONCURRENT_ASKFACE_COMMANDS
The maximum number of concurrently sent "askface" commands.
final Map< Integer, Face > pendingAskfaces
Face numbers for which "askface" commands have been sent without having received a response from the ...
Abstract base class for classes implementing FaceQueue.
final AskfaceQueue askfaceQueue
The connection to use.