diff --git a/docs/doc/AllClasses.html b/docs/doc/AllClasses.html index 6091635..c1b2e6e 100644 --- a/docs/doc/AllClasses.html +++ b/docs/doc/AllClasses.html @@ -399,7 +399,7 @@
Implementation of Canvas2d similar to HTML.
Implementation of a canvas similar to HTML Canvas2d.
Implementation of color quantization
Implementation of color quantization.
Generic class configuring and rendering an arrow
Generic class configuring and rendering an arrow.
Path (in 2D) that allows to define custom shapes that can be drawn
Path (in 2D) that allows to define custom shapes that can be drawn.
Scanner of random color
Scanner of random color.
Reading, writing and rendering for an SVG document
Reading, writing and rendering for an SVG document.
Cursor to go through a UTF8 text glyph by glyph
Cursor to go through a UTF8 text glyph by glyph.
8-bit grayscale image
8-bit grayscale image.
Content for an SVG element
Content for an SVG element.
Container for Windows resources
Container for Windows resources.
Returns an array with bidirectional analysis with specified text direction.
Returns an array with bidirectional analysis with specified text direction.
Returns an array with bidirectional analysis with automatic text direction.
Display order of characters.
Adds special unicode characters to make it a quote in a specific direction.
Adds special unicode characters around the text to change it's direction.
Returns an array with bidirectional analysis with automatic text direction.
Returns an array with bidirectional analysis with specified text direction.
Returns an array with bidirectional analysis with specified text direction.
Display order of characters.
Implementation of Canvas2d similar to HTML.
Implementation of a canvas similar to HTML Canvas2d.
Implementation of color quantization
Implementation of color quantization.
Generic class configuring and rendering an arrow
Generic class configuring and rendering an arrow.
Path (in 2D) that allows to define custom shapes that can be drawn
Path (in 2D) that allows to define custom shapes that can be drawn.
Scanner of random color
Scanner of random color.
Reading, writing and rendering for an SVG document
Reading, writing and rendering for an SVG document.
Cursor to go through a UTF8 text glyph by glyph
Cursor to go through a UTF8 text glyph by glyph.
8-bit grayscale image
8-bit grayscale image.
Content for an SVG element
Content for an SVG element.
Container for Windows resources
Container for Windows resources.
Adds special unicode characters to make it a quote in a specific direction.
Adds special unicode characters around the text to change it's direction.
-Generic class configuring and rendering an arrow
+Generic class configuring and rendering an arrow. ++ + +
Example using different kind of arrows: + +
+ +
+ ++uses BGRABitmap, BGRABitmapTypes; + +procedure TForm1.FormPaint(Sender: TObject); +var bmp:TBGRABitmap; + w: single; +begin + bmp := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAWhite); + w := sqrt(ClientWidth*ClientHeight)/50; + + // diagonal arrow + bmp.Arrow.StartAsTail; + bmp.Arrow.StartRepeatCount := 2; + bmp.Arrow.EndAsTriangle(0.25,False,True); + bmp.DrawPolyLineAntialias( + bmp.ComputeOpenedSpline([PointF(80,80),PointF(ClientWidth-160,ClientHeight div 2),PointF(ClientWidth-80,ClientHeight-20)],ssCrossingWithEnds), + BGRABlack,w); + bmp.Arrow.StartRepeatCount := 1; //restore default value + + // top arrow + bmp.Arrow.StartAsClassic(True,True,3); + bmp.Arrow.StartOffsetX := -8; + bmp.Arrow.EndAsClassic(False,True); + bmp.DrawPolyLineAntialias( + bmp.ComputeOpenedSpline([PointF(40,60),PointF(ClientWidth div 3,20),PointF(ClientWidth-80,40)],ssCrossingWithEnds), + BGRABlack,w); + bmp.Arrow.StartOffsetX := 0; //restore default value + + // left arrow + bmp.Arrow.StartAsClassic(True,True); + bmp.Arrow.StartSize := PointF(1,2); + bmp.Arrow.StartOffsetX := -5.5; + bmp.Arrow.StartRepeatCount := 3; + bmp.Arrow.EndAsTriangle(0.75); + bmp.DrawLineAntialias(20,90, 80,ClientHeight-40, + BGRABlack,w); + bmp.Arrow.StartSize := PointF(2,2); //restore default values + bmp.Arrow.StartOffsetX := 0; + bmp.Arrow.StartRepeatCount := 1; + + // right arrow + bmp.Arrow.StartAsClassic; + bmp.Arrow.EndAsClassic(False,False,2); + bmp.DrawLineAntialias(ClientWidth-40,40,ClientWidth-40,ClientHeight-80,BGRABlack,w); + + bmp.Draw(Canvas,0,0); + bmp.Free; +end;+ +
-Stroke transformation matrix (applied only to stroke and not to path points)
+Stroke transformation matrix. ++ + +
This matrix is applied only to stroke and not to path points. + +
Example of skew transform: + +
+ +
+ ++uses BGRABitmapTypes, BGRATransform; + +procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap); +var + i: Integer; +begin + for i := 0 to 5 do + begin + Bitmap.Pen.StrokeMatrix := AffineMatrixSkewXDeg(-10*i); + Bitmap.Pen.LineCap := pecSquare; + Bitmap.DrawLineAntialias(40,40+i*80,Bitmap.Width div 2-40,40+i*80, BGRABlack,30); + Bitmap.Pen.LineCap := pecRound; + Bitmap.DrawLineAntialias(Bitmap.Width div 2+40,40+i*80,Bitmap.Width-40,40+i*80, BGRABlack,30); + end; +end;+ +
Class TBGRACustomArrow |
-Generic class configuring and rendering an arrow | +Generic class configuring and rendering an arrow. |
Class TBGRACustomBitmap |
diff --git a/docs/doc/BGRACanvas2D.TBGRACanvas2D.html b/docs/doc/BGRACanvas2D.TBGRACanvas2D.html
index 0a75d75..1b0a80a 100644
--- a/docs/doc/BGRACanvas2D.TBGRACanvas2D.html
+++ b/docs/doc/BGRACanvas2D.TBGRACanvas2D.html
@@ -25,11 +25,15 @@
- -
+TBGRACanvas2D
TBGRACanvasState2D
-Implementation of color quantization
+Implementation of color quantization. ++ + +
Example saving an image into 8-bit PNG file:
+ ++uses BGRAColorQuantization, BGRABitmapTypes, BGRABitmap; +var + quant : TBGRAColorQuantizer; + sourceBmp: TBGRABitmap; +begin + sourceBmp := TBGRABitmap.Create('picture_in_32_bits.bmp'); + quant := TBGRAColorQuantizer.Create(sourceBmp, acFullChannelInPalette); + // by default, reduces to 256 colors + quant.SaveBitmapToFile(daFloydSteinberg, sourceBmp, 'picture_in_8_bits.png'); + quant.Free; + sourceBmp.Free; +end;+ +
TBGRAColorQuantizer
TBGRAColorTree
-Scanner of random color
+Scanner of random color. ++ + +
Example filling a form with random pixels: + +
+ +
+ ++uses ..., BGRABitmap, BGRAGradientScanner; + +procedure TForm1.FormPaint(Sender: TObject); +var bmp: TBGRABitmap; + scan: TBGRARandomScanner; +begin + bmp := TBGRABitmap.Create(ClientWidth, ClientHeight); + scan := TBGRARandomScanner.Create(False, 255); + bmp.Fill(scan); + scan.Free; + bmp.Draw(Canvas,0,0); + bmp.Free; +end;+ +
TBGRARandomScanner
TBGRASimpleGradient
-8-bit grayscale image
+8-bit grayscale image. ++ + +
Example on applying a grayscale mask: + +
A red triangle is masked using an ellipse shape.
+ ++uses BGRABitmap, BGRABitmapTypes, BGRAGrayscaleMask; + +procedure TForm1.FormPaint(Sender: TObject); +var tmp, layer: TBGRABitmap; + mask: TGrayscaleMask; + poly : ArrayOfTPointF; +begin + layer := TBGRABitmap.Create(clientwidth, clientheight, BGRAPixelTransparent); + setLength(Poly,3); + poly[0] := PointF(10, 10); + Poly[1] := PointF(layer.width-10, 10); + Poly[2] := PointF(10, layer.height-10); + layer.DrawPolygonAntialias(poly, cssBlack, 3, cssRed); + + mask := TGrayscaleMask.Create(clientwidth, clientheight, TByteMask.New(0)); + mask.FillEllipseAntialias(mask.Width/2-0.5, mask.Height/2-0.5, + mask.Width/2, mask.Height/2, TByteMask.New(255)); + layer.ApplyMask(mask); + mask.Free; + + tmp := TBGRABitmap.create (clientwidth, clientheight, cssWhite); + tmp.PutImage(0,0, layer, dmDrawWithTransparency); + tmp.Draw (canvas,0,0); + tmp.free; +end;+ +
TGrayscaleMask
-
A frame buffer is a texture that can be used as a drawing surface in OpenGL.
+A frame buffer is a texture that can be used as a drawing surface in OpenGL. + +
Example of drawing on a framebuffer and then drawing it on the OpenGL control: + +
+ ++uses ..., BGRABitmapTypes, BGRAOpenGL; + +procedure TForm1.OpenGLControlPaint(Sender: TObject); +var + mousePos: TPoint; + buf: TBGLFrameBuffer; +begin + // Draw Background + BGLViewPort(OpenGLControl.Width, OpenGLControl.Height, BGRAWhite); + // Create framebuffer + buf := TBGLFrameBuffer.Create(256,256); + // Use it + BGLCanvas.ActiveFrameBuffer := buf; + + BGLCanvas.Fill(CSSYellow); + BGLCanvas.Line(0,0,128,128, BGRABlack); + mousePos := ScreenToClient(Mouse.CursorPos); + BGLCanvas.FillRect(mousePos.x - 50, mousePos.y - 50, mousePos.x + 50, mousePos.y + 50, CSSRed, False); + + // Render framebuffer on the control + BGLCanvas.ActiveFrameBuffer := nil; + BGLCanvas.PutImage(0,0, buf.Texture); + // Free framebuffer + buf.Free; + + // Update + OpenGLControl.SwapBuffers; +end;+ +
property DominantColor: TBGRAPixel read GetDominantColor;
This item has no description.
+Colors that is the most represented in the source
+property ReducedPalette: TBGRACustomApproxPalette read GetPalette; |
|
- This item has no description. |
property ReductionColorCount: Integer read GetReductionColorCount write SetReductionColorCount; |
|
- This item has no description. |
property SourceColor[AIndex: integer]: TBGRAPixel read GetSourceColor; |
|
- This item has no description. |
property SourceColorCount: Integer read GetSourceColorCount; |
|
- This item has no description. |