15 package com.generalrobotix.ui.view.tdview;
18 import java.awt.image.DirectColorModel;
19 import java.awt.image.MemoryImageSource;
20 import java.util.Vector;
22 import javax.media.format.*;
30 if((format instanceof YUVFormat) || (format instanceof RGBFormat))
33 size = format.getSize();
34 prefFormat =
new RGBFormat(
size,
size.width *
size.height, Format.intArray, format.getFrameRate(), 32, -1, -1, -1, 1, -1, 0, -1);
49 Vector codecList = PlugInManager.getPlugInList(input, output, 2);
50 if(codecList ==
null || codecList.size() == 0)
52 for(
int i = 0;
i < codecList.size();
i++)
54 String codecName = (String)codecList.elementAt(
i);
55 Class<?> codecClass =
null;
59 codecClass = Class.forName(codecName);
60 if(codecClass !=
null)
61 codec = (Codec)codecClass.newInstance();
63 catch(ClassNotFoundException _ex) { }
64 catch(IllegalAccessException _ex) { }
65 catch(InstantiationException _ex) { }
66 catch(ClassCastException _ex) { }
67 if(codec !=
null && codec.setInputFormat(input) !=
null)
69 Format outputs[] = codec.getSupportedOutputFormats(input);
70 if(outputs !=
null && outputs.length != 0)
72 for(
int j = 0;
j < outputs.length;
j++)
73 if(outputs[
j].matches(output))
75 Format out = codec.setOutputFormat(outputs[
j]);
76 if(out !=
null && out.matches(output))
82 catch(ResourceUnavailableException _ex) { }
102 outputData = (
int[])buffer.getData();
103 vf = (RGBFormat)buffer.getFormat();
115 System.err.println(
"Exception " + ex);
118 Image outputImage =
null;
120 int redMask = vf.getRedMask();
121 int greenMask = vf.getGreenMask();
122 int blueMask = vf.getBlueMask();
123 DirectColorModel dcm =
new DirectColorModel(32, redMask, greenMask, blueMask);
124 MemoryImageSource sourceImage =
new MemoryImageSource(
size.width,
size.height, dcm, outputData, 0,
size.width);
125 outputImage = Toolkit.getDefaultToolkit().createImage(sourceImage);
Image createImage(Buffer buffer)
#define null
our own NULL pointer
Codec findCodec(VideoFormat input, VideoFormat output)
boolean converterNotRequired
def j(str, encoding="cp932")
MyBufferToImage(VideoFormat format)
png_infop png_bytep buffer
output(gif_dest_ptr dinfo, int code)