|
|
@@ -2565,23 +2565,41 @@ def cvImageToSurface(cvImage):
|
|
|
surface = pygame.image.frombuffer(cvImage.flatten(), size, format)
|
|
|
return surface.convert_alpha() if format == 'RGBA' else surface.convert()
|
|
|
|
|
|
-
|
|
|
-def _img_open():
|
|
|
- # x
|
|
|
- # y
|
|
|
- # dim
|
|
|
- # scale
|
|
|
- fname = '/opt/LibreLight/Xdesk/icon/picker.png'
|
|
|
+def _img_meta():
|
|
|
+ out = {}
|
|
|
+ out["pos"] = (70,430) # x,y
|
|
|
+ out["ipos"] = (0,0) # x,y
|
|
|
+ out["scale"] = 1
|
|
|
+ out["dim"] = 100
|
|
|
+ out["_fpath"] = '/opt/LibreLight/Xdesk/icon/'
|
|
|
+ out["fname"] = "picker.png"
|
|
|
+ out["img"] = ""
|
|
|
+ out["err"] = []
|
|
|
+ return out
|
|
|
+
|
|
|
+def _img_open(img_meta):
|
|
|
+ fname = img_meta["_fpath"] +"/"+ img_meta["fname"] #'/opt/LibreLight/Xdesk/icon/picker.png'
|
|
|
image = cv2.imread(fname)
|
|
|
im2 = cvImageToSurface(image)
|
|
|
+ img_meta["img"] = im2
|
|
|
return im2
|
|
|
|
|
|
-def img_draw(im2):
|
|
|
+def img_jitter(img_meta):
|
|
|
r1=random.randint(0,3)
|
|
|
r2=random.randint(0,3)
|
|
|
- window.blit(im2, (50+r1, 430+r2))
|
|
|
+ img_meta["ipos"] = [r1,r2]
|
|
|
+
|
|
|
+def img_draw(img_meta):
|
|
|
+
|
|
|
+ img_jitter(img_meta)
|
|
|
+
|
|
|
+ pos = img_meta["pos"]
|
|
|
+ ipos = img_meta["ipos"]
|
|
|
+ im2 = img_meta["img"]
|
|
|
+ window.blit(im2, (pos[0]+ipos[0], pos[1]+ipos[1]))
|
|
|
|
|
|
-png_im2 = _img_open()
|
|
|
+img_meta_a = _img_meta()
|
|
|
+_img_open(img_meta_a)
|
|
|
|
|
|
t1 = Timer(143)
|
|
|
time.sleep(0.33)
|
|
|
@@ -2687,7 +2705,7 @@ def main():
|
|
|
draw_overlay()
|
|
|
pointer.draw(0,pm_wy) #wy
|
|
|
|
|
|
- img_draw(png_im2)
|
|
|
+ img_draw(img_meta_a)
|
|
|
|
|
|
|
|
|
pygame.display.flip()
|