To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 9877
9876  |  9878
Subject: 
Re: LPub mask generation
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 21 Sep 2004 07:08:23 GMT
Viewed: 
1712 times
  
I forgot a few things.  First of all, you'll also need the TCImageFormat class.
Second, in TCImage, you'll need to comment out the line that looks like so
(unless you want to use my TCBmpImageFormat class):

addImageFormat(new TCBmpImageFormat, true);

Usage would probably also help.  You should be able to do something like so:

TCImage image = new TCImage;
image->setDataFormat(TCRgba8);
image->setSize(width, height);
image->setImageData(buffer);
image->setFormatName("PNG");
image->setFlipped(true);
image->saveFile(filename, staticImageProgressCallback, this);
delete image;

Now, to describe the parts that might not be self-explanatory.  The
setDataFormat lets it know you're using an alpha channel (default data format is
24-bit).  The buffer passed into setImageData is just your raw image data.  It
needs to be in RGBA order, IIRC.  The setFormatName lets it know you want it to
create PNG file.  The only other format name supported at the moment is "BMP",
and that requires you to include the TCBmpImageFormat class.

The setFlipped line says that your image data starts with the bottom line of
data, instead of the top line of data.  If you already have bitmap handling
code, it's probably flipped like this, since BMPs are flipped.  You're welcome
to skip this if you want your data to be top-to-bottom, instead of
bottom-to-top.

The last two parameters of saveFile are optional.  If you give them, your
callback function will be called with the last param as a void* userData param.
Note that this callback is not a stdcall function like Windows callbacks are;
it's the default calling convention (cdecl).

--Travis Cobbs



Message is in Reply To:
  Re: LPub mask generation
 
(...) Both classes are in the TCFoundation directory: TCImage and TCPngImageFormat. To use them directly, you'll also need TCObject and TCAutoreleasePool. However, the only thing they use out of there that I know of is my reference counting stuff, (...) (20 years ago, 20-Sep-04, to lugnet.cad.dev, FTX)

21 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR