Draw colorful triangle

Hi all

Could someone give me an example how to draw the triangle colored on the graphics with precise outline, not not using bitmap.

Target BONES: 4.5

Thanks in advance.

Thanks for any answer!

Tags: BlackBerry Developers

Similar Questions

  • Drawing a triangle shape through a script, reading a limits of the selection and the pointer of the mouse?


    It's a little more complicated, I guess...

    dialog sample.jpg

    I am looking for a way to automate the work I do for a manga magazine - cartoon or whatever they are called... I have a dialog box in an oval shape that is already formatted with a style of object to look like the oval in the left part of my image. I would like the script to read the position of the mouse pointer - I ran the script after selecting the oval and the place where the oval must point hover with the mouse... (In the picture so you can imagine my cursor somewhere in the lower left of the image, in the second part of the image corresponding to the angle of the triangle) I imagined this operation in at least two steps, the triangle (arrow) of the oval is a separate object (I would join the two forms later). The triangle can be with streight lines or maybe a little bent, for a most desirable look. I have no idea where to start, for now I create ovals and duplicate the triangle an old and position (+ turn) until I'm happy, after that I could join them. I hope the picture can better explain what I'm looking for.

    I know it is hard work - I think it may be useful for others, as it would be a good challenge for the very smart Scripting Guys of this forum...

    Thank you..

    Maybe you can use a single line to indicate the direction and the location where to that you must point.

    I did Speeech.js to illustrate this approach:




  • Point cloud: color gradient


    I can't find an example where I can create a custom class plot. I have to be able to line the plot of color based on the value of Y and make it look like a smooth gradient. Ideally, I would like to change the size of the line as well. This would allow me to "draw" the 3 variables using a 2D graph. I started (VB.Net):

    Imports NationalInstruments.UI

    Public Class clCustomPlot

    Inherits from point cloud

    Public Sub New()


    End Sub

    Protected / Sub OnBeforeDraw(ByVal sender As Object, ByVal e As NationalInstruments.UI.BeforeDrawXYPlotEventArgs)
    End Sub

    End Class

    But VS tells me that:

    Void of MeasStudioGraphLineColour error 'OnBeforeDraw' cannot be declared 'overrides' because it does not replace a sub in a base class.
    Thanks for your help,


    I got it to work! For all those who are interested, here's a VB.Net custom dispersion diagram that will show you how/color along the line of control.

    Imports NationalInstruments.UI

    Imports System.Drawing

    Imports System.Drawing.Drawing2D

    Public Class clCustomScatterPlot

    Inherits from point cloud

    Private dblMin As Double

    Private dblMax As Double

    Private colMinColour As System.Drawing.Color

    Private colMaxColour As System.Drawing.Color

    Public Sub New (ByVal MinValue As Double, ByVal MaxValue As Double _)

    ByVal MinValueColour As System.Drawing.Color, ByVal MaxValueColour As System.Drawing.Color)


    "no check is performed for the fact that MinValue<>

    dblMin = MinValue

    dblMax = MaxValue

    colMinColour = MinValueColour

    colMaxColour = MaxValueColour

    End Sub

    Protected override void OnBeforeDraw (ByVal e As BeforeDrawXYPlotEventArgs)

    "Clip data, browse the data cut, map and draw."

    Dim intrigues as XYPlot = e.Plot

    Var clippedXData() As Double = Nothing

    Var clippedYData() As Double = Nothing

    parcel of land. ClipDataPoints (clippedXData, clippedYData)

    For i As Integer = 0 To clippedXData.Length - 2

    Protected x 1 Double = clippedXData (i)

    Protected x 2 = Double clippedXData (i + 1)

    Var y1 As Double = clippedYData (i)

    Var y2 As Double = clippedYData (i + 1)

    Dim point1 As PointF = plot. MapDataPoint (e.Bounds, x 1, y1)

    Dim point2 As PointF = plot. MapDataPoint (e.Bounds, x 2, y2)

    Var pen As Pen = New Pen (ValueToColour (y2))

    Dim g As Graphics = e.Graphics

    g.DrawLines (pen, new PointF() {point1, point2})


    e.Cancel = True

    End Sub

    Private Function ValueToColour(ByVal value As Double) As Color

    If value<= dblmin="" then="" return="">

    If value > = dblMax then return colMaxColour

    Pctg As Double = (value - dblMin) / (dblMax - dblMin)

    Dim a, r, g, b As Integer

    a = CInt (CInt (colMinColour.A) + pctg * (CInt (colMaxColour.A) - CInt (colMinColour.A)))

    r = CInt (CInt (colMinColour.R) + pctg * (CInt (colMaxColour.R) - CInt (colMinColour.R)))

    g = CInt (CInt (colMinColour.G) + pctg * (CInt (colMaxColour.G) - CInt (colMinColour.G)))

    b = CInt (CInt (colMinColour.B) + pctg * (CInt (colMaxColour.B) - CInt (colMinColour.B)))

    r = Math.Max (0, r): r = Math.Min (255, r)

    g = Math.Max (0, g): g = Math.Min (255, g)

    b = Math.Max (0, b): b = Math.Min (255, b)

    Return System.Drawing.Color.FromArgb (a, r, g, b).

    Var col As Color = System.Drawing.Color.FromArgb (a, r, g, b).

    Return col

    End Function

    End Class

  • Paint colors

    I can't color to view or print in paint.  Is there a setting somewhere that I have to use?


    With the help of paint

    Paint is a program used to draw, color and change the images. You can use Paint like a digital sketch notebook to make simple photos and creative projects or to add text and other images, such as those taken with your digital camera.

    Read the above info.

    Also read the links 'See also' on the above Web site.

    See you soon.

    Mick Murphy - Microsoft partner

  • HP PSC 1317 AIO - you need a color cartridge to print in black only?


    Just a quick question to run me to the store twice save.

    A totally black HP 56 + HP 57, a color with a little ink left would be enough for printing in bulk in black only? I'm not sure how this works because I was told that some printers draw on the color cartridge to compensate for the dark ?

    Thank you!


    Almost all printers draw color inks to print in black, it is the rule of normal color mixing. We can stop this using 'grey levels' option on the printer or applications (for example, Word...). BUT the printers need color inks to protect the print head (please don't ask me why) that is why they will stop when no good no color ink cartridges installed.

    Kind regards.

  • Impossible to color in the new layer * new user *.


    What I wanted to do was draw/color the hands separately so I used the Lasso tool and describes the hands at Base of layer 1. I used "Layer by copying" to separate the hands.


    When I tried to color in it, I can only color in the previous layer [layer 1 Base] under him as you can see from the layer panel on the right side.3.PNG

    So I tried to block the Base of 1 layer and 'Hide' by pressing on the "eye" icon. And when I wanted to color, this popup came.

    Is there a technique I use to separate just the hands or any part of the image?

    It seems to me, on the layer 1, you can paint the area around the copied area. What will happen if you make a selection of the segment on layer 1, then select > Inverse. You did a selection on layer 1. Did you reverse and Cmd + H to hide this selection?

    I suggest you choose the Base Layer, make your selection, then Cmd + J. He will place the segment on a new layer in a transparent skin and automatically place you on this layer, ready for painting.

  • Triangle without the base.

    I wanted to draw a triangle without the base as one on the roof of a House. So, I drew a triangle and tried somehow to remove the base, but I have had no results. How can I do?


    Then drag the segment of the path with the selection background direct tool, including this anchor in the middle and press the delete key once.

    If you wish, you can get rid of the intermediate Anchor Points, simply by clicking on it with the tool remove an anchor point.

  • Out of the boundaries of drawing

    I have a work at home who want this program:

    Demonstrate the use of the exception handling to catch errors even divide by zero and the drawing out of the limits.
    the program allows the user to get the 3 points, that the program uses to draw a triangle. Then, allow the user to enter a value and use it to scale of the plu triangle or less the geographical center of the JFrame. Make sure you handle the case where a zero entered under scale. Make sure you handle the case where the points of the triangle to go outside the JFrame (throwing an exception!).

    I can draw the triangle, but I don't have an idea how the triangle is off the edge of the JFrame.

    Is there a method or class, or what I can do?

    1001049 wrote:
    I have a work at home who want this program:

    Demonstrate the use of the exception handling to catch errors even divide by zero and the drawing out of the limits.
    the program allows the user to get the 3 points, that the program uses to draw a triangle. Then, allow the user to enter a value and use it to scale of the plu triangle or less the geographical center of the JFrame. Make sure you handle the case where a zero entered under scale. Make sure you handle the case where the points of the triangle to go outside the JFrame (throwing an exception!).

    I can draw the triangle, but I don't have an idea how the triangle is off the edge of the JFrame.

    Is there a method or class, or what I can do?

    This forum is for issues related to the languages of PL/SQL or Oracle SQL.

    What is there to do with one of them this problem or solution?

    How can I ask a question in the forums?
    SQL and PL/SQL FAQ

  • Triangle with rounded corners

    How to draw a triangle with smooth rounded corners and straight walls?


    You can create the triangle with the tool polygon, delivered with the Rectangle tool (click and place the cursor until the other tools fly away), then the effect > esthetics > corners rounded. You can object > decompose the aspect if you have six anchor points.

  • the color scheme does not work as follows.


    Suddenly occurred the following phenomena, using PSE - 9 on Windows 7.

    After you set a white canvas at at the beginning, all drawing colors cannot be choiced but made with gray colors in different light depending on the lightness of the color.

    However, without the Web, they can be chosen as usual. So that I can't use my PES and he might there have found several flaws on the cross on current usage.

    I tried to have it uninstalled, installed recently by WAA and re-powered disc again, but nothing has not improved.

    I'm stuck in distress.

    I am very appreciated if you don't show how to improve the situation. Thank you.

    Change the grayscale to RGB color mode by using the top menu:

    Image > Mode

  • Triangle

    Can anyone help as I would like to create a triangle of the eps with curves (instead of points), but don't know how. I have Illustrator version 8. Could someone do that for me for a tenner as I am unemployed and pretty broke at the moment. I will pay by paypal if anyone can help. I need to open in Illustrator version 8



    You can draw a triangle easily by drawing with the polygon tool and press the cursor down some time reduces the amount of sides to 3.

    Illustrator 8 is old enough then to cut corners, you will have to do it manually as I beliueve the rounded conrers filter does nto exist. You can use the other convert too to round the conrers manually.

  • How to draw an arrow?

    Is there a quick way to draw an arrow in Flash? I saw 2006 assignments who say there is no, but I was wondering if there is a way in CS4?

    Thank you


    Click the polygon tool (click and hold the rectangle/Oval tool if you do not see polystar), select 3 side and draw a triangle.  Adjust the width/height according to your needs and add a line with the line tool or the rectangle.

  • Increase time to shoot 10 000 triangles

    It is a test program to measure the time it takes Flash to draw a triangle 10,000 times.

    The app (code below) called runTimeTest() every N seconds that draws the triangle 10,000 times.

    Now for the "interesting" part: each call takes processor more until after he goes on the 6th or 7th call for "Infinity" (see screenshot of the Task Manager)

    Bug weird or explainable?

    Screenshot: http://i34.tinypic.com/jutpwo.png

    create a canvas draw
    var c:Canvas = new Canvas();
    function onApplicationComplete(e:Event)
    c.Width = width;
    c.Height = height;
    c.x Fokker-built = 0;
    CY = 0;
    addChild (c);
    set a timer to run every 10 seconds
    var: timer = new Timer (10000);
    timer.addEventListener (TimerEvent.TIMER, runTimeTest);
    Timer.Start ();
    function runTimeTest(e:Event)
    It is called every 10 seconds
    var x 0: int, x 1: int, x 2: int;
    var y0:int, y1:int, y2:int;
    whole triangle vertices
    x 0 = 100; Y0 = 500;
    x 1 = 120; Y1 = 515;
    x 2 = 155; Y2 = 500;
    draw a filled triangle 10,000 times
    for (var i: int = 0; i < 10000; ++ i)
    c.graphics.beginFill (0xff0000, 1);
    c.graphics.moveTo (x 0, y0);
    c.graphics.lineTo (x 1, y1);
    c.graphics.lineTo (x 2, y2);
    c.graphics.lineTo (x 0, y0);
    c.graphics.endFill ();

    Tested myself, and indeed it takes an increasing amount of time to draw. Definition of cacheAsBitmap did not help... What you can do however is clearly the figure between loops with: c.graphics.clear (); just before your loop for. With that I get useage processor max 20% on successive draws.

    It takes more time every time is not serious because create you 10 000 vector shapes in your 'canvas' every time... just because they are on top of the other - there are still 10 000 forms in this object. Then 20,000 on the next pole, etc. Once you get 30-40 000 forms in the display list you ask just trouble.

  • OpenGl textures

    Hi, I have a problem with the display of textures in openGL.  There has got to be something silly like an option that I forgot.  I had opengl on the iphone and android.  Really try to understand what I forgot.  The code is based on the example of blackberry: http://docs.blackberry.com/en/developers/deliverables/11942/CS_OpenGLTest_952941_11.jsp

    I took and tried to load a texture on the polygon rather than colors.  I don't see anything, not even a lot of fuzz of color. help please.  code below:

    SerializableAttribute public class OpenGLTestScreen extends FullScreen implements Runnable {}

    Private EGL11 _egl;

    Private EGLDisplay _eglDisplay;

    Private EGLConfig _eglConfig;

    Private EGLSurface _eglSurface;

    Private EGLContext _eglContext;

    private _gl GL10;

    _offscreenBitmap private bitmap;

    private graphics _offscreenGraphics;

    Private FloatBuffer _vertexArray;

    Private FloatBuffer _colorArray;

    Private FloatBuffer mTextureBuffer;

    Private boolean _running;

    Private boolean _paused;

    private int textureId.



    Super (fullscreen. DEFAULT_MENU | FullScreen.DEFAULT_CLOSE);


    private void initialize()


    Get the EGL interface

    _egl = (EGL11) EGLContext.getEGL ();

    Get the EGL display

    _eglDisplay = _egl.eglGetDisplay (EGL11. EGL_DEFAULT_DISPLAY);

    Initialize the display for EGL, null given that we really need not the version

    _egl.eglInitialize (_eglDisplay, null);

    Choose a config EGL

    EGLConfig [] configs = new EGLConfig [1];

    int [] numConfigs = new int [1];

    int [] uploading =


    EGL11. EGL_RED_SIZE, 5.


    EGL11. EGL_BLUE_SIZE, 5.



    _egl.eglChooseConfig (_eglDisplay, uploading, configs, 1, numConfigs);

    _eglConfig = configs [0];

    Create an EGL window surface

    _eglSurface = _egl.eglCreateWindowSurface

    (_eglDisplay, _eglConfig, this, null);

    Create a context of EGL


    float [] vertices =.


    -0.5f, - 0.5f, 0.0F,

    0.5F, 0.5f, 0.0F,

    -0.5f, 0.5f, 0.0F,

    0.5F, 0.5f, 0.0f


    float [] colors =.


    0.0F, 1.0F, 1.0F, 1.0F,

    1.0F, 1.0F, 1.0F, 1.0F,

    1.0F, 1.0F, 1.0F, 1.0F,

    1.0F, 1.0F, 1.0F, 1.0f


    _vertexArray ByteBuffer.allocateDirect = (vertices.length * 4) .asFloatBuffer ();

    _vertexArray.put (vertex);

    _vertexArray.Rewind ();

    _colorArray = ByteBuffer.allocateDirect (colors.length * 4) .asFloatBuffer ();

    _colorArray.put (Colors);

    _colorArray.Rewind ();

    _GL.glColor4f (1.0F, 1.0F, 1.0F, 1.0F);

    _GL.glEnable (GL11.GL_TEXTURE_2D);

    _GL.glEnableClientState (GL10.GL_VERTEX_ARRAY);

    _GL.glEnableClientState (GL10.GL_TEXTURE_COORD_ARRAY);



    _GL.glTexParameterx (GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);

    _GL.glTexParameterx (GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);

    _GL.glPixelStorei (GL10.GL_UNPACK_ALIGNMENT, 1);


    _GL.glEnable (GL10.GL_BLEND);


    _GL.glShadeModel (GL10.GL_FLAT);

    _GL.glBlendFunc (GL10.GL_ONE, GL10.GL_ONE);


    _GL.glShadeModel (GL10.GL_SMOOTH);

    The palette of colors in the bitmap = Bitmap.getBitmapResource ("ap.png");

    IntBuffer m_id = ByteBuffer.allocateDirect (10) .asIntBuffer ();

    _GL.glGenTextures (1, m_id);

    m_Id.Rewind ();

    textureId = m_id.get ();

    _GL.glBindTexture (GL10.GL_TEXTURE_2D, textureId);

    GLUtils.glTexImage2D (_gl, GL10.GL_TEXTURE_2D, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, range, null);

    the color palette = null;

    float [] = {} texCoords

    0, _1.0f,

    _1.0F, _1.0f,

    0, 0,

    _1.0F, 0


    TBB ByteBuffer = ByteBuffer.allocateDirect(texCoords.length * 4);

    mTextureBuffer = tbb.asFloatBuffer ();

    mTextureBuffer.put (texCoords);

    mTextureBuffer.rewind ();

    _GL.glTexCoordPointer (2, GL10.GL_FLOAT, 0, mTextureBuffer);


    Private Sub createEGLContext()


    Create a context of EGL

    _eglContext = _egl.eglCreateContext

    (_eglDisplay, _eglConfig, EGL10. EGL_NO_CONTEXT, null);

    Get the GL interface for our new context

    _GL = (GL10) _eglContext.getGL ();

    Let our new current context


    (_eglDisplay, _eglSurface, _eglSurface, _eglContext);


    Private Sub destroyEGL()


    _egl.eglMakeCurrent (_eglDisplay, EGL10. EGL_NO_SURFACE,


    _egl.eglDestroyContext (_eglDisplay, _eglContext);

    _egl.eglDestroySurface (_eglDisplay, _eglSurface);


    Private Sub handleContextLost()


    Destroy our EGL context

    _egl.eglMakeCurrent (_eglDisplay, EGL10. EGL_NO_SURFACE,


    _egl.eglDestroyContext (_eglDisplay, _eglContext);

    _eglContext = EGL10. EGL_NO_CONTEXT;

    Recreate our EGL context




    * Main render loop.


    public void run()



    While (_running)


    Idle so we are in the background

    If (_paused)


    synchronized (this)






    catch (InterruptedException x) {}





    CPU utilization of butterfly



    Thread.Sleep (20);


    catch (InterruptedException x) {}




    Private Sub renderFrame()


    Do our context and the current surface and search for EGL_CONTEXT_LOST

    If (! _egl.eglMakeCurrent (_eglSurface, _eglSurface, _eglDisplay, _eglContext))


    If (_egl.eglGetError () is EGL11. EGL_CONTEXT_LOST)



    Understand that we are about to begin the OpenGL rendering

    _egl.eglWaitNative (EGL10. (EGL_CORE_NATIVE_ENGINE, _offscreenGraphics);

    Render (_GL);

    Signal that the OpenGL ES rendering is finished

    _egl.eglWaitGL ();

    Swap of the surface of the window on the screen

    _egl.eglSwapBuffers (_eglDisplay, _eglSurface);


    Private Sub render (GL10 gl)


    The value of our GL window

    gl.glViewport (0, 0, getWidth(), getHeight());

    Clean the surface

    gl.glClearColor (0.0F, 0.0F, 0.0F, 1.0F);


    The value of our projection matrix

    gl.glMatrixMode (GL10.GL_PROJECTION);

    gl.glLoadIdentity ();


    (gl, 45.0f, (float) getWidth () / (float) getHeight (), 0.15f, 10.0f);

    Draw our triangle

    gl.glMatrixMode (GL10.GL_MODELVIEW);

    gl.glLoadIdentity ();

    gl.glTranslatef (0.0F, 0.0F, - 3.0F);

    gl.glBindTexture (GL10.GL_TEXTURE_2D, textureId);

    gl.glVertexPointer (3, GL10.GL_FLOAT, 0, _vertexArray);

    gl.glTexCoordPointer (2, GL10.GL_FLOAT, 0, mTextureBuffer);

    gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDrawArrays (GL10.GL_TRIANGLES, 0, 3);



    * Called by the system user interface to paint the screen.


    protected void paint (Graphics g)


    If (_offscreenBitmap! = null)

    g.drawBitmap (0, 0, _offscreenBitmap.getWidth (),

    _offscreenBitmap.GetHeight (), _offscreenBitmap, 0, 0);



    * Called when the visibility of our screen.


    visible @param true if our screen is made visible.

    * false if it is hidden


    protected void onVisibilityChange (boolean visible)


    If (visible)




    on the other






    * Called when the screen is closed.


    public void close()


    _running = false;

    synchronized (THIS) {notifyAll() ;}

    Super.Close ();



    * Guard the back buffer in sync with the size of the screen.


    Private Sub updateBackBuffer()


    If (_offscreenBitmap! = null)


    If (_offscreenBitmap.getWidth () == getWidth() &)

    _offscreenBitmap.GetHeight () is getHeight())

    return; no change necessary


    _offscreenBitmap = new Bitmap (getWidth (), getHeight());

    _offscreenGraphics = Graphics.create (_offscreenBitmap);


    private void pause()


    _paused = true;


    Private Sub resume()


    If (_running)


    Pause the render loop

    _paused = false;

    synchronized (THIS) {notifyAll() ;}


    on the other


    Start the rendering thread.

    _running = true;

    New Thread (this) m:System.NET.HttpListener.start ();




    It turns out that this was not the problem of the config.  This is the way which I myself out the pieces.  OpenGL 1.0 accepts RGBA, while the bitmap read the images as ARGB.  I used a conversion function of:


    These are functions if you wish by themselves.

  • Cut out the portion of the form

    I have minimal experience with Amnesty International and am learning that I will. I have re-trace in Illustrator, a company logo, and I need to know how to do the part of the triangle of the letter has to be transparent? I used the pen tool to trace the outside of the letter A, then used to draw the triangle in the middle... but when I went to create a .png, I noticed that the white triangle is always there. If I don't choose no fill color, so you don't see it at all and the letter A has the hole should be.

    How can I make just the cut in the shape of triangle of the black letter A?

    A cutout.png

    Thank you in advanced for your help!

    Select the outside-A and the triangle, and then choose object > compound path > make...

Maybe you are looking for