際際滷

際際滷Share a Scribd company logo
于仄亠仆舒 亞舒亳从舒
丕丐
             仍亠从舒仆亟
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
丼丐亂
仂仍仂仆仂于亶 从舒仆
丕亞仍 从舒仆仂于 CMYK
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
丶亠仆舒仍仆舒 礆从舒
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
?
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
个仂仄 仗亳从亠仍亠亶
仍ム 亳 仄亳仆
仍ム 亳 仄亳仆


         Y


             X
仍ム 亳 仄亳仆


   Y
       Z


       X
仍ム 亳 仄亳仆
礆仂亞仂仍仆亠
弌
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
弌仂仂仆仂亠仆亳亠 仂仂仆

          仂仆亳仂          1.0
          PAL              1.09
          PAL Widescreen   1.46
          NTSC             0.91
          NTSC Widescreen 1.21
          Anamorphic       2.0
          Cinemascope      2.39
丼丐
丐
弌亂?
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
从仂 仂 亟亳
仆舒
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亠仂弍舒亰仂于舒仆亳亠 从仂仂亟亳仆舒
              仄舒舒弍       于舒亠仆亳亠




                          仗亠仗亠从亳于仆舒
仄亠亠仆亳亠      亳从舒亢亠仆亳亠
                            仗仂亠从亳
Alexander Burt - Inside of 2D-graphics
仄亠亠仆亳亠
仄舒舒弍
仄亠亠仆亳亠
于舒亠仆亳亠
仗亠仗亠从亳于仆舒
  仗仂亠从亳
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
  弌
  丐  
      
      丶  亊
弌从舒仆仍亳仆亳亳
弌从舒仆仍亳仆亳亳
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
弍亳 仆0 
  1   1
byte   b = 0xFF;   // 8 弍亳仂于
ushort w = 0xFFFF; // 16 弍亳仂于
0    1     2     3     4      5    6     7     8    9     A     B    C      D     E     F    ?



00   10
     10   20
           20   30
                 30   40
                       40   50
                             50 6060 70 70 80 80 90 90 A0 A0 B0 B0C0 C0D0    E0
                                                                            D0     F0
                                                                                  E0    F0
                                                                                        FF   FF
0    1      2     3     4         5        6        7         8         9          A        B        C         D     E     F



00    10    20    30    40    50       60       70        80        90        A0        B0       C0       D0    E0    F0   FF


00    11    22    33     44    55       66           77        88        99        AA        BB       CC       DD    EE    FF


000   111   222   333   444    555       #fff 
                                        666 777           #ffffff
                                                           888 999                 AAA       BBB      CCC      DDD   EEE   FFF



0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 AAAA BBBB CCCC DDDD EEEE FFFF
8
byte b = 0x98;
ushort w = b << 8; // 0x9800
ushort w = (b << 8) | b; // 0x9898
8
ushort w = 0x98FF;
byte b = w >> 8; // 0x98
byte b = (w + 0x80) >> 8; // 0x997F >> 8 = 0x99
96            97            98              99            9A




9666   96EE   9777   97FF   9888     9911   9999   9A22   9AAA



                                   98FF
ushort w = 0x98FF;
byte b = w >> 8; // 0x98
byte b = (w + 0x80) >> 8; // 0x997F >> 8 = 0x99
ushort w = 0x9900;
byte b = w >> 8; // 0x99
byte b = (w + 0x80) >> 8; // 0x9980 >> 8 = 0x99
96            97            98             99            9A




9666   96EE   9777   97FF   9888    9911   9999   9A22   9AAA



                                   9900
ushort w = 0x9900;
byte b = w >> 8; // 0x99
byte b = (w + 0x80) >> 8; // 0x9980 >> 8 = 0x99
96            97            98                 99            9A
                                        111

                                   88

9666   96EE   9777   97FF   9888        9911   9999   9A22   9AAA
ushort w = 0x9900;

byte b =
      ((w & 0xF000) >> 8)
    | ((w & 0x0FFF) + 0x88) / 0x111; // 0x98
ushort w = 0x9900;
              byte b = w >> 8;
              byte b = (w + 0x80) >> 8;


00                01               FF



     0000..00FF
                        ...             FF00..FFFF
Image
   class Image
   {
   public:
       Image(uint width, uint height)
           : m_width(width)
           , m_height(height)
       {
           m_buffer = (pix8*)calloc(m_width * m_height, sizeof(pix8));
       }

        ~Image() { free(m_buffer); }

        uint   GetWidth() { return m_width; }
        uint   GetHeight() { return m_height; }

        pix8* GetBuffer() const { return m_buffer; }

   private:
       uint    m_width;
       uint    m_height;

        pix8* m_buffer;
   };
Graphics
class Graphics
{
public:
    Graphics(Image* image) : m_image(image) {}

   void FillRect(int x, int y, int width, int height, const Brush& brush);
   void DrawImage(int x, int y, Image* image, float opacity);

   /*
    *
    *
    *
    *                            ...etc...
    *
    *
    *
    */

private:
    Image* m_image;
};
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亟亳仆亳仆亶 仂亠亰仂从
仆亠仗仂仍亳


     A         B   C
丶亠仍亠 亳仍舒
float a =  ; // [0..1]
float b =  ; // [0..1]

float c = a * b;
int a =  ; // [0..255]
int b =  ; // [0..255]

int c = a * b;
float fa = (float)a / 255.0;
float fb = (float)b / 255.0;

int c = (int)((fa * ft) * 255.0);
int MultInt(int a, int b)
{
    return (a * b) / 255;
}
int MultInt(int a, int b)
{
    return (a * b) >> 8; // (a * b) / 256
}
int MultInt(int a, int b)
{
    return (a * b + 0x80) >> 8;
}
int MultInt(int a, int b)
{
    int temp = a * b + 0x80;
    return (temp + (temp >> 8)) >> 8;
}
仆仂亞舒弍从
int a =  ; // [0..255]
int b =  ; // [0..255]
int t =  ; // [0..255]

int c = a + IntMult(b  a, t);
int p1 =  ; // 0xAARRGGBB
int p2 =  ; // 0xAARRGGBB
int t =  ; // [0..255]

int   r1   =   (p1 >> 16)    &   0xFF;
int   g1   =   (p1 >> 8)     &   0xFF;
int   b1   =   (p1      )    &   0xFF;
int   a1   =   (p1 >> 24)    &   0xFF;

int   r2   =   (p2 >> 16)    &   0xFF;
int   g2   =   (p2 >> 8)     &   0xFF;
int   b2   =   (p2      )    &   0xFF;
int   a2   =   (p2 >> 24)    &   0xFF;

int   r3   =   r1   +   MultInt(r2      r1,   t);
int   g3   =   g1   +   MultInt(g2      g1,   t);
int   b3   =   b1   +   MultInt(b2      b1,   t);
int   a3   =   a1   +   MultInt(a2      a1,   t);

int p3 =
      (r3 << 16)
    | (g3 << 8)
    | (b3      )
    | (a3 << 24);
union pix8
{
    int RGBA;
    struct { byte R, G, B, A };
};

//
// ...
//

pix8& p1 = (pix8&) ; // 0xAARRGGBB
pix8& p2 = (pix8&) ; // 0xAARRGGBB
int t =  ; // [0..255]

pix8 p3;

p3.R   =   p1.R   +   MultInt(p2.R      p1.R,   t);
p3.G   =   p1.G   +   MultInt(p2.G      p1.G,   t);
p3.B   =   p1.B   +   MultInt(p2.B      p1.B,   t);
p3.A   =   p1.A   +   MultInt(p2.A      p1.A,   t);
丶于亠仂于亠 仗仂舒仆于舒
丶于亠仂于亠 仗仂舒仆于舒
从仂仄仗仂仆亠仆仆亠   仂仄舒亳亠从亳亠   从仂仆亠仗舒仍仆亠
舒仗亠亟亠仍亠仆亳亠 从仂仆仂于
CIE 1931 2属 弌舒仆亟舒仆亶 仆舒弍仍ミ莞委亠仍
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9   1
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9   1
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9   1
舒仄
1
0.9
                                                    仗亠从舒仍仆亶
                                                        仍仂从
0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7    0.8   0.9   1
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7 1 0.8   0.9

                                        亳仂仍亠仂于亶 从舒亶
舒仄
1
0.9


0.8                                              仍仂从
0.7                                           仆仂亞仂 亠仍舒
0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6    0.7   0.8   0.9   1
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9   1
舒仄
1
0.9


0.8


0.7


0.6


0.5


0.4


0.3


0.2


0.1



0
      0   0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9   1
R     R


G    G


B   B0
H   1-H


S    S


V    V
Alexander Burt - Inside of 2D-graphics
仂仄仗仂仆仂于从舒
 (compositing)
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亠亠仄仆仂亢亠仆亳亠
丶于亠舒


               仆亠仗亠亠仄仆仂亢亠仆仆亶
                (unpremultiplied)




               仗亠亠仄仆仂亢亠仆仆亶
                (premultiplied)
亠亠仄仆仂亢亠仆亳亠
亠亠仄仆仂亢亠仆亳亠
  舒 亟 亳 亠 仆
2 于亠舒
4 于亠舒
仍亳仆亠亶仆亶   舒亟亳舒仍仆亶   亞仍仂于仂亶



   t
                  t           t
Alexander Burt - Inside of 2D-graphics
smoothness = 100%
smoothness = 100%
smoothness = 100%
亰仂弍舒亢亠仆亳
仆亠仗仂仍亳
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
舒仂仆亶
舒仆亳舒仍亳舒亳仆亞
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亰仂
丿亠亶亟亠
class ColorBrush : Brush
{
public:
    ColorBrush(const Color& color) : m_color(color) {}

   // virtual
   void FillScanline(Image& img, int y, int[] edges)
   {
       assert(edges.Count % 2 == 0);

       for (int i = 0; i < edges.Count; i += 2)
       {
           for (int x = edges[i]; x < edges[i + 1]; x++)
           {
               pix8& pix = img.Buffer[y * img.Width + x];
               pix = Over(pix8(m_color), pix);
           }
       }
   {

private:
    Color m_color;
};
Brush
  Color Brush
  Gradient Brush
     Linear Gradient Brush
     Radial Gradient Brush
     Angular Gradient Brush
  Pattern Brush
  Noise Brush
  ...
亠从仂仆舒

亞舒亳从舒
仂仍亳亞仂仆
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
丼仆仂亠-仆亠仆仂亠
丼仆仂亠-仆亠仆仂亠
Alexander Burt - Inside of 2D-graphics
亠仆仍亠于舒 仆舒仄仂从舒
丐仂仍亠
 仍亳仆亳亳
Alexander Burt - Inside of 2D-graphics
仂仆
          仗亠




        从于舒亟舒仆亠




         从亞仍亠
仗 从仂仂亟亳仆舒




    void DrawLine(FPoint p1, FPoint p2, float width)
    {
        p1 += FPoint(0.5, 0.5);
        p2 += FPoint(0.5, 0.5);

        // ...
    }



   DrawLine(FPoint(3, 2), FPoint(12, 2), 1);
仗 从仂仂亟亳仆舒




    void DrawLine(FPoint p1, FPoint p2, float width)
    {
        p1 += FPoint(0.5, 0.5);
        p2 += FPoint(0.5, 0.5);

        // ...
    }



   DrawLine(FPoint(3, 2), FPoint(12, 2), 2);
仗 从仂仂亟亳仆舒




       void DrawLine(FPoint p1, FPoint p2, float width)
       {
           p1 += FPoint(0.5, 0.5);
           p2 += FPoint(0.5, 0.5);

           // ...
       }



  DrawLine(FPoint(3.5, 1.5), FPoint(11.5, 1.5), 2);
仗 从仂仂亟亳仆舒




       void DrawLine(FPoint p1, FPoint p2, float width)
       {
           // ...
       }




  DrawLine(FPoint(3, 2), FPoint(13, 2), 2);
仗 从仂仂亟亳仆舒




       void DrawLine(FPoint p1, FPoint p2, float width)
       {
           // ...
       }




  DrawLine(FPoint(3, 2), FPoint(13, 2), 1);
仗 从仂仂亟亳仆舒




       void DrawLine(FPoint p1, FPoint p2, float width)
       {
           // ...
       }




  DrawLine(FPoint(3, 2.5), FPoint(13, 2.5), 1);
丐仂仍亠 仗仂仍亳仍亳仆亳亳
弌从亳

  舒从仂于亶   亞仂仍仆亶   从亞仍亶
个舒从仂于亶 从
个舒从仂于亶 从
亞仍亶 从
亞仍亶 从
丕亞仂仍仆亶 从
丕亞仂仍仆亶 从
丕亞仂仍仆亶 从
丕亞仂仍仆亶 从
亳仂于仂亠 仂仂仆仂亠仆亳亠
亳仂于亶 仍亳仄亳
亳仂于亶 仍亳仄亳
亳仂于仂亠 仂仂仆仂亠仆亳亠 (WPF)
亳仂于亶 仍亳仄亳 (WPF)
丐仂仍亠 仗仂仍亳仍亳仆亳亳
丐仂仍亠 仗仂仍亳仍亳仆亳亳
丐仂仍亠 仗仂仍亳仍亳仆亳亳
丐仂仍亠 仗仂仍亳仍亳仆亳亳
丐   仂   仆   从   亳   亠   仍   亳   仆   亳   亳
1 px
<1 px   1 px
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
float _width = max(1, width);

float _opacity =
    width < 1
    ? opacity * width
    : opacity;

DrawLine(..., _width, _opacity);
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亰仆舒亠仄 t, 从舒从舒 P01?

亰仆舒亠仄 P01, 从舒从仂亶 t?
// float t

float _1mt = 1  t;

p01.X = _1mt * p0.X + t * p1.X;
p01.Y = _1mt * p0.Y + t * p1.Y;
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
// float t

float tm1      =   t    1;
float t2       =   t *   t;
float tm12     =   tm1   * tm1;
float _2ttm1   =   2 *   t * tm1;

p012.X = tm12 * p0.X  _2ttm1 * p1.X + t2 * p2.X;
p012.Y = tm12 * p0.Y  _2ttm1 * p1.Y + t2 * p2.Y;
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
// float t

float    t2   = t * 2;
float    t3   = t2 * t;
float   _1mt = 1  t;
float   _1mt2 = _1mt * _1mt;
float   _1mt3 = _1mt2 * _1mt;
float   _3t_1mt2 = 3 * t * _1mt2;
float   _3t2_1mt = 3 * t2 * _1mt;

p0123.X = _1mt3 * p0.X  _3t_1mt2 * p1.X + _3t2_1mt * p2.X + t3 * p3.X;
p0123.Y = _1mt3 * p0.Y  _3t_1mt2 * p1.Y + _3t2_1mt * p2.Y + t3 * p3.Y;
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
亠仂亟 ム仂仆舒
亠仂亟 ム仂仆舒
亠仂亟 ム仂仆舒
亠仂仄亠亳亠从亳亠
仂仄
亞亳/仍仍亳仗
Alexander Burt - Inside of 2D-graphics
从亳
Alexander Burt - Inside of 2D-graphics
舒从亞仍仆仆亠 亞仍
弌亳仆仂亳亟
弌亞仍舒亢亳于舒仆亳亠


 (antialiasing)
仆舒仍亳亳亠从仂亠 亞仍舒亢亳于舒仆亳亠




            %
仆舒仍亳亳亠从仂亠 亞仍舒亢亳于舒仆亳亠
仆舒仍亳亳亠从仂亠 亞仍舒亢亳于舒仆亳亠
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
弌丕
弌
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
弍仍仂仄  仗仂亰舒仆仂
舒仗仂仍仂亢亠仆亳亠 弍仗亳从亠仍亠亶
RGB (亞仂亳亰仂仆舒仍仆仂)
RGB (于亠亳从舒仍仆仂)
RGB (TV)
Alexander Burt - Inside of 2D-graphics
Bayer
Hexagonal
PenTile RBG-GBR
PenTile RG-B-GR
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Faux italic
Faux italic
Faux italic
丐亊 
丐亊 
丐亊 
丐亊 
丐亊 
丐亊 
丐亊 
丐亊
仂仆舒仆仂 亰亠仆亳




                           100:1*


* 仂仂弍亠-仂 1000:1, 仆仂 亳仗亳仆亠 仍仂于亳 仆亠 仗仂亰于仂仍ム
仂仂亞 舒亰仍亳亠仆亳




          Y   Y+Y


   Y0
         Y  0.01
弌从仂仍从仂 仆亢仆仂 弍亳仂于?


                 14 弍亳仂于




                      9 弍亳仂于*




* 仂 亠 8 :)
弌从仂仍从仂 仆亢仆仂 弍亳仂于?



           256
           8 弍亳仂于
仂弍仍亠仄舒 从仂亟舒 100

   0 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 揃 255

                   仍亳仆亳亠




                                  仆亠 于舒舒亠
                         0.01
仂弍仍亠仄舒 从仂亟舒 100




     仍亳仆亳亠




              仆亠 于舒舒亠
C  Corrected
L  Linear
 于亠舒

    亞舒仄仄舒                                          亞舒仄仄舒 束亞舒仄仄舒損
   从舒仄亠      亟亠亞舒仄仄舒                亞舒仄仄舒       仄仂仆亳仂舒 亞仍舒亰



                             ?
于亠        8-bit   16-bit       16-bit   8-bit        于亠   亰亠仆亳亠
            RGB      RGB          RGB     RGB
C  Corrected
L  Linear
亟仍 仆舒亳 亞仍舒亰
于亠 弍仂仍亠亠 于亠仍亶,
           于亠仍亶
亠仄 亠仄仆仂舒 仄仆舒
舒仍亳弍舒亳




   0.8
舒仍亳弍舒亳




   1.0
舒仍亳弍舒亳




   1.2
舒仍亳弍舒亳




   1.4
舒仍亳弍舒亳




   1.6
舒仍亳弍舒亳




   1.8
舒仍亳弍舒亳




   2.0
舒仍亳弍舒亳




   2.2
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
1




0
    R   G   B   R   G   B   R   G   B
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
舒亰弍仂
(dithering)
Alexander Burt - Inside of 2D-graphics
仗仂仂亞
仍舒亶仆仂

舒仗仍亠仆亳亠

仗仂仍仂仆

Bayer

Floyd-Steinberg
Alexander Burt - Inside of 2D-graphics
Alexander Burt - Inside of 2D-graphics
仗亳仄亳亰舒亳
弍仂 磶从舒

  弌 (仆亠亟仂弌++)
MMX
从仍ム亠仆亳亠 从舒从 仗舒于亳仍仂
GetPixel(int x, int y);
SetPixel(int x, int y, int color);




pix8* buffer = image->GetBuffer();
int imageWidth = image->GetWidth();

...buffer[y * imageWidth + x]...
if (...)
       {

       }
       else
       {

       }




int c = min(a, b); // c = a < b ? a : b
int c = a + (((b - a) >> 31) & (b - a));
int b = a / 3;
int b = (int)(((__int64)a * 0x55555556) >> 32);
丕舒仍亳?

More Related Content

Alexander Burt - Inside of 2D-graphics

Editor's Notes

  1. 亊 弌舒舒 . 仂 仗仂仍亠亟仆亠亠 仄亠仂 舒弍仂 Parallels, 亞亟亠 弍仍 亞仍舒于仆仄 亟亳亰舒亶仆亠仂仄 UX. 仂仍亠亟仆亳亠 亟于舒 仗仂仍仂于亳仆仂亶 亞仂亟舒 亟亠仍舒 于仂亶 仗仂亠从, 于 舒仄从舒 从仂仂仂亞仂 仆舒仗亳舒仍 亟于仄亠仆 亞舒亳亠从 弍亳弍仍亳仂亠从. 亅舒 仗亠亰亠仆舒亳 仂 仂仄, 亳亰 亠亞仂 仂仂亳 舒从舒 弍亳弍仍亳仂亠从舒 亳 从舒从亳亠 亠 仆ミ夷術 亳 仗仂亟于仂亟仆亠 从舒仄仆亳.
  2. 亳从亠仍亳 仆舒 仂从亢舒仍亳 于亠亞亟舒.
  3. 亳 仆亠 仂仍从仂 仆舒 亰亠仄仍亠
  4. 仆亠从仂仂亠 仗亳从亠仍亳 仄仂亢仆仂 亟于亳亞舒
  5. 仗亳从亠仍亳 仄仂亢仆仂 亞仗仗亳仂于舒
  6. 仗仂 仄亠亠 仂亞仂, 从舒从 仄 于 仂 仗仂仆亳仄舒仍亳, 仆舒亠 于仂仂弍舒亢亠仆亳亠 仆舒弍亳舒仍仂 从仂仂
  7. (仂仂舒 舒) 仄 亰舒仄亠亳仍亳, 仂 仗亳从亠仍亳 仄仂亞 弍 舒亰仆仂亶 仂仄 亳 舒亰仆 舒亰仄亠仂于
  8. 于 1860 亞亞 仄 仗仂舒于亳仍亳 仂 仗亳仆亳仗 仆舒 从仂仆于亠亶亠
  9. 亠仄仆亠亠 舒仄, 亞亟亠 仂从亳 亢亳仆亠亠亠仍亳 亠亠 于亠舒, 仂 从舒仆 仗仂于仆, 仂弍 仄亠仆亳 仗仂于仂亠仆亳 亰仂舒
  10. 亠仄仆亠亠 舒仄, 亞亟亠 仂从亳 亢亳仆亠亠亠仍亳 亠亠 于亠舒, 仂 从舒仆 仗仂于仆, 仂弍 仄亠仆亳 仗仂于仂亠仆亳 亰仂舒
  11. 亠亰仍舒 仗仂仍舒亠 于仂 舒从仂亶
  12. 仗舒仗亳
  13. 仗礆仂亞仂仍仆亳从亳
  14. 亠仂弍舒亰仂于舒仆亳亠 从仂仂亟亳仆舒
  15. 亠仂弍舒亰仂于舒仆亳亠 从仂仂亟亳仆舒
  16. 亠仂弍舒亰仂于舒仆亳亠 从仂仂亟亳仆舒
  17. 亠仗亠从亳于仆仂亶 仗仂亠从亳亳 于舒亳 亟仍 仗仂仂亞仂 束舒亶仗舒亟仆仂亞仂損 3D
  18. 从舒仆仍亳仆亳亳 仗仂亰于仂仍ム 仆舒仍舒亟亳 亠从亳于仆仂亠 仂弍亠仆亳亠 仄亠亢亟 仍仂亞亳亠从亳仄 从仂亟仂仄 (仄亠亟仍亠仆仆仄) 亳 舒仆仄 从仂亟仂仄 (弍仄)
  19. 舒亠亳亰舒亳
  20. 于 仗仂仍仂舒 舒亰舒 仄亠亟仍亠仆仆亠亠
  21. 从舒舒亠仍仆亠 亟仂仍亢仆 弍 亞仂亳亰仂仆舒仍仆仄亳
  22. (仗亳于亠 仂 仆舒亠亞仂 亟亞舒 :)
  23. 舒从 从舒从舒, 仂仍从仂 仆舒仂弍仂仂
  24. 丕亞仂仍 亰亠仆亳; 仗仂弍仍亠仄舒 亞舒仄仄仂亶 仂舒.
  25. 丕亞仂仍 亰亠仆亳; 仗仂弍仍亠仄舒 亞舒仄仄仂亶 仂舒.
  26. 丕亞仂仍 亰亠仆亳; 仗仂弍仍亠仄舒 亞舒仄仄仂亶 仂舒.