Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add grayscale for surfaces and colors by @ScriptLineStudios#3717

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
illume merged 19 commits intomainfromgreyscale
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
9ca2de0
pygame.transform.scale()
ScriptLineStudiosNov 11, 2022
7f6a86e
Merge branch 'pygame:main' into transform.grayscale
ScriptLineStudiosNov 11, 2022
4a0b4e3
forgot to declare i outside for loop
ScriptLineStudiosNov 11, 2022
6878096
Started fixing issues
ScriptLineStudiosNov 12, 2022
e0bb856
changes are per request
ScriptLineStudiosNov 12, 2022
7b04382
forgot something
ScriptLineStudiosNov 12, 2022
cede6a1
removed chance for uninitialized variables (should hopefully get more…
ScriptLineStudiosNov 12, 2022
877b59a
fixed surfaces with depth 24 segfaulting
ScriptLineStudiosJan 6, 2023
3350bda
fix
ScriptLineStudiosJan 6, 2023
2ce1271
cleanup diff + more tests
ScriptLineStudiosJan 10, 2023
cf5984f
small doc change
ScriptLineStudiosJan 10, 2023
21ea30f
Merge branch 'pygame:main' into transform.grayscale
ScriptLineStudiosJan 11, 2023
6267d34
pygame.Color.grayscale
ScriptLineStudiosJan 11, 2023
048df64
cast to uint8
ScriptLineStudiosJan 11, 2023
1896665
changed formula and updated docs
ScriptLineStudiosJan 16, 2023
ef540bc
Merge branch 'pygame:main' into transform.grayscale
ScriptLineStudiosFeb 18, 2023
35285fc
Merge pull request #3556 from ScriptLineStudios/transform.grayscale
illumeFeb 18, 2023
38f9e1b
transform: Add workaround for average_color lack of precision
illumeFeb 19, 2023
af31079
color: Add Color.grayscale to stubs
illumeFeb 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
small doc change
  • Loading branch information
ScriptLineStudios committedJan 10, 2023
commitcf5984fff0908ea9c13c88e4c450729ea02838a5
2 changes: 1 addition & 1 deletiondocs/reST/ref/transform.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,7 @@ Instead, always begin with the original image and scale to the desired size.)
Grayscales the surface.

An optional destination surface can be passed which is faster than creating a new Surface.
However thisdestination surface must have the same dimensions (width, height) as the source Surface.
Thisdestination surface must have the same dimensions (width, height) and depth as the source Surface.

.. ## pygame.transform.grayscale ##

Expand Down
16 changes: 8 additions & 8 deletionssrc_c/transform.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1328,39 +1328,39 @@ smoothscale_init(struct _module_state *st)
}

static void
convert_32_24(Uint8 *srcpix, int srcpitch, Uint8 *dstpix, int dstpitch,
convert_24_32(Uint8 *srcpix, int srcpitch, Uint8 *dstpix, int dstpitch,
int width, int height)
{
int srcdiff = srcpitch - (width *4);
int dstdiff = dstpitch - (width *3);
int srcdiff = srcpitch - (width *3);
int dstdiff = dstpitch - (width *4);
int x, y;

for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
*dstpix++ = *srcpix++;
*dstpix++ = *srcpix++;
*dstpix++ = *srcpix++;
srcpix++;
*dstpix++ = 0xff;
}
srcpix += srcdiff;
dstpix += dstdiff;
}
}

static void
convert_24_32(Uint8 *srcpix, int srcpitch, Uint8 *dstpix, int dstpitch,
convert_32_24(Uint8 *srcpix, int srcpitch, Uint8 *dstpix, int dstpitch,
int width, int height)
{
int srcdiff = srcpitch - (width *3);
int dstdiff = dstpitch - (width *4);
int srcdiff = srcpitch - (width *4);
int dstdiff = dstpitch - (width *3);
int x, y;

for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
*dstpix++ = *srcpix++;
*dstpix++ = *srcpix++;
*dstpix++ = *srcpix++;
*dstpix++ = 0xff;
srcpix++;
}
srcpix += srcdiff;
dstpix += dstdiff;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp