how to draw a image inside Rectangular Figure in GEF editor - eclipse-gef

I have drawn one rectangle by using RectangleFigure in draw2d. Am able to setBackgroundColor,setForegroundColor....How i need to draw a image inside RectangleFigure.
Thanks in Advance.

Extend your figure from org.eclipse.draw2d.ImageFigure class.
In constructor you can pass org.eclipse.swt.graphics.Image which can be passed to super class.

Related

Draw only objects inside canvas - Unity - World Space

Hi Stackoverflow community !
Is there any way to render only objects (Panels, Images...) that are "inside" the canvas.
I thought about using objects' position to see if they're inside the canvas rectangle, but the best would be to also render objects partially when a part of them is inside the canvas.
Like if the canvas was used as a "mask" of visibilty.
Thank you in advance every one ! :)
OuiMerci.
As Stud pointed out, there's an easy to use "Mask" component made for the UI system that works like a charm. :)

How do I attach a text to the vertices of a cube in three.js? Also, Can I add a Text at any point inside the Cube?

I am trying to create a cube using three.js for a project. I need to add text to vertices and at different points inside the cube. Any idea how this can be done?
For some basic code examples of using Sprite objects in Three.js, check out:
http://stemkoski.github.com/Three.js/Sprites.html
And for an easy way to create images that contain text to use as your sprite textures, check out the sample code at:
http://stemkoski.github.com/Three.js/Texture-From-Canvas.html
I think a combination of these two ideas will achieve what you are looking to do.
If you want to have label-style texts, so that the text begins at a specific point, but is always oriented with the camera and easily readable no matter the camera position, you can use sprites. (example of canvas-created text label sprites: http://i.imgur.com/e9I68xD.jpg - here they are rendered on a separate pass to that they are never obscured by the scene but you can do it on the same pass)
If that's what you are looking for, I'd suggest first checking the Sprites examples, and learn to attach some static image as a sprite to correct position in the scene. After you get that working, you modify the code so that you generate the text to an image canvas using standard Javascript Canvas functions, and using that image as the sprite.

save current view to bitmap WP7

I just started to WP7 Dev, and I would like a bit of help on solving this:
I have a Canvas in wich I have 2 StackPanels where I draw like 10 Rectangle. So my question is, how do I save the canvas to a Bitmap?
here is what I want to achieve, that from this:
I get this:
Any help that points me in the right direction would be much appreciated.
What you want to do is to create a WriteableBitmap and then call it's Render method with the UIElement you want to render to it.

Custom Draw in NSView without erasing the previous background

I am trying to plot few points dynamically on my Custom View using Quartz functions so that i get a complete graph. I handle drawing of lines inside the drawRect method of Custom View where I get the current context and draw the lines. But, they get erased when i try to draw a new line. I want to have those lines also visible along with the new ones drawn. Please let me know how to do this. I can't store all the points together and draw at the end. I want to continously update my view. Thanks in advance.
Add a method to your custom view:
- (BOOL) isOpaque { return YES; }
That will prevent the drawing of any views behind yours including the background.
Note, however, that on resize you'll need to redraw everything either way. A more proper solution would be to use off-screen image to draw into instead.
You could use CALayers: add a new child layer to the root each time you have new data, and draw to that layer. Your drawing code can remain the same: you just need to put in the code for creating and using layers, which is actually pretty easy.
See: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514

Best way to animate a circle moving around a screen in Qt?

If I wanted to, using Qt, simply have some circles move around in a white box, or a graphic, what would be the best method of this?
Would I need to draw white/the graphic behind where the circle moved from every time? Is there a simple way of accomplishing this in Qt?
Create QGraphicsView object to your widget and added a QGraphicsScene to view.
Add a QGraphicsEllipseItem to scene
Use QPropertyAnimation to change the "pos" property of the ellipse item.
If you need more advanced features, you can build your own animation class on QPropertyAnimation.
enjoy it:)
Update: You can read Qt's Next Generation UI for more information.
Subclass a QWidget. Start a timerEvent() to animate the positions of the circles, then call update() at the end to schedule a repaint of the widget. Override the widget's paintEvent() - in there you draw your background and circles, using a QPainter object. The Qt Assistant has examples of how to use QPainter.
Qt also has a new animation framework that may facilitate something like this, but I have not looked into it.

Resources