Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

PNG Decoder v0.1 (Source Code)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PBWin PNG Decoder v0.1 (Source Code)

    Object Based PNG decoder. Test Project.

    Uses ZLIB for it's inflate. A compatible include can be found at http://www.powerbasic.com/support/do...les/PBZLIB.zip

    The descustion thread can be found at 'Forum\Programming with Objects\PNG Decoder v0.1 (Descusion Thread)'

    Code:
    '=================================================================================
    'PNG Decoder Copyright (C) 2009 by Cory A Marshall
    'See "Legal Stuff" for details
    '
    'PNG V1.2 specifcation can be found at http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html
    '	PUBLIC Object calls are
    '		CheckCrc		Controls the checking of CRC values during chunk scanning.  Both GET and SET supported.  False is default (no checking).
    '		LoadPNG(File)		Opens and loads a png's file into memory.
    '		CopyToBitMap(hBmp)	Copy's the internal 64bit color image into a windows BitMap at 24bit color
    '		lHeight			Returns the Height of the Image in pixels
    '		lWidth			Returns the Width of the image in pixels
    '
    '	PRIVATE Objects
    '		Create					Sets up varibles and tables for use.
    '		Distroy					Releases tables from memory
    '		CalcCRC(CRC, Buff)			Updates the CRC value with the data that is in the buff string
    '		ScanChunks				Looks inside the png file indexing each chunk.  Logging location, size, type, and crc values
    '		LoadPalette				Grabs the PLTE chunk info for indexed images
    '		GrayScalePalette(shades)		Fills the palette with a grayscale for quick conversion from grayscale to 64bit color format
    '		LoadIHDR				Grabs the info from the IHDR chunk
    '		UnFilter				Undoes the line filtering used in the image preprocessing stage
    '		ConvertBuffToColor64(Buff, Buff2)	Transforms the different color formats in PNG to 64Bit color format used internaly
    '		LoadIDAT				Grabs the IDAT chunks and puts the togther then uncompresses and deinterlaces it.
    '
    '
    'For best veiwing set TAB Size to 3, [Sed Settings of Indent to 0 (makes it same as tab)] .
    '
    'Legal Stuff
    '
    '  This program is free software; you can redistribute it and/or modify
    '  it under the terms of the GNU General Public License as published by
    '  the Free Software Foundation; either version 3 of the License, or
    '  (at your option) any later version.
    '
    '  This program is distributed in the hope that it will be useful,
    '  but WITHOUT ANY WARRANTY; without even the implied warranty of
    '  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    '  GNU General Public License for more details.
    '
    '  You should have received a copy of the GNU General Public License
    '  along with this program; if not, write to the Free Software
    '  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    '
    '  Free Software Foundation, Inc. website is located at www.fsf.org
    '  a copy of the GNU General Public License is hosted at
    '  http://www.fsf.org/licensing/licenses/gpl-3.0.html
    '=================================================================================
    
    'ZLIB libary for PNG's Deflate/Inflate Compression.
    'ZLIB Website is located at http://www.zlib.net/
    'PBZLIB can be found at http://www.powerbasic.com/support/downloads/files/PBZLIB.zip
    Attached Files
    Last edited by Cory Marshall; 16 Jun 2009, 10:03 PM.
    "Alone we can do so little; together we can do so much." - Helen Keller

    PowerBasic On Wikipedia, PowerBasic On FreeBase, and "PowerBasic Users Guide" on Wikia
Working...
X