Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support int and str input for color values in video module #2400

Merged
merged 9 commits into from
Aug 27, 2023

Conversation

yunline
Copy link
Contributor

@yunline yunline commented Aug 15, 2023

import pygame
from pygame._sdl2 import video

win=video.Window()
ren=video.Renderer(win)

sf=pygame.image.load("cobweb.png")
sf=pygame.transform.scale(sf, (128,128))

tex=video.Texture(ren,(128,128))
tex.update(sf)

img = video.Image(tex,(0,0,64,64))

tex.color = "red"
img.color = 0x66ccff
ren.draw_color = "#00ff00"

ren.fill_rect((256,128,128,128))
tex.draw(dstrect=(120,128,128,128))
img.draw(dstrect=(400,128,128,128))
ren.present()

while 1:
    pygame.event.get()

image

- remove Texture._color
- Support int and str for `Texture.color` and `Image.color`
@yunline yunline added enhancement video pygame.video labels Aug 15, 2023
@yunline yunline requested a review from a team as a code owner August 15, 2023 11:36
@Starbuck5
Copy link
Member

This PR seemingly relies on #2349, so that must be merged first.

@ankith26
Copy link
Member

The PR this PR depended on has been merged, though this still has extra commits? Fix with a rebase?

Copy link
Contributor

@dr0id dr0id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Starbuck5
Copy link
Member

Left a comment, there's also a merge conflict.

The ALL color flag is the same one used by the Color constructor, that's good. It's probably good to just have that be the standard and never support mapped color for Textures?

Copy link
Member

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Starbuck5 Starbuck5 merged commit e5efd11 into pygame-community:main Aug 27, 2023
32 checks passed
@Starbuck5 Starbuck5 added this to the 2.3.2 milestone Aug 27, 2023
@yunline yunline deleted the video-color-enhance branch August 27, 2023 08:48
@ankith26 ankith26 modified the milestones: 2.3.2, 2.4.0 Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants