Browse Source

fix: MediaCam.draw

micha 1 week ago
parent
commit
721298e8f5
1 changed files with 11 additions and 14 deletions
  1. 11 14
      vpu/vpu_live4.py

+ 11 - 14
vpu/vpu_live4.py

@@ -311,14 +311,9 @@ class MediaCam():
         pass
 
     def draw(self,wn,im,x,y,w,h):
-        #if not self.fname.startswith("cam_"):
-        #    return
-        xx = w #self.shape_x 
-        yy = h #self.shape_y 
-
-        xx,yy = self.calc_zoom(xx,yy)
-
-        wn.blit(im, (int(x-xx/2), int(y-yy)))  # draw frame
+        xx = w/2 
+        yy = h/2
+        wn.blit(im, (int(x-xx), int(y-yy)))  # draw frame
 
     def _open_cam(self,obj):
         # LIVE VIDEO INPUT UVC DEVICE
@@ -821,7 +816,9 @@ class PixelMedia():
 
         if self.success and wn and im: 
             if self.fname.startswith("cam_"):
-                self.cam.draw(wn,im,x,y,w,h)
+                xx,yy = self.calc_zoom(xx,yy)
+                #self.cam.draw(wn,im,x,y,w,h)
+                self.cam.draw(wn,im,x,y,xx,yy)
             else:
                 self.draw_video(wn,im,x,y,w,h)
 
@@ -2014,8 +2011,8 @@ def reshape2(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
                 sub = pygame.transform.rotate(sub,ang)
                 window.blit(sub,(target_x,target_y))
         except Exception as e:
-            print("   ",_wall)
-            print("WALL err:",e)
+            cprint("   ",_wall,color="red")
+            cprint("WALL err:",e,color="red")
 
 
 
@@ -2154,7 +2151,7 @@ def reload_grid():
         GRID   = init_grid(_x=_x,_y=_y,name="GRID") #init_gird()
         GRID_A = init_grid(_x=8,_y=16,mapping=1,name="GRID_A") #init_gird()
     except Exception as e:
-        print("Except: grid re init",e)
+        cprint("Except: grid re init",e,color="red")
 
 VPU_TEXT = []
 def load_vpu_text(nr=0):
@@ -2461,7 +2458,7 @@ def counter_dmx(COUNTER,dataA):
                 count["_SEC"] = "DMX:{}-{}".format(cDMX+1,cDMX+8+1)
 
         except Exception as e:
-            print("EXC FUNC",e,count)
+            cprint("EXC FUNC",e,count,color="red")
         #print(count)
 
 
@@ -2496,7 +2493,7 @@ def video_dmx(VIDEO,dataA):
             count["ANG"] = (int(dataA[cDMX+7])/255*360)
             #count["BLUE"]  = dataA[cDMX+8]
         except Exception as e:
-            print("VIDEOPLAYER EXCEPT FUNC",e,count)
+            cprint("VIDEOPLAYER EXCEPT FUNC",e,count,color="red")
         #print(count)
 
 def read_dmx_data(ip,ips):