Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Example how to setup a correct drawingenvironment.



Hello in the quicktime-list!

I am trying to create an imagefile using the code below.
can anyone give me a hint, how I setup a QDGraphics and
a corresponding ImageDescription, before using the Exporter?
(perhaps some person at apple reading this?)
I am pretty much frustrated by now, from the bad documentation
and the pretty old examples e.g. the ZOO-example which needed
mayor repair from me to get it to work a little bit!

there must be some way to tell the exporter or the graphics,
how many colors, which resolution and so forth...
..has someone an examplecode for this? because working through all
this huge api is not that easy.

regards,
helge.

WebObjects Software-Engineering
University Bamberg
Germany


QDRect areaToUse = new QDRect( 200, 150 );
QDGraphics myDrawingBoard = new QDGraphics( areaToUse );
myDrawingBoard.setBackColor( QDColor.red );
boundaries = myDrawingBoard.getBounds();
width = boundaries.getWidth();
height = boundaries.getHeight();
ovalwidth = 20;
ovalheight = 20;
boundaries.setWidth( width-10 );
boundaries.setHeight( height-10 );
boundaries.setX( boundaries.getX()+5 );
boundaries.setY( boundaries.getY()+5 );
qdg.setForeColor( QDColor.blue );
try {
myDrawingBoard.paintRoundRect( boundaries, ovalwidth, ovalheight );
}
catch( Exception ex ) {
System.out.println( "Main.produceAnImage: Exception ="+ex.getMessage() );
}
ImagePresenter imgpres = ImagePresenter.fromGWorld( myDrawingBoard );
EncodedImage img = imgpres.getImage();
QTHandle qth = QTHandle.fromEncodedImage( img );
ImageDescription imgdesc = new ImageDescription(0);
imgdesc.setFrameCount(1);
imgdesc.setHeight( height );
imgdesc.setWidth( width );
imgdesc.setHRes(new Float(75.0).floatValue());
imgdesc.setVRes(new Float(75.0).floatValue());
imgdesc.setDepth(quicktime.std.StdQTConstants.codecInfoDepth16 );


GraphicsExporter graphicsExporter = new GraphicsExporter(quicktime.std.StdQTConstants.kQTFileTypeJPEG);
//graphicsExporter.setInputGWorld( myDrawingBoard );
graphicsExporter.setInputHandle( qth, imgdesc );
// graphicsExporter.requestSettings();
graphicsExporter.setOutputFile (new QTFile("/tmp/test_changed.jpg"));
// sets the destination for image file
int size = graphicsExporter.doExport();



--
Helge Staedtler
Diplom Wirtschaftsinformatiker, Otto-Friedrich University

Mr. Helge Staedtler
Lehrstuhl f. Wirtschaftspddagogik
Kapuzinerstrasse 25
96047 Bamberg, Germany

Phone: +49 (0) 951 863 27 69
Mail: email@hidden
Url: http://wipaed.sowi.uni-bamberg.de
_______________________________________________
quicktime-java mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/quicktime-java
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.