TABLE OF CONTENTS
- 1. Image/Photo
- 1.1. Photo/Photo.Tk_Photo
- 1.2. Photo/Create_(procedure)
- 1.3. Photo/Photo.Blank
- 1.4. Photo/Photo.Copy
- 1.5. Photo/Photo.Create_(function)
- 1.6. Photo/Photo.Data
- 1.7. Photo/Photo.Get
- 1.8. Photo/Photo.Get_Widget
- 1.9. Photo/Photo.Put
- 1.10. Photo/Photo.Read
- 1.11. Photo/Photo.Redither
- 1.12. Photo/Photo.Transparency_Get
- 1.13. Photo/Photo.Transparency_Set
- 1.14. Photo/Photo.Write
Image/Photo [ Packages ]
[ Top ] [ Image ] [ Packages ]
FUNCTION
Provides code for manipulate Tk image of type photo
SOURCE
package Tcl.Tk.Ada.Image.Photo with SPARK_Mode is pragma Elaborate_Body;
Photo/Photo.Tk_Photo [ Types ]
FUNCTION
This is a non-abstract type derived directly from Tk_Widget. Each of the derived widgets redefines the Create subprogram in order to create the correct type of widget.
SOURCE
type Tk_Photo is new Tk_Widget with private;
Photo/Create_(procedure) [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Creates a new Tk_Photo in the specified interpreter.
SOURCE
procedure Create (Widgt: out Tk_Photo; pathName: in String; options: in String := ""; Interp: in Tcl_Interp := Null_Interp) with Global => null;
PARAMETERS
Widgt - Tk_Photo which will be created pathName - Tk name of the image options - Options which will be passed to the image. Default value is empty Interp - Tcl interpreter to which the image will be created. If null, the image will be created in the "contextual" interpreter. Default value is null.
OUTPUT
Newly created Tk_Photo as parameter Widgt
EXAMPLE
-- Create image Paint from file mypaint.gif on the current Tcl interpreter declare My_Paint: Tk_Photo; begin Create(My_Paint, "Paint", "-file mypaint.gif"); end;
SEE ALSO
Photo.Create_(function)
COMMANDS
image create photo name ?options?
HISTORY
8.6.1 - Added
Photo/Photo.Blank [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Blank the image, make it transparent
SOURCE
procedure Blank(Image: in Tk_Photo);
PARAMETERS
Image - Tk_Photo to blank
EXAMPLE
-- Make transparent image My_Image Blank(My_Image);
COMMANDS
imageName blank
HISTORY
8.6.2 - Added
Photo/Photo.Copy [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Copy one photo to another
SOURCE
procedure Copy(Source, Target: in Tk_Photo; Options: in String := "");
PARAMETERS
Source - Tk_Photo which will be used as source Target - Tk_Photo which will be used as destination Options - Aditional Tk options for copy command. Default value is empty
EXAMPLE
-- Copy image My_Image to Other_Image and shrink it Copy(My_Image, Other_Image, "-shrink");
COMMANDS
target copy source ?option value(s) ...?
HISTORY
8.6.1 - Added
Photo/Photo.Create_(function) [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Creates a new Tk_Photo in the specified interpreter.
SOURCE
function Create (pathName: in String; options: in String := ""; Interp: in Tcl_Interp := Null_Interp) return Tk_Photo with Global => null;
PARAMETERS
pathName - Tk name of the image options - Options which will be passed to the image. Default value is empty Interp - Tcl interpreter to which the image will be created. If null, the image will be created in the "contextual" interpreter. Default value is null.
RESULT
Newly created Tk_Photo
EXAMPLE
-- Create image Logo from file mylogo.png on the current Tcl interpreter My_Logo: constant Tk_Photo := Create("Logo", "-file mylogo.png");
SEE ALSO
Photo.Create_(procedure)
COMMANDS
image create photo name ?options?
HISTORY
8.6.1 - Added
Photo/Photo.Data [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Get the selected image data
SOURCE
function Data(Image: in Tk_Photo; Options: in String := "") return String;
PARAMETERS
Image - Tk_Photo which will be queried for the data Options - Tk options for data to query. Default value is empty
RESULT
Image data, all if options are empty or specified option data
EXAMPLE
-- Get the data of the My_Image from (0,5) point to (10,10) ImageData: constant String := Data(My_Image, "0", "5", "10", "10");
COMMANDS
imageName data ?option value(s) ...?
HISTORY
8.6.2 - Added
Photo/Photo.Get [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Get color of the selected pixel in the image
SOURCE
function Get(Image: in Tk_Photo; X, Y: in String) return String with Pre'Class => X /= "" and Y /= "";
PARAMETERS
Image - Tk_Photo which will be queried for data X - X coordinate of pixel to get color Y - Y coordinate of pixel to get color
RESULT
Three values of colors red, green, blue from 0 to 255
EXAMPLE
-- Get the color of the pixel at (1, 4) of the My_Image PixelColor: constant String := Get(My_Image, "1", "4");
COMMANDS
imageName get x y
HISTORY
8.6.2 - Added
Photo/Photo.Get_Widget [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Get the existing Tk_Photo image
SOURCE
function Get_Widget (pathName: in String; Interp: in Tcl_Interp := Get_Context) return Tk_Photo with Global => null;
PARAMETERS
pathName - Tk path (starts with dot) for the image Interp - Tcl interpreter on which the image exists. Can be empty. Default value is current Tcl interpreter
RESULT
Existing Tk_Photo image
EXAMPLE
-- Get photo image with name .myphoto on the current Tcl interpreter My_Photo: constant Tk_Photo := Get_Widget(".myphoto");
HISTORY
8.6.9 - Added
Photo/Photo.Put [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Set pixels in the selected Tk_Photo to specified data
SOURCE
procedure Put (Image: in Tk_Photo; Data: in String; Options: in String := "") with Pre'Class => Data /= "";
PARAMETERS
Image - Tk_Photo which will be modified Data - Proper data for selected image format which will be changed Options - Additional options: -format or -to with proper values. Default value is empty
EXAMPLE
-- Set all pixels of the My_Image to red color Put(My_Image, "red");
COMMANDS
imageName put data ?option value(s) ...?
HISTORY
8.6.3 - Added
Photo/Photo.Read [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Read selected file and put it data to the selected Tk_Photo
SOURCE
procedure Read (Image: in Tk_Photo; FileName: in String; Options: in String := "") with Pre'Class => FileName /= "";
PARAMETERS
Image - Tk_Photo in which data will be loaded FileName - Name of file which will be read Options - Additional options for read data. Default value is empty
EXAMPLE
-- Read file myimage.png and put it to the My_Image Read(My_Image, "myimage.png"); -- Read file image.gif, put it into Some_Image and shrink Read(Some_Image, "image.gif", "-shrink");
COMMANDS
imageName read filename ?option value(s) ...?
HISTORY
8.6.3 - Added
Photo/Photo.Redither [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Recalculate dithered image
SOURCE
procedure Redither(Image: in Tk_Photo);
PARAMETERS
Image - Tk_Photo to recalculate
EXAMPLE
-- Redither My_Image Redither(My_Image);
COMMANDS
imageName redither
HISTORY
8.6.3 - Added
Photo/Photo.Transparency_Get [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Get the selected pixel transparency in the selected image
SOURCE
function Transparency_Get (Image: in Tk_Photo; X, Y: in String) return String with Pre'Class => X /= "" and Y /= "";
PARAMETERS
Image - Tk_Photo to query for transparency X - X coordinate of pixel to check Y - Y coordinate of pixel to check
RESULT
If pixel is transparent return true, otherwise false
EXAMPLE
-- Get the transparency of the pixel (5, 12) at My_Image Transparency: constant String := Transparency_Get(My_Image, "5", "12");
COMMANDS
imageName transparency get x y
HISTORY
8.6.3 - Added
Photo/Photo.Transparency_Set [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Set transparency for the selected pixel in the selected image
SOURCE
procedure Transparency_Set(Image: in Tk_Photo; X, Y, Enable: in String) with Pre'Class => X /= "" and Y /= "" and Enable in "true" | "false";
PARAMETERS
Image - Tk_Photo in which pixel transparency will be set X - X coordinate of the pixel which transparency will be set Y - Y coordinate of the pixel which transparency will be set Enable - If true, enable transparency, otherwise disable it
EXAMPLE
-- Enable transparency for pixel (7, 12) in My_Image Transparency_Set(My_Image, "7", "12", "true");
COMMANDS
imageName transparency set x y enable
HISTORY
8.6.3 - Added 8.6.8 - Fixed setting transparency
Photo/Photo.Write [ Subprograms ]
[ Top ] [ Photo ] [ Subprograms ]
FUNCTION
Write image to the specified file
SOURCE
procedure Write (Image: in Tk_Photo; FileName: in String; Options: in String := "") with Pre'Class => FileName /= "";
PARAMETERS
Image - Tk_Photo to write to the file FileName - Name of the file to which image will be written Options - Additional options for writting image to file. Default value is empty
EXAMPLE
-- Write My_Image to the "myimage.png" file in grayscale Write(My_Image, "myimage.png", "-grayscale");
COMMANDS
imageName write filename ?option value(s) ...?
HISTORY
8.6.3 - Added