Ejemplo n.º 1
0
        }        //end FromFixedHeightStaggered

        public bool FromImageValue(string sFile, int iCharWidth, int iCharHeight, int iRows, int iColumns)
        {
            bool  bGood = false;
            RAnim animNormal;

            RReporting.sLastFile = sFile;
            try {
                animNormal = new RAnim();
                bGood      = Init();
                if (bGood)
                {
                    Console.Error.WriteLine("FromImageValue...");
                    bGood = animNormal.SplitFromImage32(sFile, iCharWidth, iCharHeight, iRows, iColumns);
                    if (animNormal.Frame(0) == null)
                    {
                        Console.Error.WriteLine("SplitFromImage32...FAILED -- Null frame zero upon splitting image in " + String.Format("rfont FromImageValue(sFile={0},iCharWidth={1},iCharHeight={2},iRows={3},iColumns={4})", RReporting.StringMessage(sFile, true), iCharWidth, iCharHeight, iRows, iColumns));
                    }
                    else
                    {
                        Console.Error.WriteLine("SplitFromImage32...OK " + String.Format("rfont FromImageValue(sFile={0},iCharWidth={1},iCharHeight={2},iRows={3},iColumns={4})", RReporting.StringMessage(sFile, true), iCharWidth, iCharHeight, iRows, iColumns));
                    }
                    //animNormal.SaveSeq("etc/test/0.debug-glyph", "png");
                    //RImage.OverlayToBigNoClipRaw(ref riTarget, ref ipAt, ref animNormal.riFrame.byarrData, iCharWidth, iCharHeight, 4);
                    if (bGood)
                    {
                        Normal     = animNormal.CopyAsGray();
                        Bold       = Normal.Copy();
                        Italic     = Normal.Copy();
                        BoldItalic = Normal.Copy();
                        //TODO: finish modifying the Glyph Types -- italics using image manip
                    }
                    else
                    {
                        RReporting.ShowErr("Failed to split image", "splitting image from value", "rfont FromImageValue(" + RReporting.StringMessage(sFile, true) + ",...) {}");
                    }
                    //ShowAsciiTable();
                    //Console.Error.WriteLine("Normal.ToString(true):"+Normal.ToString(true));
                }
                else
                {
                    RReporting.ShowErr("Couldn't initialize font glyph graphics buffer", "initializing font graphics", "RFont FromImageValue");
                }
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "initializing font graphics", "RFont FromImageValue");
            }
            return(bGood);
        }        //end FromImageValue
Ejemplo n.º 2
0
        }        //end FromImageValue

        public bool FromImage(string sFile, int iCharWidth, int iCharHeight, int iRows, int iColumns)
        {
            bool  bGood = false;
            RAnim animNormal;

            RReporting.sLastFile = sFile;          //TODO: implement this EVERYWHERE
            try {
                animNormal = new RAnim();
                bGood      = Init();
                if (bGood)
                {
                    bGood = animNormal.SplitFromImage32(sFile, iCharWidth, iCharHeight, iRows, iColumns);
                    //animNormal.SaveSeq("etc/test/0.debug-glyph", "png");
                    //RImage.OverlayToBigNoClipRaw(ref riTarget, ref ipAt, ref animNormal.riFrame.byarrData, iCharWidth, iCharHeight, 4);
                    if (bGood)
                    {
                        Normal     = animNormal;
                        Bold       = Normal.Copy();
                        Italic     = Normal.Copy();
                        BoldItalic = Normal.Copy();
                        //TODO: finish modifying the Glyph Types -- italics using image manip
                    }
                    //else RReporting.ShowErr("RFont failed to split image","","RFont FromImage");//already shown by anim
                    //ShowAsciiTable();
                    //Console.Error.WriteLine("Normal.ToString(true):"+Normal.ToString(true));
                }
                else
                {
                    RReporting.ShowErr("Couldn't initialize font glyph graphics buffer", "initializing font graphics", "RFont FromImage");
                }
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "initializing font graphics", "RFont FromImage");
            }
            return(bGood);
        }        //end FromImage