DrawGraphicsToDDSTextureAndSave

From GECK
Jump to: navigation, search


A function added by the SUP NVSE Plugin.

Description

Creates an empty .DDS texture with specified graphic element(s).

Syntax

[help]
DrawGraphicsToDDSTextureAndSave Folder:string File:string Multidimensional Array:array Width:int Height:int

Example

DrawGraphicsToDDSTextureAndSave "MyMod" "MyTextureTest.dds" ar_DrawElements 500 500

Will write elements stored in multidimensional array to "MyTextureTest.dds" which will be located in "Data\textures\SUPTextures\MyMod" folder.

Example of use:

array_var ar_DrawElements
array_var ar_DrawElementsText1
array_var ar_DrawElementsText2
array_var ar_DrawElementsImage1
array_var ar_DrawElementsImage2

let ar_DrawElements :=ar_construct "array"

let ar_DrawElementsText1 := ar_construct "array"
Ar_Append ar_DrawElementsText1 1 ;Text
Ar_Append ar_DrawElementsText1 "MyText" ;Text to draw
Ar_Append ar_DrawElementsText1 "Arial" ;Font to draw
Ar_Append ar_DrawElementsText1 16 ; Font size
Ar_Append ar_DrawElementsText1 100 ; Position X of text
Ar_Append ar_DrawElementsText1 500 ; Position Y of text
Ar_Append ar_DrawElementsText1 255 ; ColorR
Ar_Append ar_DrawElementsText1 0 ; ColorG
Ar_Append ar_DrawElementsText1 0 ; ColorB
Ar_Append ar_DrawElementsText1 255 ; Text Alpha
Ar_Append ar_DrawElements ar_DrawElementsText1

let ar_DrawElementsText2 := ar_construct "array"
Ar_Append ar_DrawElementsText2 1 ;Specify type of element to draw
Ar_Append ar_DrawElementsText2 "MyText 2" ;Text to draw
Ar_Append ar_DrawElementsText2 "Arial" ;Font to draw
Ar_Append ar_DrawElementsText2 16 ; Font size
Ar_Append ar_DrawElementsText2 400 ; Position X of text
Ar_Append ar_DrawElementsText2 500 ; Position Y of text
Ar_Append ar_DrawElementsText2 0 ; ColorR
Ar_Append ar_DrawElementsText2 255 ; ColorG
Ar_Append ar_DrawElementsText2 0 ; ColorB
Ar_Append ar_DrawElementsText2 255 ; Text Alpha
Ar_Append ar_DrawElements ar_DrawElementsText2

let ar_DrawElementsImage1 := ar_construct "array"
Ar_Append ar_DrawElementsImage1 10 ;Image
Ar_Append ar_DrawElementsImage1 "TESTING.jpg" ;Image to Draw
Ar_Append ar_DrawElementsImage1 10 ;specifies the x-coordinate of the upper-left corner of the destination position at which to draw the image.
Ar_Append ar_DrawElementsImage1 10 ; specifies the y-coordinate of the upper-left corner of the destination position at which to draw the image.
Ar_Append ar_DrawElements ar_DrawElementsImage1

let ar_DrawElementsImage2 := ar_construct "array"
Ar_Append ar_DrawElementsImage2 11 ;ImageEx(see below)
Ar_Append ar_DrawElementsImage2 "TESTINGEx.jpg" ;Image to Draw
Ar_Append ar_DrawElementsImage2 10 ;specifies the x-coordinate of the upper-left corner of the destination position at which to draw the image.
Ar_Append ar_DrawElementsImage2 10 ; specifies the y-coordinate of the upper-left corner of the destination position at which to draw the image.
Ar_Append ar_DrawElementsImage2 50 ; specifies the x-coordinate of the upper-left corner of the portion of the source image to be drawn.
Ar_Append ar_DrawElementsImage2 50 ; specifies the y-coordinate of the upper-left corner of the portion of the source image to be drawn.
Ar_Append ar_DrawElementsImage2 10 ; specifies the width of the portion of the source image to be drawn.
Ar_Append ar_DrawElementsImage2 10 ;  specifies the height of the portion of the source image to be drawn.
Ar_Append ar_DrawElements ar_DrawElementsImage2



let ar_DrawElementsLine1 := ar_construct "array"
Ar_Append ar_DrawElementsLine1 20 ;Line
Ar_Append ar_DrawElementsLine1 10 ; Width
Ar_Append ar_DrawElementsLine1 0 ; ColorR
Ar_Append ar_DrawElementsLine1 255 ; ColorG
Ar_Append ar_DrawElementsLine1 0 ; ColorB
Ar_Append ar_DrawElementsLine1 255 ; Alpha
Ar_Append ar_DrawElementsLine1 40 ; PosX of line origin
Ar_Append ar_DrawElementsLine1 40 ; PosY of line origin
Ar_Append ar_DrawElementsLine1 200 ; PosX of line target
Ar_Append ar_DrawElementsLine1 200 ; PosY of line target
Ar_Append ar_DrawElements ar_DrawElementsLine1

DrawTextToDDSTextureAndSave "MyMod" "MYTextureTest.dds" ar_DrawElements 500 500

Alternatively all sub array can be created via "Ar_construct"

let ar_DrawElementsText1 := Ar_List 1,"MyText","Arial",16,100,500,255,0,0,255
let ar_DrawElementsLine1 := Ar_List 20, 10,0,255,0,255,40,40,200,200


Avaiable elements to add

Those types specified as a number in the first element of the sub array(see examples above)

1 - Text(string Text,string Font,int FontSize,float PosX,float PosY, int ColorR,int ColorG, int ColorB, int Alpha). Draws text to the file.
10 - Image(string FileName,int PosX,Int PosY); Draws image to the file.
11 - ImageEx(string FileName,int PosX,Int PosY, int srcx, int srcy, int srcwidth, int srcheight);Draws image to the file from specific point of specified image.
20 - Line(int Width,int ColorR,int ColorG,int Alpha,float fPosXOrig,float fPosYOrig,float fPosXTarget,float fPosYTarget)


Notes

  • Sub array elements must be placed in specified order.
  • You can add as many elements as you like by adding more sub arrays to the main array.
  • All folders and files are outputted to "Data\textures\SUPTextures\" folder. If you're using MO2 - they will be written into MO2 "Overwrite" folder.
  • .DDS format is not real DDS texture but it can be read by game XML files and possibly be used as textures for in-game models so you can use with SwapTexture after extracting.
  • If there is a file in folder with the same name - it will be overwritten.

See Also