Ehhlang Objects
Introduction
Ehhlang is a domain specific language (DSL) to create images. It is designed to be simple and easy to use. This document will cover the objects in Ehhlang and how to use them.
Objects
Objects are the elements that are drawn on the canvas. In Ehhlang, you can create different types of objects like text, rectangle, circle, line, etc. Each object has its own properties that define its appearance and behavior.
Properties
Properties are the attributes of the objects. Each object has its own set of properties that define its appearance and behavior. For example, the text
object has properties like fontScale
, thickness
, color
, position
, and text
.
Inheritance (::)
Inheritance is a mechanism in which a new object is created from an existing object. The new object inherits all the properties of the existing object and can have its own properties as well. In Ehhlang, inheritance is represented by the ::
operator. You can use the ::
operator to create a new object from an existing object.
Example
In the above example, we have created a new object HelloEhh
from the existing object text
. The HelloEhh
object inherits all the properties of the text
object and has its own properties fontScale
, thickness
, color
, position
, and text
.
Conclusion
Objects and inheritance are powerful features of Ehhlang that allow you to create complex images with minimal effort. You can use objects to draw different elements on the canvas and use inheritance to create new objects from existing objects. This helps you to reuse code and build a hierarchy of objects.