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)

  • 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

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

    'PNG Decoder Copyright (C) 2009 by Cory A Marshall
    'See "Legal Stuff" for details
    'PNG V1.2 specifcation can be found at
    '	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
    '  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
    '  a copy of the GNU General Public License is hosted at
    'ZLIB libary for PNG's Deflate/Inflate Compression.
    'ZLIB Website is located at
    'PBZLIB can be found at
    Attached Files
    Last edited by Cory Marshall; 16 Jun 2009, 09: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