Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Empyrean.ColorPicker.Dropper Class Reference
Inheritance diagram for Empyrean.ColorPicker.Dropper:

Public Member Functions

void PickColors (Action< Color > onColorPicked, Action onDropCanceled)
 
void Stop ()
 

Public Attributes

Coroutine coroutine
 
Action onDropCanceled
 

Static Public Attributes

const int BlockWidth = 16
 
const int BlockHeight = 16
 

Private Member Functions

void Awake ()
 
void Start ()
 
void Update ()
 
void UpdateRenderTextureIfNecessary ()
 
IEnumerator EnlargeAreaAroundPointer ()
 
void UpdateTexture ()
 
void UpdateColorByMousePosition ()
 
void OnBlockerClicked ()
 

Private Attributes

ColorPalette palette
 
Button blockerPrefab
 
Button blocker
 
RenderTexture renderTexture
 
Texture2D texture2D
 
Texture2D pixelBlock
 
Color color
 
Color[] black16x16 = new Color[256]
 
Action< ColoronColorPicked
 

Detailed Description

Definition at line 8 of file Dropper.cs.

Member Function Documentation

◆ Awake()

void Empyrean.ColorPicker.Dropper.Awake ( )
inlineprivate

Definition at line 38 of file Dropper.cs.

39 {
40 Camera.main.targetTexture = renderTexture;
41 renderTexture = new RenderTexture(Screen.width, Screen.height, 24);
42 texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, mipChain: false);
43 pixelBlock = new Texture2D(16, 16, TextureFormat.ARGB32, mipChain: false);
44 for (int i = 0; i < black16x16.Length; i++)
45 {
46 black16x16[i] = Color.black;
47 }
48 }
RenderTexture renderTexture
Definition: Dropper.cs:22

References Empyrean.ColorPicker.Dropper.black16x16, Color, Empyrean.ColorPicker.Dropper.pixelBlock, Empyrean.ColorPicker.Dropper.renderTexture, and Empyrean.ColorPicker.Dropper.texture2D.

◆ EnlargeAreaAroundPointer()

IEnumerator Empyrean.ColorPicker.Dropper.EnlargeAreaAroundPointer ( )
inlineprivate

Definition at line 67 of file Dropper.cs.

68 {
69 while (true)
70 {
71 yield return new WaitForEndOfFrame();
74 int num = (int)Mathf.Clamp(Input.mousePosition.x, 0f, texture2D.width);
75 int num2 = (int)Mathf.Clamp(Input.mousePosition.y, 0f, texture2D.height);
76 Vector2 vector = new Vector2(num - 8, num2 - 8);
77 Vector2 vector2 = new Vector2(num + 8, num2 + 8);
78 Vector2 vector3 = new Vector2(Mathf.Clamp(vector.x, 0f, texture2D.width - 8), Mathf.Clamp(vector.y, 0f, texture2D.height - 8));
79 Vector2 vector4 = new Vector2(Mathf.Clamp(vector2.x, 8f, texture2D.width), Mathf.Clamp(vector2.y, 8f, texture2D.height));
80 int blockWidth = (int)vector4.x - (int)vector3.x;
81 int blockHeight = (int)vector4.y - (int)vector3.y;
82 Color[] pixels = texture2D.GetPixels((int)vector3.x, (int)vector3.y, blockWidth, blockHeight);
83 float num3 = vector3.x - vector.x;
84 float num4 = vector3.y - vector.y;
85 pixelBlock.SetPixels(0, 0, 16, 16, black16x16);
86 pixelBlock.SetPixels((int)num3, (int)num4, blockWidth, blockHeight, pixels);
88 }
89 }
void ShowEnlargedPixels(Color[] colors)

References Empyrean.ColorPicker.Dropper.black16x16, Color, Empyrean.ColorPicker.Dropper.palette, Empyrean.ColorPicker.Dropper.pixelBlock, Empyrean.ColorPicker.ColorPalette.ShowEnlargedPixels(), Empyrean.ColorPicker.Dropper.texture2D, Empyrean.ColorPicker.Dropper.UpdateColorByMousePosition(), and Empyrean.ColorPicker.Dropper.UpdateTexture().

Referenced by Empyrean.ColorPicker.Dropper.PickColors().

◆ OnBlockerClicked()

void Empyrean.ColorPicker.Dropper.OnBlockerClicked ( )
inlineprivate

◆ PickColors()

void Empyrean.ColorPicker.Dropper.PickColors ( Action< Color onColorPicked,
Action  onDropCanceled 
)
inline

Definition at line 102 of file Dropper.cs.

103 {
104 this.onDropCanceled = onDropCanceled;
105 this.onColorPicked = onColorPicked;
106 palette.ShowDropperMarker(value: true);
107 blocker = UnityEngine.Object.Instantiate(blockerPrefab);
108 blocker.onClick.AddListener(OnBlockerClicked);
109 coroutine = blocker.StartCoroutine(EnlargeAreaAroundPointer());
110 }
IEnumerator EnlargeAreaAroundPointer()
Definition: Dropper.cs:67

References Empyrean.ColorPicker.Dropper.blocker, Empyrean.ColorPicker.Dropper.blockerPrefab, Empyrean.ColorPicker.Dropper.coroutine, Empyrean.ColorPicker.Dropper.EnlargeAreaAroundPointer(), Empyrean.ColorPicker.Dropper.OnBlockerClicked(), Empyrean.ColorPicker.Dropper.onColorPicked, Empyrean.ColorPicker.Dropper.onDropCanceled, Empyrean.ColorPicker.Dropper.palette, and Empyrean.ColorPicker.ColorPalette.ShowDropperMarker().

Referenced by Empyrean.ColorPicker.ColorPicker.StartDropper().

◆ Start()

void Empyrean.ColorPicker.Dropper.Start ( )
inlineprivate

Definition at line 50 of file Dropper.cs.

51 {
52 }

◆ Stop()

void Empyrean.ColorPicker.Dropper.Stop ( )
inline

◆ Update()

void Empyrean.ColorPicker.Dropper.Update ( )
inlineprivate

◆ UpdateColorByMousePosition()

void Empyrean.ColorPicker.Dropper.UpdateColorByMousePosition ( )
inlineprivate

◆ UpdateRenderTextureIfNecessary()

void Empyrean.ColorPicker.Dropper.UpdateRenderTextureIfNecessary ( )
inlineprivate

Definition at line 59 of file Dropper.cs.

60 {
61 if (renderTexture.width != Screen.width || renderTexture.height != Screen.height)
62 {
63 renderTexture = new RenderTexture(Screen.width, Screen.height, 24);
64 }
65 }

References Empyrean.ColorPicker.Dropper.renderTexture.

Referenced by Empyrean.ColorPicker.Dropper.Update().

◆ UpdateTexture()

void Empyrean.ColorPicker.Dropper.UpdateTexture ( )
inlineprivate

Definition at line 91 of file Dropper.cs.

92 {
93 texture2D.ReadPixels(new Rect(0f, 0f, renderTexture.width, renderTexture.height), 0, 0);
94 texture2D.Apply();
95 }

References Empyrean.ColorPicker.Dropper.renderTexture, and Empyrean.ColorPicker.Dropper.texture2D.

Referenced by Empyrean.ColorPicker.Dropper.EnlargeAreaAroundPointer().

Member Data Documentation

◆ black16x16

Color [] Empyrean.ColorPicker.Dropper.black16x16 = new Color[256]
private

◆ blocker

Button Empyrean.ColorPicker.Dropper.blocker
private

◆ blockerPrefab

Button Empyrean.ColorPicker.Dropper.blockerPrefab
private

Definition at line 14 of file Dropper.cs.

Referenced by Empyrean.ColorPicker.Dropper.PickColors().

◆ BlockHeight

const int Empyrean.ColorPicker.Dropper.BlockHeight = 16
static

Definition at line 18 of file Dropper.cs.

◆ BlockWidth

const int Empyrean.ColorPicker.Dropper.BlockWidth = 16
static

Definition at line 16 of file Dropper.cs.

◆ color

Color Empyrean.ColorPicker.Dropper.color
private

◆ coroutine

Coroutine Empyrean.ColorPicker.Dropper.coroutine

◆ onColorPicked

Action<Color> Empyrean.ColorPicker.Dropper.onColorPicked
private

◆ onDropCanceled

Action Empyrean.ColorPicker.Dropper.onDropCanceled

◆ palette

◆ pixelBlock

Texture2D Empyrean.ColorPicker.Dropper.pixelBlock
private

◆ renderTexture

RenderTexture Empyrean.ColorPicker.Dropper.renderTexture
private

◆ texture2D


The documentation for this class was generated from the following file: