View Single Post
Old 25th August 2016, 12:40   #1  |  Link
hydra3333
Registered User
 
Join Date: Oct 2009
Location: crow-land
Posts: 540
alternative to, or better use of, core.text.Text ?

Hello. Dummy seeking more advice, this time about core.text.Text

I converted hacked a few home-grown debug type functions from avisynth to what I hoped were equivalent vapoursynth ones (attached).
The avisynth versions of the functions use subtitle to "overlay" the text nicely so nothing is obscured too much.
The vapoursynth versions use core.text.Text which puts rather obscuring black boxes around the text, which isn't very handy for the purpose of those debug functions.
Suggestions would be welcomed on how to make the text appearance more "friendly".

eg
Code:
def xBox4(clipa=None, aSub='clip a', clipb=None, bSub='clip b'): 
    icore = vs.get_core() 
    if not isinstance(clipa, vs.VideoNode): 
        raise TypeError('xBox4: clip a is not a clip') 
    if not isinstance(clipb, vs.VideoNode): 
        raise TypeError('xBox4: clip b is not a clip') 
    hClip = clipa.height 
    wClip = clipa.width  
    aa1 = icore.std.CropRel(clipa,left=0*wClip//4,top=0*hClip//4,right=3*wClip//4,bottom=3*hClip//4) 
    aa2 = icore.std.CropRel(clipb,left=1*wClip//4,top=0*hClip//4,right=2*wClip//4,bottom=3*hClip//4) 
    aa3 = icore.std.CropRel(clipa,left=2*wClip//4,top=0*hClip//4,right=1*wClip//4,bottom=3*hClip//4) 
    aa4 = icore.std.CropRel(clipb,left=3*wClip//4,top=0*hClip//4,right=0*wClip//4,bottom=3*hClip//4) 
    aa1 = icore.text.Text(aa1, aSub, alignment=7) ; aa1 = icore.text.FrameNum(aa1, alignment=3) 
    aa2 = icore.text.Text(aa2, bSub, alignment=7) ; aa2 = icore.text.FrameNum(aa2, alignment=3) 
    aa3 = icore.text.Text(aa3, aSub, alignment=7) ; aa3 = icore.text.FrameNum(aa3, alignment=3) 
    aa4 = icore.text.Text(aa4, bSub, alignment=7) ; aa4 = icore.text.FrameNum(aa4, alignment=3) 
    bb1 = icore.std.CropRel(clipb,left=0*wClip//4,top=1*hClip//4,right=3*wClip//4,bottom=2*hClip//4) 
    bb2 = icore.std.CropRel(clipa,left=1*wClip//4,top=1*hClip//4,right=2*wClip//4,bottom=2*hClip//4) 
    bb3 = icore.std.CropRel(clipb,left=2*wClip//4,top=1*hClip//4,right=1*wClip//4,bottom=2*hClip//4) 
    bb4 = icore.std.CropRel(clipa,left=3*wClip//4,top=1*hClip//4,right=0*wClip//4,bottom=2*hClip//4) 
    bb1 = icore.text.Text(bb1, bSub, alignment=7) ; bb1 = icore.text.FrameNum(bb1, alignment=3) 
    bb2 = icore.text.Text(bb2, aSub, alignment=7) ; bb2 = icore.text.FrameNum(bb2, alignment=3) 
    bb3 = icore.text.Text(bb3, bSub, alignment=7) ; bb3 = icore.text.FrameNum(bb3, alignment=3) 
    bb4 = icore.text.Text(bb4, aSub, alignment=7) ; bb4 = icore.text.FrameNum(bb4, alignment=3) 
    cc1 = icore.std.CropRel(clipa,left=0*wClip//4,top=2*hClip//4,right=3*wClip//4,bottom=1*hClip//4) 
    cc2 = icore.std.CropRel(clipb,left=1*wClip//4,top=2*hClip//4,right=2*wClip//4,bottom=1*hClip//4) 
    cc3 = icore.std.CropRel(clipa,left=2*wClip//4,top=2*hClip//4,right=1*wClip//4,bottom=1*hClip//4) 
    cc4 = icore.std.CropRel(clipb,left=3*wClip//4,top=2*hClip//4,right=0*wClip//4,bottom=1*hClip//4) 
    cc1 = icore.text.Text(cc1, aSub, alignment=7) ; cc1 = icore.text.FrameNum(cc1, alignment=3) 
    cc2 = icore.text.Text(cc2, bSub, alignment=7) ; cc2 = icore.text.FrameNum(cc2, alignment=3) 
    cc3 = icore.text.Text(cc3, aSub, alignment=7) ; cc3 = icore.text.FrameNum(cc3, alignment=3) 
    cc4 = icore.text.Text(cc4, bSub, alignment=7) ; cc4 = icore.text.FrameNum(cc4, alignment=3) 
    dd1 = icore.std.CropRel(clipb,left=0*wClip//4,top=3*hClip//4,right=3*wClip//4,bottom=0*hClip//4) 
    dd2 = icore.std.CropRel(clipa,left=1*wClip//4,top=3*hClip//4,right=2*wClip//4,bottom=0*hClip//4) 
    dd3 = icore.std.CropRel(clipb,left=2*wClip//4,top=3*hClip//4,right=1*wClip//4,bottom=0*hClip//4) 
    dd4 = icore.std.CropRel(clipa,left=3*wClip//4,top=3*hClip//4,right=0*wClip//4,bottom=0*hClip//4) 
    dd1 = icore.text.Text(dd1, bSub, alignment=7) ; dd1 = icore.text.FrameNum(dd1, alignment=3) 
    dd2 = icore.text.Text(dd2, aSub, alignment=7) ; dd2 = icore.text.FrameNum(dd2, alignment=3) 
    dd3 = icore.text.Text(dd3, bSub, alignment=7) ; dd3 = icore.text.FrameNum(dd3, alignment=3) 
    dd4 = icore.text.Text(dd4, aSub, alignment=7) ; dd4 = icore.text.FrameNum(dd4, alignment=3) 
    rr = icore.std.StackVertical( [ icore.std.StackHorizontal([aa1, aa2, aa3, aa4]),  
                                    icore.std.StackHorizontal([bb1, bb2, bb3, bb4]), 
                                    icore.std.StackHorizontal([cc1, cc2, cc3, cc4]), 
                                    icore.std.StackHorizontal([dd1, dd2, dd3, dd4]) ]) 
    return rr
Attached Files
File Type: txt zzz.txt (18.9 KB, 16 views)
hydra3333 is offline   Reply With Quote