Jump to content
  • Advertisement
Sign in to follow this  
nerosky

Anyone can help me with this...??

This topic is 4272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im now doing the image processing on BOrland C++ Builder 5... I have capture an image and store the data in a buffer.. But my problem now will to show the image on a form... There is a template TImage in this builder but this template only show/display image from a file and not a buffer.. Is there any way to display the image directly from the buffer or an array in this C++ Builder..??

Share this post


Link to post
Share on other sites
Advertisement
Hi,

My Borland 5 knowledge is a bit rusty but:

Can you not just load it in a TGraphics object with some kind of memory stream.
Assign that object to a TImage: TImage->Assign(tgraphics)

Regards,
EmmetjeGee

Share this post


Link to post
Share on other sites
Here is how I would make an image buffer in C++ Builder

// Create a 640x480 buffer:

#include "Graphics.hpp"
...
Graphics::TBitmap* bitmap = new Graphics::TBitmap();
bitmap->Width = 640;
bitmap->Height = 480;


// Make pixel 10,10 red:

bitmap->Canvas->Pixels[10][10] = clRed;
// or
bitmap->Canvas->Pixels[10][10] = TColor(255, 0, 0);

// After filling the bitmap->Canvas with whatever, you can copy it to another Canvas:

Image1->Stretch = true;
Image1->Picture->Graphic = bitmap;
Image1->Canvas->Draw(0, 0, bitmap);

// or if you need a bit more control
Image1->Canvas->CopyMode = cmSrcCopy;
Image1->Canvas->CopyRect(...);

The canvas object has all the good stuff. I think Builder will show you a drop down list so you can see for yourself.
For example, here is how to draw a blue line on our bitmap:

bitmap->Canvas->Pen->Color = clBlue;
bitmap->Canvas->MoveTo(10, 10);
bitmap->Canvas->LineTo(100, 100);


Something along these lines.

[Edited by - pulpfist on April 6, 2007 10:14:18 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by pulpfist
Here is how I would make an image buffer in C++ Builder

// Create a 640x480 buffer:

#include "Graphics.hpp"
...
Graphics::TBitmap* bitmap = new Graphics::TBitmap();
bitmap->Width = 640;
bitmap->Height = 480;


// Make pixel 10,10 red:

bitmap->Canvas->Pixels[10][10] = clRed;
// or
bitmap->Canvas->Pixels[10][10] = TColor(255, 0, 0);

// After filling the bitmap->Canvas with whatever, you can copy it to another Canvas:

Image1->Stretch = true;
Image1->Picture->Graphic = bitmap;
Image1->Canvas->Draw(0, 0, bitmap);

// or if you need a bit more control
Image1->Canvas->CopyMode = cmSrcCopy;
Image1->Canvas->CopyRect(...);

The canvas object has all the good stuff. I think Builder will show you a drop down list so you can see for yourself.
For example, here is how to draw a blue line on our bitmap:

bitmap->Canvas->Pen->Color = clBlue;
bitmap->Canvas->MoveTo(10, 10);
bitmap->Canvas->LineTo(100, 100);


Something along these lines.




Thanks man... this has being really helpfull... i manage to grab the image ald.. thanks again :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!