Skip to content

Instantly share code, notes, and snippets.

View HemulGM's full-sized avatar
🟢
Working while it's working

HemulGM

🟢
Working while it's working
View GitHub Profile
procedure TForm14.FormCreate(Sender: TObject);
var
Pic: TPicture;
PNG, FStatusMask, FOver: TPngImage;
function CreateAvatar(Source: TGraphic; Mask: TPngImage): TPngImage;
var
BMPSmooth: TBitmap;
Av: TPngImage;
begin
@HemulGM
HemulGM / test.pas
Last active November 22, 2019 08:32
procedure TForm14.FormCreate(Sender: TObject);
var
Pic: TPicture;
PNG, FStatusMask, FOver: TPngImage;
function CreateAvatar(Source: TGraphic; Mask: TPngImage): TPngImage;
var
BMPSmooth: TBitmap;
Av: TPngImage;
begin
function CreateAvatar(Source: TGraphic; Mask: TPngImage): TPngImage;
var
BMPSmooth: TBitmap;
Av: TPngImage;
begin
BMPSmooth := SmoothStrechDraw(Source, TSize.Create(Mask.Width, Mask.Height));
Result := TPngImage.CreateBlank(COLOR_RGB, 16, Mask.Width, Mask.Height);
Result.Canvas.Draw(0, 0, BMPSmooth);
with TDirect2DCanvas.Create(Result.Canvas, Rect(0, 0, Mask.Width, Mask.Height)) do
begin
@HemulGM
HemulGM / ConvertWavToOgg.pas
Created February 29, 2020 04:03
Convert Wav To Ogg
uses
bass, bassenc;
function ConvertWavToOgg(var Target: string; DeleteSource: Boolean): Boolean;
var
Stream: HSTREAM;
Encode: HENCODE;
Cmd, Old: string;
Bytes: TByteArray;
begin
unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, System.Types, Vcl.Graphics, Vcl.Controls, Vcl.Forms,
Vcl.Dialogs, System.Net.HttpClient, Vcl.StdCtrls;
type
unit uDownload;
interface
uses
Winapi.Windows,
System.SysUtils,
System.Classes,
IdComponent,
IdHTTP;
function GetParamStr(P: PChar; var Param: string): PChar;
var
i, Len: Integer;
Start, S: PChar;
begin
// U-OK
while True do
begin
while (P[0] <> #0) and (P[0] <= ' ') do
Inc(P);
program VKBotTemplate;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
type
TImageListHelper = class helper for TImageList
function Add(ABitmap: TBitmap): integer;
end;
...
function TImageListHelper.Add(aBitmap: TBitmap): integer;
const
SCALE = 1;
@HemulGM
HemulGM / IndyAsyncPing.pas
Created November 25, 2020 18:48
Delphi, Indy, Async Ping
uses
IdComponent, IdIcmpClient, System.Threading;
type
TPing = class
private
FMySelf: TPing;
FProc: TProc<Integer>;
procedure FOnReply(ASender: TComponent; const AReplyStatus: TReplyStatus);
procedure FOnStatus(ASender: TObject; const AStatus: TIdStatus; const AStatusText: string);