Fixed some issues with image aspect ratio. Added preliminary gradient features for rounded rectangles.
This commit is contained in:
parent
b1396cd70a
commit
bed8281b22
5 changed files with 184 additions and 36 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from jgui.surface import Surface, Window, Position, Size, Color, TextWindow, ImageWindow
|
||||
from jgui.surface import Surface, Window, Position, Size, Color, TextWindow, ImageWindow, Gradient, RadialGradient
|
||||
import math, os
|
||||
from jgui.settings import IMG_DIR
|
||||
|
||||
|
|
@ -19,7 +19,13 @@ class TestSurface(Surface):
|
|||
clip_children=True,
|
||||
ignore_debug=True,
|
||||
background_image=os.path.join(IMG_DIR, 'wrench.png'),
|
||||
background_image_filter='bilinear')
|
||||
background_image_filter='bilinear',
|
||||
background_image_keep_ratio=True,
|
||||
background_image_center_vertical=True,
|
||||
background_image_center_horizontal=True,
|
||||
background_image_stretch_horizontal=True,
|
||||
background_image_stretch_vertical=True,
|
||||
gradient=RadialGradient(start_position=[0.5, 0], end_position=[0.5, 0.5], inner_radius=30, outer_radius=500, stops=[(0, Color(1,1,1)), (1, Color(0.3,0.3,0.3))]))
|
||||
|
||||
my_win.add_child(TextWindow('text','Micro Bean is the best bean ever.',
|
||||
position=[20,20], size=[100, 50],
|
||||
|
|
@ -28,6 +34,33 @@ class TestSurface(Surface):
|
|||
draggable=True))
|
||||
|
||||
self.root_window.add_child(my_win)
|
||||
|
||||
my_win2 = Window('linear_gradient',
|
||||
position=[400, 400],
|
||||
size=[500,500],
|
||||
draggable=True,
|
||||
resizable=True,
|
||||
min_size=Size(40,40),
|
||||
border_width=5,
|
||||
border_radius=[40,20],
|
||||
border_color=(0,0,0),
|
||||
background_color=(1,1,1),
|
||||
clip_children=True,
|
||||
ignore_debug=True,
|
||||
background_image=os.path.join(IMG_DIR, 'bluebanner.png'),
|
||||
background_image_filter='bilinear',
|
||||
background_image_keep_ratio=True,
|
||||
background_image_center_vertical=False,
|
||||
background_image_center_horizontal=False,
|
||||
gradient=Gradient(stops=[(0, Color(1,1,1)), (0.8, Color(0.5,0.5,0.5)), (1, Color(0.7,0.7,0.7))]))
|
||||
|
||||
my_win2.add_child(TextWindow('text2',"I haven't had a bean in forever.",
|
||||
position=[20,20], size=[200, 100],
|
||||
resizable=False, clip_children=True,
|
||||
font_color=(0,0,0), padding=20,
|
||||
draggable=False))
|
||||
|
||||
self.root_window.add_child(my_win2)
|
||||
#self.root_window.add_child(TestWindow('child2', position=[200,200],
|
||||
# size=[200,200], draggable=True))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue