Is there any way of drawing pie chart in Java ME?
You can draw one pie slice using the fillArc method of the Graphics class.
Yep, you're going to have to go with low-level drawing using Graphics methods such as fillArc , drawLine etc.
if you're using the high-level UI you can create a new Image, get its Graphics object and draw on that or you could just extend CustomItem.
Related
I am working on Geotools and trying to edit an existing layer at run time.
Basically I have a layer which I have added on to a MapContent object, which I then project it on JFrame. Now what I want to know is that can we manually draw some features on this showing on JFrame to edit this layer by drawing some features( which could be either a point or a polygon).
Yes, that is perfectly possible. You will need a Swing tool to handle the drawing and then some way to add any needed attributes to the geometry to make a new feature (see SimpleFeatureBuilder) and then add that to the layer.
Is it possible to create your own Layer?
like:
public class MyLayer extends javax.microedition.lcdui.game.Layer{
(...)
}
i get the error: "Layer() is not public in Layer; cannot be accessed from outside the package."
I wanted to draw some 2D graphics (import javax.microedition.lcdui.Graphics), and on top of that a Sprite coursor. Graphics are mostly still, so there's no need to draw them every time, so i thought layerManager will help me, but with that one i'd need it to be a Sprite or a TiledLayer. Creating my own Layer would solve the problem.
Layer is not designed for extension outside the javax.microedition.lcdui.game package. The error messages is clear about it.
But you may extend TiledLayer or Sprite.
Update
As paint method on both classes is final (pointed by #bartholomew-surma on comments) my above statement is invalid.
Another approach is to create a mutable Image, call getGraphics method, draw the 2D graphics in it and finally paint the sprite.
I am attempting to rotate an MKMapView using MapKit.
I can display a map and rotate it, however not very efficiently. I create an MKMapView larger than the view and rotate it using CGAffineTransformMakeRotation, so the the grey areas behind the view are not visible. Although I have clip subviews checked in Interface Builder, I still have the feeling this is not the correct implementation.
This method does allow me to rotate any annotations displayed as MKPinAnnotationView conforms to the CGAffineTransformMakeRotation function, but I come into problems when trying to add an overlay to the map.
I can place an overlay on using the boundingMapRect property in the class declaration but the image remains unrotated on the display. Is there a way to achieve this? Or alternatively should I be rotating the MKMapView and annotations in a different method?
Thanks in advance for any advice or information.
Are you rotating the map so that it is facing the same way the user is? (i.e. not just North = Up). If so you don't need to do any transformation stuff at all, just set the MKUserTrackingMode to MKUserTrackingModeFollowWithHeading
I'm new to GDI+ programming and am looking for some advice.
I am loading an image from a file and displaying it using the following functions (some pseudo code included):
Gdiplus::Image *i = new Gdiplus::Image(file, other parameters ... );
Gdiplus::DrawImage(i, other parameters ... );
I would like to associate a tooltip with the image. Is there any way that I can automatically set/attach a tooltip to the Gdiplus::Image objact (or any other Gdiplus control that I wish to draw for that matter)?
If not, how can such functionality be achieved? I have looked at CToolTipCtrl in WTL but don't know how to attach it to the Gdiplus::Image.
Thanks in advance.
After investigating this more, I've realised that this is not possible, so to speak. You must use GDI+ to draw your own tool tip my monitoring mouse events to see when it is hovering over something, then using the device context to do the drawing withing the mouse hover event handler.
Greetings all,
Please refer to image at :
http://i48.tinypic.com/316qb78.jpg
We are developing an application to extract cell edges from MRC images from electron microscope.
MRC file format stores volumetric pixel data (http://en.wikipedia.org/wiki/Voxel) and we simply use 3D char array(char***) to load and store data (gray scale values) from a MRC file.
As shown in the image,there are 3 viewers to display XY,YZ and ZX planes respectively.
Scrollbars on the top of the viewers use to change the image slice along an axis.
Here is the steps we do when user changes the scrollbar position.
1) get the new scrollbar value.(this
is the selected slice)
2) for the relavant plane (YZ,XY or
ZX), generate (char* slice;) array for
the selected slice by reading 3D char
array (char***)
3) Create a new QImage*
(Format_RGB888) and set pixel values
by reading 'slice' (using
img->setPixel(x,y,c);)
4) This new QImage* is painted in the
paintEvent() method.
We are going to execute "edge-detection" process in a seperate thread since it is an intensive process.During this process we need to draw detected curve (set of pixels) on top of above QImage*.(as a layer).This means we need to call drawPoint() methods outside the QT thread.
Is it the best wayto use QImage for this case?
What is the best way to execute QT drawing methods from another thread?
thanks in advance,
From documentation of QImage:
Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.
Just create a QPainter on your image and draw what you need.