from array import array

from pygame.mixer import Sound, get_init

class Samples(Sound):

    def __init__(self):
        self.set_amplitude()
        Sound.__init__(self, self.build())

    def set_amplitude(self):
        self.amplitude = (1 << (self.get_sample_width() * 8 - 1)) - 1

    def get_sample_width(self):
        return abs(get_init()[1] / 8)

    def build(self):
        pass

    def get_empty_array(self, length):
        return array(self.get_array_typecode(), [0] * length)

    def get_array_typecode(self):
        return [None, "b", "h"][self.get_sample_width()]
from pgfw.Setup import Setup

if __name__ == "__main__":
    Setup().setup()
from pgfw.SetupWin import SetupWin

if __name__ == "__main__":
    SetupWin().setup()
use feature "say";

package Song;

sub new
{
    my $class = shift;
    my $self = bless {frame_duration => $ARGV[2], step => $ARGV[1]}, $class;
    $self->loadImages();
    $self;
}

sub loadImages
{
    my $self = shift;
    $self->loadBackground();
    $self->loadGradient();
    $self->loadBorder();
    $self->loadMask();
    $self->buildFrames();
}

sub loadBackground
{
    my $self = shift;
    my $background = Image::Magick->new;
    $background->Read($ARGV[3]);
    $self->{background} = $background;
}

sub loadGradient
{
    my $self = shift;
    my $gradient = Image::Magick->new;
    $gradient->Read($ARGV[4]);
    $self->{gradient} = $gradient;
}

sub loadBorder
{
    my $self = shift;
    my $border = Image::Magick->new;
    $border->Read($ARGV[5]);
    $self->{border} = $border;
}

sub loadMask
{
    my $self = shift;
    my $mask = Image::Magick->new;
    $mask->Read($ARGV[0]);
    $self->{mask} = $mask;
}

sub buildFrames
{
    my $self = shift;
    my @frames;
    my $strip = $self->{mask};
    my $strip_width = $strip->Get("width");
    my $background = $self->{background};
    my $background_width = $background->Get("width");
    my $background_height = $background->Get("height");
    my $mask_size = $background_width . "x" . $background_height;
    my $points = [0, 0, 0, 0,
		  $background_width, 0, $background_width, 0,
		  0, $background_height, 3, $background_height - 2,
		  $background_width, $background_height, $background_width - 3, $background_height - 2];
    my $x = 0;
    while ($x > -$strip_width)
    {
	my $frame = $background->Clone();
	my $mask = Image::Magick->new(size=>$mask_size);
	$mask->Read("canvas:none");
	$mask->Composite(image=>$strip, x=>$x);
	if ($strip_width + $x < $background_width)
	{
	    $mask->Composite(image=>$strip, x=>$strip_width + $x);
	}
	$frame->Composite(image=>$self->{gradient}, mask=>$mask);
	$frame->Composite(image=>$self->{border});
	$frame->Distort(method=>"Perspective", points=>$points,
			"virtual-pixel"=>"transparent");
	$frame->Trim();
	push @frames, $frame;
	$x -= $self->{step};
    }
    $self->{frames} = \@frames;
}

sub write
{
    my $self = shift;
    $directory = "new/";
    mkdir $directory;
    my $frames = $self->{frames};
    my $index;
    for (0..@{$frames} - 1)
    {
	$index = sprintf("%02d", $_);
	$name = $directory . $index . "-" . $self->{frame_duration} . ".gif";
	@{$frames}[$_]->Write($name);
	$self->convertToPNG($name);
    }
}

sub convertToPNG
{
    my $self = shift;
    my $name = shift;
    my $img = Image::Magick->new;
    $img->Read($name);
    unlink $name;
    $name =~ s/gif/png/;
    $img->Write($name);
}

1;
#!/usr/bin/perl

use strict;
use warnings;

use feature "say";

use Data::Dumper;
use CGI;

require "writeAnimation.pl";

generate();

sub generate
{
    my $cgi = CGI->new;
    say $cgi->header();
    my $params = $cgi->Vars;
    say "<pre>";
    if (!$params->{"type"})
    {
	say Dumper($params);
	say "No image type specified";
    }
    else
    {
	writeAnimation($params);
    }
    say "</pre>";
}
use strict;
use warnings;
use feature "say";

use Data::Dumper;
use Animation::Imitation;

sub writeAnimation
{
    my $arguments = shift;
    my $animation;
    for ($arguments->{"type"})
    {
	if (/^im.*/ || /^1$/)
	{
	    $animation = Animation::Imitation->new($arguments);
	}
    }
    $animation->write();
}

1;
216.73.216.53
216.73.216.53
216.73.216.53
 
July 18, 2022


A new era ‼

Our infrastructure has recently upgraded ‼

Nugget Communications Bureau 👍

You've never emailed like this before ‼

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and me can start our own newspaper or social media feed.

Nugget Streaming Media 👍

The content you crave ‼

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional ‼

Nugget Productivity Suite 👍

Unleash your potential ‼

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security 👍

The real Turing test ‼

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software 👍

The best in gaming entertainment ‼

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom ‼

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.