TCanvas - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

TCanvas

MrKMrK Posts: 19Member
How can i Plot a single pixel on a canvas object. For example i want to draw a line but want to draw it manually, plotting each pixel individually.Can i use a TCanvas object by itself? Like drobbing a visual component onto a form or do i have to use the canvas component of another object like Form1.canvas?

Also can anyone help me to model a 3D space on the canvas?

Comments

  • zibadianzibadian Posts: 6,349Member
    : How can i Plot a single pixel on a canvas object. For example i want to draw a line but want to draw it manually, plotting each pixel individually.Can i use a TCanvas object by itself? Like drobbing a visual component onto a form or do i have to use the canvas component of another object like Form1.canvas?
    :
    : Also can anyone help me to model a 3D space on the canvas?
    :
    A canvas is always part of another object. I suggest, that you use a TPaintBox to paint your own images (it is intended for that use). You can use the TCanvas.Pixels property to draw individual pixels.
  • Josh CodeJosh Code Posts: 675Member
    : How can i Plot a single pixel on a canvas object. For example i want to draw a line but want to draw it manually, plotting each pixel individually.Can i use a TCanvas object by itself? Like drobbing a visual component onto a form or do i have to use the canvas component of another object like Form1.canvas?
    :
    : Also can anyone help me to model a 3D space on the canvas?
    :

    If you want to draw a line, it is inefficent to draw it manually using the canvas.pixels property. If you use the canvas of a bitmap, setting and getting colors from pixels can be done much more efficiently with the TBitmap.ScanLine function. This gives you a pointer that you can use to directly access the values of pixels instead of using the hidden getpixel function and setpixel procedure. An example of this is shown in Delphi help.
    I don't clearly understand what you mean by modeling 3D space. There is a tcanvas3D property of some chart component but its not too impressive. If you are serius about creating 3D models and graphics you should get OpenGl units and the DelphiX components that are free on the net.
Sign In or Register to comment.