Bitmap Class

 

About Bitmap Class

 

Bitmap class is mainly used for loading and managing bitmaps.

 

Bitmap Class Methods

 

Bitmap.Add( string FileName ) Adds a .BMP file. If the function succeeds, the return value is the handle of the newly loaded resource. If the function fails, the return value is 0.

string FileName: the name of the file.

 

Bitmap.Delete( long BitmapHandle ) Deletes a bitmap and frees any memory the bitmap occupied. If the function succeeds, the return value is true. If the function fails, the return value is false.

long BitmapHandle: bitmap handle.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.Windows.API;

public class CodeExample : MonoBehaviour
{

private long WindowHandle = 0;
private long IconHandle = 0;
private long BitmapHandle = 0;

void Start()
{
Plugin.Initialize();//Initializes Giavapps Windows API
IconHandle = Icon.Add("icon.ico");//adds a new icon
BitmapHandle = Bitmap.Add("bitmap.bmp");//adds a new bitmap
WindowHandle = Window.Create(0, 100, 100, 400, 400, Constant.WS_VISIBLE | Constant.WS_SYSMENU | Constant.WS_MINIMIZEBOX | Constant.WS_MAXIMIZEBOX | Constant.WS_SIZEBOX, Constant.WS_EX_TOPMOST);//Creates a new window
Window.SetIcon(WindowHandle, IconHandle, Constant.ICON_SMALL);//Sets the previously added icon to the window
Control.SetText(WindowHandle, "Giavapps Windows API");//Sets a new title for the specified window
ButtonHandle = Button.Create(WindowHandle, 10, 10, 150, 32, Constant.WS_VISIBLE | Constant.WS_CHILD, 0);//creates a new button
Control.SetText(ButtonHandle, "Click Me");//Sets a new text for the specified button
Button.SetBitmap(ButtonHandle, BitmapHandle);//Sets the previously added bitmap to the button
}

void Update()
{

//Checks if the specified window has been closed
if(Window.GetClosed(WindowHandle))
{
Control.Destroy(WindowHandle);//Destroys the specified window
}

//Checks if the specified button has been clicked
if(Button.GetClicked(ButtonHandle))
{
Debug.Log("BUTTON CLICKED!");
}

}

void OnApplicationQuit()
{
Icon.Delete(IconHandle);//deletes the previously added icon
Bitmap.Delete(BitmapHandle);//deletes the previously added bitmap
Plugin.Deinitialize();//Deinitializes Giavapps Windows API
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.