logo       

Re[2]: wxImage and DataStreams: msg#00040

Subject: Re[2]: wxImage and DataStreams
Il Tue, 9 Dec 2003 18:35:40 +0100 Carsten Zandecki <service@xxxxxxxxxxxxx> ha 
scritto:

  Hello,

> Well, thanx for your help again, Mattia.
> But after testing a lot ,
> i found out that Wx::Image->SetData(); doesen't handle binary data
> correctly
> ...
>
> This is my code :
> 
> # CODE SNIPPED START
> 
> my $file='hoe.bmp';
  If this is a standard Windows bitmap file, well, ->SetData() is not supposed
to handle that. If it is a raw file containing *only* image data, in 24-bit RGB,
then it indeed is a bug. In the latter case *please* send a complete bugreport, 
with
the sample file and a working complete program.

> my $img=Image::Magick->new();
> $img->Read($file);
> my ($w,$h)=$img->Get('width','height');
> 
> my $data;
> my $buf;
> 
> sysopen(BINDAT, $file,O_RDONLY|O_BINARY);
> while (sysread(BINDAT, $buf, 1024)) { $data .= $buf;}
> close(BINDAT);
> 
> $this->{image}=Wx::Image->new($w,$h);
> $this->{image}->SetData($data);
> $this->{bmphandler}=Wx::Bitmap->new($this->{image});
> if($this->{bmphandler}->Ok)
> {  $this->{currentBitmap}->SetBitmap($this->{bmphandler}); }
> 
> # CODE SNIPPET END

  This is how SetData is supposed to be used:

  # creates a red image
  my $image = Wx::Image->new( 50, 50 );
  my $data = "\xff\x00\x00" x ( 50 * 50 );
  $image->SetData( $data );

> It results in corrupt data. An expample output can be seen here :
> http://www.mediaminds.de/error.htm
> 
> My System :
> ActivePerl 5.6.1 ( 635 )
> Windows XP Professional
> Tested with wxPerl 0.16 and wxPerl 0.18 ( No Unicode )

Regards
Mattia



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe