Remove graphics add email
This commit is contained in:
@ -1,176 +0,0 @@
|
||||
#pragma once
|
||||
#include "../Common.hpp"
|
||||
namespace Tesses::Framework::Graphics {
|
||||
|
||||
struct Color {
|
||||
uint8_t Red=0;
|
||||
uint8_t Green=0;
|
||||
uint8_t Blue=0;
|
||||
uint8_t Alpha=255;
|
||||
Color();
|
||||
Color(uint8_t r, uint8_t g, uint8_t b);
|
||||
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
Color(Color c, uint8_t a);
|
||||
Color(uint8_t* color_data);
|
||||
|
||||
std::string ToString(bool alphaIf255=false);
|
||||
|
||||
void ToArray(uint8_t* color_data);
|
||||
|
||||
static bool TryParse(std::string color, Color& col);
|
||||
|
||||
static Color Parse(std::string color);
|
||||
bool operator!=(Color other);
|
||||
bool operator==(Color other);
|
||||
};
|
||||
namespace Colors {
|
||||
extern const Color AliceBlue;
|
||||
extern const Color AntiqueWhite;
|
||||
extern const Color Aqua;
|
||||
extern const Color Aquamarine;
|
||||
extern const Color Azure;
|
||||
extern const Color Beige;
|
||||
extern const Color Bisque;
|
||||
extern const Color Black;
|
||||
extern const Color BlanchedAlmond;
|
||||
extern const Color Blue;
|
||||
extern const Color BlueViolet;
|
||||
extern const Color Brown;
|
||||
extern const Color BurlyWood;
|
||||
extern const Color CadetBlue;
|
||||
extern const Color Chartreuse;
|
||||
extern const Color Chocolate;
|
||||
extern const Color Coral;
|
||||
extern const Color CornflowerBlue;
|
||||
extern const Color Cornsilk;
|
||||
extern const Color Crimson;
|
||||
extern const Color Cyan;
|
||||
extern const Color DarkBlue;
|
||||
extern const Color DarkCyan;
|
||||
extern const Color DarkGoldenRod;
|
||||
extern const Color DarkGray;
|
||||
extern const Color DarkGrey;
|
||||
extern const Color DarkGreen;
|
||||
extern const Color DarkKhaki;
|
||||
extern const Color DarkMagenta;
|
||||
extern const Color DarkOliveGreen;
|
||||
extern const Color DarkOrange;
|
||||
extern const Color DarkOrchid;
|
||||
extern const Color DarkRed;
|
||||
extern const Color DarkSalmon;
|
||||
extern const Color DarkSeaGreen;
|
||||
extern const Color DarkSlateBlue;
|
||||
extern const Color DarkSlateGray;
|
||||
extern const Color DarkSlateGrey;
|
||||
extern const Color DarkTurquoise;
|
||||
extern const Color DarkViolet;
|
||||
extern const Color DeepPink;
|
||||
extern const Color DeepSkyBlue;
|
||||
extern const Color DimGray;
|
||||
extern const Color DimGrey;
|
||||
extern const Color DodgerBlue;
|
||||
extern const Color FireBrick;
|
||||
extern const Color FloralWhite;
|
||||
extern const Color ForestGreen;
|
||||
extern const Color Fuchsia;
|
||||
extern const Color Gainsboro;
|
||||
extern const Color GhostWhite;
|
||||
extern const Color Gold;
|
||||
extern const Color GoldenRod;
|
||||
extern const Color Gray;
|
||||
extern const Color Grey;
|
||||
extern const Color Green;
|
||||
extern const Color GreenYellow;
|
||||
extern const Color HoneyDew;
|
||||
extern const Color HotPink;
|
||||
extern const Color IndianRed;
|
||||
extern const Color Indigo;
|
||||
extern const Color Ivory;
|
||||
extern const Color Khaki;
|
||||
extern const Color Lavender;
|
||||
extern const Color LavenderBlush;
|
||||
extern const Color LawnGreen;
|
||||
extern const Color LemonChiffon;
|
||||
extern const Color LightBlue;
|
||||
extern const Color LightCoral;
|
||||
extern const Color LightCyan;
|
||||
extern const Color LightGoldenRodYellow;
|
||||
extern const Color LightGray;
|
||||
extern const Color LightGrey;
|
||||
extern const Color LightGreen;
|
||||
extern const Color LightPink;
|
||||
extern const Color LightSalmon;
|
||||
extern const Color LightSeaGreen;
|
||||
extern const Color LightSkyBlue;
|
||||
extern const Color LightSlateGray;
|
||||
extern const Color LightSlateGrey;
|
||||
extern const Color LightSteelBlue;
|
||||
extern const Color LightYellow;
|
||||
extern const Color Lime;
|
||||
extern const Color LimeGreen;
|
||||
extern const Color Linen;
|
||||
extern const Color Magenta;
|
||||
extern const Color Maroon;
|
||||
extern const Color MediumAquaMarine;
|
||||
extern const Color MediumBlue;
|
||||
extern const Color MediumOrchid;
|
||||
extern const Color MediumPurple;
|
||||
extern const Color MediumSeaGreen;
|
||||
extern const Color MediumSlateBlue;
|
||||
extern const Color MediumSpringGreen;
|
||||
extern const Color MediumTurquoise;
|
||||
extern const Color MediumVioletRed;
|
||||
extern const Color MidnightBlue;
|
||||
extern const Color MintCream;
|
||||
extern const Color MistyRose;
|
||||
extern const Color Moccasin;
|
||||
extern const Color NavajoWhite;
|
||||
extern const Color Navy;
|
||||
extern const Color OldLace;
|
||||
extern const Color Olive;
|
||||
extern const Color OliveDrab;
|
||||
extern const Color Orange;
|
||||
extern const Color OrangeRed;
|
||||
extern const Color Orchid;
|
||||
extern const Color PaleGoldenRod;
|
||||
extern const Color PaleGreen;
|
||||
extern const Color PaleTurquoise;
|
||||
extern const Color PaleVioletRed;
|
||||
extern const Color PapayaWhip;
|
||||
extern const Color PeachPuff;
|
||||
extern const Color Peru;
|
||||
extern const Color Pink;
|
||||
extern const Color Plum;
|
||||
extern const Color PowderBlue;
|
||||
extern const Color Purple;
|
||||
extern const Color RebeccaPurple;
|
||||
extern const Color Red;
|
||||
extern const Color RosyBrown;
|
||||
extern const Color SaddleBrown;
|
||||
extern const Color Salmon;
|
||||
extern const Color SandyBrown;
|
||||
extern const Color SeaGreen;
|
||||
extern const Color SeaShell;
|
||||
extern const Color Sienna;
|
||||
extern const Color Silver;
|
||||
extern const Color SkyBlue;
|
||||
extern const Color SlateBlue;
|
||||
extern const Color SlateGray;
|
||||
extern const Color SlateGrey;
|
||||
extern const Color Snow;
|
||||
extern const Color SpringGreen;
|
||||
extern const Color SteelBlue;
|
||||
extern const Color Tan;
|
||||
extern const Color Teal;
|
||||
extern const Color Thistle;
|
||||
extern const Color Tomato;
|
||||
extern const Color Turquoise;
|
||||
extern const Color Violet;
|
||||
extern const Color Wheat;
|
||||
extern const Color White;
|
||||
extern const Color WhiteSmoke;
|
||||
extern const Color Yellow;
|
||||
extern const Color YellowGreen;
|
||||
|
||||
};
|
||||
};
|
||||
@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include "Color.hpp"
|
||||
#include <vector>
|
||||
namespace Tesses::Framework::Graphics {
|
||||
class Image {
|
||||
uint32_t w=0;
|
||||
uint32_t h=0;
|
||||
std::vector<Color> data={};
|
||||
public:
|
||||
Image();
|
||||
Image(uint32_t w, uint32_t h);
|
||||
Image(uint32_t w,uint32_t h,std::vector<Color> data);
|
||||
uint32_t Width();
|
||||
uint32_t Height();
|
||||
void SetSize(uint32_t w, uint32_t h);
|
||||
void SetSize(uint32_t w, uint32_t h, Color c);
|
||||
void SetPixel(uint32_t x, uint32_t y, Color c);
|
||||
Color GetPixel(uint32_t x, uint32_t y);
|
||||
|
||||
std::vector<Color>& Data();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
#include "ImageFormat.hpp"
|
||||
namespace Tesses::Framework::Graphics::ImageFormats {
|
||||
class Bitmap : public ImageFormat {
|
||||
public:
|
||||
Bitmap();
|
||||
void Load(Tesses::Framework::Streams::Stream* strm, Image* image);
|
||||
void Save(Tesses::Framework::Streams::Stream* strm, Image* image,std::string flags="");
|
||||
};
|
||||
};
|
||||
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
#include "../../Streams/Stream.hpp"
|
||||
#include "../Image.hpp"
|
||||
|
||||
namespace Tesses::Framework::Graphics::ImageFormats {
|
||||
class ImageFormat {
|
||||
public:
|
||||
virtual void Load(Tesses::Framework::Streams::Stream* strm, Image* image)=0;
|
||||
virtual void Save(Tesses::Framework::Streams::Stream* strm, Image* image,std::string flags="")=0;
|
||||
|
||||
virtual ~ImageFormat();
|
||||
};
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
namespace Tesses::Framework::Graphics {
|
||||
class Point {
|
||||
public:
|
||||
Point()
|
||||
{
|
||||
|
||||
}
|
||||
Point(int32_t x, int32_t y)
|
||||
{
|
||||
this->X = x;
|
||||
this->Y = y;
|
||||
}
|
||||
int32_t X=0;
|
||||
int32_t Y=0;
|
||||
std::string ToString()
|
||||
{
|
||||
return std::to_string(X) + ", " + std::to_string(Y);
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -1,42 +0,0 @@
|
||||
#pragma once
|
||||
#include "Point.hpp"
|
||||
#include "Size.hpp"
|
||||
namespace Tesses::Framework::Graphics {
|
||||
class Rectangle {
|
||||
public:
|
||||
Rectangle()
|
||||
{
|
||||
|
||||
}
|
||||
Rectangle(Point pt, int32_t square) : Rectangle(pt, Graphics::Size(square))
|
||||
{
|
||||
|
||||
}
|
||||
Rectangle(int32_t x, int32_t y, int32_t square) : Rectangle(Point(x,y),square)
|
||||
{
|
||||
|
||||
}
|
||||
Rectangle(int32_t x, int32_t y, int32_t width, int32_t height) : Rectangle(Point(x,y),Graphics::Size(width,height))
|
||||
{
|
||||
|
||||
}
|
||||
Rectangle(Point pt, Size sz)
|
||||
{
|
||||
this->Location = pt;
|
||||
this->Size = sz;
|
||||
}
|
||||
|
||||
Graphics::Point Location;
|
||||
Graphics::Size Size;
|
||||
|
||||
std::string ToString()
|
||||
{
|
||||
return std::to_string(Location.X) + ", " + std::to_string(Location.Y) + ", " + std::to_string(Size.Width) + ", " + std::to_string(Size.Height);
|
||||
}
|
||||
|
||||
bool Intersects(Point pt)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Renderer.hpp"
|
||||
|
||||
namespace Tesses::Framework::Graphics::Renderers {
|
||||
|
||||
|
||||
class ImageRenderer : public Renderer {
|
||||
Image* image;
|
||||
public:
|
||||
ImageRenderer(Image* image);
|
||||
uint32_t Width();
|
||||
uint32_t Height();
|
||||
void SetPixel(Point pt,Color c);
|
||||
|
||||
};
|
||||
};
|
||||
@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Image.hpp"
|
||||
#include "../Rectangle.hpp"
|
||||
namespace Tesses::Framework::Graphics::Renderers {
|
||||
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
virtual uint32_t Width()=0;
|
||||
virtual uint32_t Height()=0;
|
||||
virtual void SetPixel(Point pt,Color c) = 0;
|
||||
virtual void DrawRectangle(Rectangle rect,Color c,bool fill);
|
||||
virtual void DrawImage(Point pt, Image* image);
|
||||
virtual ~Renderer();
|
||||
};
|
||||
};
|
||||
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
namespace Tesses::Framework::Graphics {
|
||||
class Size {
|
||||
public:
|
||||
Size()
|
||||
{
|
||||
|
||||
}
|
||||
Size(int32_t square)
|
||||
{
|
||||
this->Width = square;
|
||||
this->Height = square;
|
||||
}
|
||||
Size(int32_t width, int32_t height)
|
||||
{
|
||||
this->Width = width;
|
||||
this->Height = height;
|
||||
}
|
||||
int32_t Width=0;
|
||||
int32_t Height=0;
|
||||
bool IsSquare()
|
||||
{
|
||||
return Width == Height;
|
||||
}
|
||||
std::string ToString()
|
||||
{
|
||||
return std::to_string(Width) + "x" + std::to_string(Height);
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -23,7 +23,15 @@ namespace Tesses::Framework::Http
|
||||
~StreamHttpRequestBody();
|
||||
};
|
||||
|
||||
|
||||
class TextHttpRequestBody : public HttpRequestBody {
|
||||
std::string text;
|
||||
std::string mimeType;
|
||||
public:
|
||||
TextHttpRequestBody(std::string text, std::string mimeType);
|
||||
void HandleHeaders(HttpDictionary& dict);
|
||||
void Write(Tesses::Framework::Streams::Stream* strm);
|
||||
~TextHttpRequestBody();
|
||||
};
|
||||
|
||||
|
||||
class HttpRequest {
|
||||
|
||||
53
include/TessesFramework/Mail/Smtp.hpp
Normal file
53
include/TessesFramework/Mail/Smtp.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include "../Streams/Stream.hpp"
|
||||
namespace Tesses::Framework::Mail
|
||||
{
|
||||
class SMTPBody
|
||||
{
|
||||
public:
|
||||
std::string mimeType;
|
||||
virtual void Write(Tesses::Framework::Streams::Stream* strm)=0;
|
||||
virtual ~SMTPBody();
|
||||
};
|
||||
|
||||
class SMTPStringBody : public SMTPBody
|
||||
{
|
||||
public:
|
||||
SMTPStringBody();
|
||||
SMTPStringBody(std::string text, std::string mimeType);
|
||||
std::string text;
|
||||
void Write(Tesses::Framework::Streams::Stream* strm);
|
||||
};
|
||||
|
||||
class SMTPStreamBody : public SMTPBody
|
||||
{
|
||||
Tesses::Framework::Streams::Stream* stream;
|
||||
bool owns;
|
||||
public:
|
||||
SMTPStreamBody(std::string mimeType,Tesses::Framework::Streams::Stream& stream);
|
||||
SMTPStreamBody(std::string mimeType,Tesses::Framework::Streams::Stream* stream, bool owns);
|
||||
void Write(Tesses::Framework::Streams::Stream* strm);
|
||||
~SMTPStreamBody();
|
||||
};
|
||||
|
||||
|
||||
class SMTPClient {
|
||||
Tesses::Framework::Streams::Stream* strm;
|
||||
bool owns;
|
||||
public:
|
||||
SMTPClient(Tesses::Framework::Streams::Stream* stream,bool owns=true);
|
||||
SMTPClient(Tesses::Framework::Streams::Stream& strm);
|
||||
std::string domain;
|
||||
std::string username;
|
||||
std::string password;
|
||||
std::string from;
|
||||
std::string from_name;
|
||||
std::string to;
|
||||
std::string subject;
|
||||
SMTPBody* body;
|
||||
std::vector<std::pair<std::string,SMTPBody*>> attachments;
|
||||
void Send();
|
||||
~SMTPClient();
|
||||
};
|
||||
|
||||
}
|
||||
@ -24,10 +24,5 @@
|
||||
#include "Crypto/ClientTLSStream.hpp"
|
||||
#include "Crypto/MbedHelpers.hpp"
|
||||
#include "Lazy.hpp"
|
||||
#include "Graphics/ImageFormats/ImageFormat.hpp"
|
||||
#include "Graphics/ImageFormats/Bitmap.hpp"
|
||||
#include "Graphics/Renderers/ImageRenderer.hpp"
|
||||
#include "Graphics/Renderers/Renderer.hpp"
|
||||
#include "Graphics/Image.hpp"
|
||||
#include "Graphics/Color.hpp"
|
||||
#include "Mail/Smtp.hpp"
|
||||
#include "HiddenField.hpp"
|
||||
Reference in New Issue
Block a user