Skip to content

(Emboss, Palette change, Horizontal gradient 1D & 2D)

Yoann Berenguer edited this page May 1, 2022 · 10 revisions

EMBOSS

emboss(object surface_, unsigned int flag=0)
    """
    EMBOSS A PYGAME SURFACE 
    
    :param surface_: pygame.Surface; compatible 24-32 bit
    :param flag    : integer; special pygame flag such as BLEND_RGB_ADD, BLEND_RGB_MULT etc
    :return        : void
    """

e.g:

emboss(surface)

alt text alt text

PALETTE CHANGE

palette_change(
        object surface_,
        object palette_)
    """
    CHANGE AN IMAGE BY CHANGING THE COLOR PALETTE 
    
    LIST_PALETTES contains all the palettes available
    in the project.
    
    e.g: 
    from PygameShader.Palette import LIST_PALETTES
    print(LIST_PALETTES.keys())
    
    :param surface_: pygame.Surface; 
    :param palette_: numpy.ndarray containing all the RGB color values 
    :return: void
    """

e.g:

List all the available palettes

from PygameShader.Palette import LIST_PALETTES
print(LIST_PALETTES.keys())

palette_change(IMAGE, PICO_8_CUSTOM)
IMAGE PALETTE
alt text ORIGINAL
alt text CPC
alt text APPLE
alt text CGA
alt text COMMODORE 64
alt text PICO 8
alt text TO7
alt text ZX SPECTRUM

HORIZONTAL GRADIENT

create_horizontal_gradient_1d(
        int value,
        tuple start_color=(255, 0, 0),
        tuple end_color=(0, 255, 0)
)
    """
    CREATE AN ARRAY FILLED WITH A GRADIENT COLOR  
    
    :param value      : integer; Size of the gradient 1d width
    :param start_color: tuple; Tuple containing the starting RGB color 
    :param end_color  : tuple; Tuple containing the RGB values of the final color
    :return           : numpy.ndarray 2D array shape (w, 3) of type uint8 (unsigned char) 
     containing all the pixels 
    """
asarray(rgb_gradient)

horizontal_grad3d( int width, int height, tuple start_color=(255, 0, 0), tuple end_color=(0, 255, 0) ) """ CREATE A GRADIENT FROM TWO COLORS

:param width      : integer; width of the new surface in pixels
:param height     : integer; height of the new surface in pixels
:param start_color: tuple; Value RGB, Starting color
:param end_color  : tuple; value RGB, ending color or final color
:return           : Surface; pygame.Surface format 24 bit 
size width x height converted for fast blit
"""

```python
make_surface(asarray(rgb_gradient)).convert()
Clone this wiki locally