|
|
One of the disadvantages of windows bitmap is that the file is too large for high resolution images (up to 30,000 DPI), while other raster image file formats such as TIFF (Tagged Image File Format) are too complex for most people to write their own readers. RID is a very simple two color (black & white) raster image file format with high compression ratio. You need only half an hour to master it completely. It's quite easy to write your own RID reader. RID is designed in the hope that GerbMagic can interface as many kinds of plotters as possible. GerbMagic supports TIFF (Packbits), BMP (windows bitmap) as output formats, but RID is our recommended format for those who can not handle TIFF. More formats may be supported in future releases of GerbMagic. RID Specification RID (Raster Image Data) is a black-and-white graphical file format used by GerbMagic to store rasterized images. It is simpler and more compact than BMP. The advantage of RID over BMP is file size and speed. A bitmap of over 100M bytes, when converted to RID, may be reduced to less than 20M bytes. Smaller files also cost less time to be stored on the disk. Since disk I/O is the most significant bottleneck, using RID gains a lot. The disadvantage of RID is that it is monochrome. But this is not a problem in rasterizing Gerber or PCB files, we don't need colors at all. A RID file contains a 48-byte file header followed by raster data , as follows.
Consider the following exemplar RID file header for a 1016 DPI, 3552 x 3665 image:
File header info:
Raster data of each scan line begins at RID file offset 0x30. 00000030: line0: i0, i1, i2, ...ik, ... in line1: in+1, in+2, in+3, ... in+m ... where i0,i1,... are 2-byte integers. if(ik>0) there are ik 0's. if(ik<0) there are (-ik) 1's. 0 represents white and 1 represents black. A scan line is extracted by adding the absolute value of ik accumulatively until image-width pixels. There are no End-Of-Line marks in RID files. | ||||||||||||||||||||||||||||||||||||||||||||||
|