Images.sel

#!./Selene
--- Draw a circle in the middle of the screen

Selene.UseDRMCairo()

	-- Open default card.
	-- As no argument is passed it's the default one
	-- /dev/dri/card0
card,err,msg = SelDCCard.Open()
if not card then
	print("*E*", err,msg)
	os.exit()
end

local srf = card:GetPrimarySurface()
local w,h = srf:GetSize()	-- Retrieve its size
srf:Clear( 0,0,0 )	-- 100% green and no transparency

----------------------------

print "Loading PNG image"

local img,err = SelDCSurfaceImage.createFromPNG("../HomeDashboard_dev/SeleniteDFB/Images/Poseidon.png")
if not img then
	print("*E*",err)
	os.exit(EXIT_FAILURE)
end

print("Image size = ", img:GetSize())

-- Bliting orignial image
srf:Blit(img, 200,0)

local wimg,himg = img:GetSize()
srf:Blit(img, 70,100)

srf:SetColor(1,0,0)
srf:Blit(img, 300,350, wimg/2, himg/2 )
srf:DrawRectangle(300,350, wimg/2, himg/2)

srf:Blit(img, 500,350, 0,0, wimg/2, himg/2 )
srf:DrawRectangle(500,350, wimg/2, himg/2)

	-- If you want to scale a surface, you have to apply the Scale
	-- to the TARGET, the source remain unchanged
srf:Scale(0.25, 0.15)
srf:Blit(img, 450,150)

img:Release()
----------------------------

fch,err,msg = srf:Dump("/tmp","Image")
if not fch then	-- An error happened
	print("Can't dump", err, msg);
else
	print("Dumped to", fch);
end

print "Hit 'enter' key to exit"
io.stdin:read'*l'	-- wait for enter
	---
	-- cleanup
	---

srf:Release()
card:Release()
generated by LDoc 1.4.6 Last updated 2022-09-05 22:24:51