Is there a way in java to use Graphics2D API to paint on screen of remote java process?
Any API to stream and deserialize painting instructions?
Or I have to use my own “api call” serialization/deserialization mechanism?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That really depends on the kind of media you’re dealing with. If you’re playing video, the codec you’re using might have be APIs to do this, but you’ll need to search around to find out. Graphics2D is really meant for more primitive painting operations, such as drawing shapes, rendering text, and copying image data from place to place.
If you’re writing your own streaming algorithm, then it could be as simple as defining a
PaintEventclass that does what you need. The idea of thePaintEventclass would be that it contains instructions of what to do. For example, if you draw a circle with radio 50 on the remote system, then rather than transmit the pixel data over the network, it’s much more efficient to transmit a message that basically says, “draw a circle with radius 50” across the network, and have the client render it on their side.A PaintEvent class, I would think, would look something like this:
So, depending on what the
paintOperationIDis, it would treat the data inpaintDetailsdifferently. And unless it’s aOPER_DRAW_TEXToperation, thetextfield would just be ignored.This is one way to do it, anyway. Then you just design a communications protocol around this, to get the data from one place to another.