Article View: borland.public.cppbuilder.multimedia
Article #464Re: How to draw into a jpeg image
From: Giuliano
Date: Wed, 02 Jun 2004 09:10
Date: Wed, 02 Jun 2004 09:10
45 lines
2373 bytes
2373 bytes
On Wed, 2 Jun 2004 09:48:56 +0200, "Mario Sernicola"
<mariosernicola@nospam.libero.it> wrote:
>Ok, so I've to continue convert JPG into a BMP with an external software,
No, you can make it on the fly. For example, with BCB6 it's pretty seamless.
>I need to draw on TImage canvas in order to catch vertex pixel of a polygon
>that describes a shape contained in TImage. When the vertex are know, I
>don't need BMP anymore.
Please, take the following snippet like a starting point for your further
experiments:
#include <memory>
#include <Jpeg.hpp>
using std::auto_ptr;
void ProcessTheImage( void )
{
// crea una istanza di TJPEGImage e ci carica dentro una immagine
auto_ptr<TJPEGImage> const JPG( new TJPEGImage );
JPG->LoadFromFile( "nome del file.jpg" );
// crea una DIB e gli assegna il contenuto del JPEG precedentemente
// creato
auto_ptr<Graphics::TBitmap> const BMP( new Graphics::TBitmap );
BMP->Assign( JPG.get() );
// Aggiunge una ellisse, giusto per "sporcare" un pochino l'immagine
// originale
BMP->Canvas->Ellipse( 10, 10, 100, 200 );
// assegna di nuovo l'immagine modificata al JPEG
JPG->Assign( BMP.get() );
// Salva su file,
JPG->SaveToFile( "nome del nuovo file.jpg" );
// oppure... assegna il JPEG appena creato ad un componente TImage
Image1->Picture->Bitmap->Assign( JPG.get() );
}
Ciao
Giuliano
Technical Details
Message-ID:
<7s5rb05gt1theg28fcvkmrgd4jla7cvno1@4ax.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40bcd795$1@newsgroups.borland.com> <40bd02cb@newsgroups.borland.com> <40bd8664$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d0fc,57413bdb9b690d15 X-Google-Attributes: gid10d0fc,public From: Giuliano <gcardinali@remove.adhoc.net> Newsgroups: borland.public.cppbuilder.multimedia Subject: Re: How to draw into a jpeg image Date: Wed, 02 Jun 2004 11:10:32 +0200 Message-ID: <7s5rb05gt1theg28fcvkmrgd4jla7cvno1@4ax.com> References: <40bcd795$1@newsgroups.borland.com> <40bd02cb@newsgroups.borland.com> <40bd8664$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 81.72.236.131 X-Trace: newsgroups.borland.com 1086167550 81.72.236.131 (2 Jun 2004 02:12:30 -0700) Lines: 45 Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail