Пример #1
0
        // Add a filler byte on read, or remove a filler or alpha byte on write.
        // The filler type has changed in v0.95 to allow future 2-byte fillers
        // for 48-bit input data, as well as to avoid problems with some compilers
        // that don't like bytes as parameters.
        public void png_set_filler(uint filler, PNG_FILLER filler_loc)
        {
            transformations |= PNG_TRANSFORMATION.FILLER;
            this.filler      = (ushort)filler;
            if (filler_loc == PNG_FILLER.AFTER)
            {
                flags |= PNG_FLAG.FILLER_AFTER;
            }
            else
            {
                flags &= ~PNG_FLAG.FILLER_AFTER;
            }

            // This should probably go in the "do_read_filler" routine.
            // I attempted to do that in libpng-1.0.1a but that caused problems
            // so I restored it in libpng-1.0.2a
            if (color_type == PNG_COLOR_TYPE.RGB)
            {
                usr_channels = 4;
            }

            // Also I added this in libpng-1.0.2a (what happens when we expand
            // a less-than-8-bit grayscale to GA?

            if (color_type == PNG_COLOR_TYPE.GRAY && bit_depth >= 8)
            {
                usr_channels = 2;
            }
        }
Пример #2
0
		// Add a filler byte on read, or remove a filler or alpha byte on write.
		// The filler type has changed in v0.95 to allow future 2-byte fillers
		// for 48-bit input data, as well as to avoid problems with some compilers
		// that don't like bytes as parameters.
		public void png_set_filler(uint filler, PNG_FILLER filler_loc)
		{
			transformations|=PNG_TRANSFORMATION.FILLER;
			this.filler=(ushort)filler;
			if(filler_loc==PNG_FILLER.AFTER) flags|=PNG_FLAG.FILLER_AFTER;
			else flags&=~PNG_FLAG.FILLER_AFTER;

			// This should probably go in the "do_read_filler" routine.
			// I attempted to do that in libpng-1.0.1a but that caused problems
			// so I restored it in libpng-1.0.2a
			if(color_type==PNG_COLOR_TYPE.RGB) usr_channels=4;

			// Also I added this in libpng-1.0.2a (what happens when we expand
			// a less-than-8-bit grayscale to GA?

			if(color_type==PNG_COLOR_TYPE.GRAY&&bit_depth>=8) usr_channels=2;
		}
Пример #3
0
 public void png_set_add_alpha(uint filler, PNG_FILLER filler_loc)
 {
     png_set_filler(filler, filler_loc);
     transformations |= PNG_TRANSFORMATION.ADD_ALPHA;
 }
Пример #4
0
		public void png_set_add_alpha(uint filler, PNG_FILLER filler_loc)
		{
			png_set_filler(filler, filler_loc);
			transformations|=PNG_TRANSFORMATION.ADD_ALPHA;
		}