Beispiel #1
0
        private unsafe void test_ebdtFormat7_GetBitmap()
        {
            byte[] x = unchecked (new byte[] { 5, 5, 3, 3, 5, 3, 3, 5, 0xA9, 0x3E, 0x4A, 0x80 });
            fixed(byte *p = &x[0])
            {
                ebdtFormat7 *f7 = (ebdtFormat7 *)p;

                f7->GetBitmap().Save("testbmp.bmp0");
            }
        }
Beispiel #2
0
        public unsafe void SaveImages()
        {
            fixed(byte *pImg = &this.file.image[0])
            {
                indexSubTableArray *subtableB = (indexSubTableArray *)(pImg + (uint)entry.offset + (uint)size.indexSubTableArrayOffset);
                indexSubTableArray *subtableM = subtableB + (uint)size.numberOfIndexSubTables;
                indexSubTableArray *subtable  = subtableB;
                indexSubHeader *    subheader;

                //-----
                System.Drawing.Bitmap   bmp;
                System.Drawing.Bitmap   bmp0 = new System.Drawing.Bitmap(300, 300);
                System.Drawing.Graphics g    = System.Drawing.Graphics.FromImage(bmp0);
                g.Clear(System.Drawing.Color.Gray);
                int x = 0, y = 0;

                //-----
                while (subtable < subtableM)
                {
                    subheader = (indexSubHeader *)((byte *)subtableB + (uint)subtable->additionalOffsetToIndexSubTable);
                    if ((ushort)subheader->indexFormat == 1 && (ushort)subheader->imageFormat == 7)
                    {
                        indexSubTable1 *table           = (indexSubTable1 *)subheader;
                        ULONG *         offset          = &table->offsetArray;
                        ULONG *         offsetM         = offset + ((ushort)subtable->lastGlyphIndex - (ushort)subtable->firstGlyphIndex + 1);
                        byte *          imageDataOffset = pImg + (uint)this.file.tables["EBDT"].offset + (uint)subheader->imageDataOffset;

                        while (offset < offsetM)
                        {
                            ebdtFormat7 *f7 = (ebdtFormat7 *)(imageDataOffset + (uint)*offset);
                            g.DrawImageUnscaled(bmp = f7->GetBitmap(), x, y);
                            bmp.Dispose();
                            offset++;
                            x += 10; if (x >= 300)
                            {
                                x = 0; y += 10;
                            }
                        }
                    }
                    subtable++;
                }
                //-----
                g.Dispose();
                System.Drawing.Bitmap bmp1 = afh.Drawing.BitmapEffect.Invert(bmp0);
                bmp0.Dispose();
                bmp1.Save(System.IO.Path.Combine(afh.Application.Path.ExecutableDirectory, "images\\" + this.Text + ".bmp"));
                bmp1.Dispose();
                //-----
            }
        }