View Single Post
Old 2007-08-23, 11:50   Link #4
MexFX
Waiting...
*Fansubber
 
Join Date: Jan 2007
Location: Arabian world
Age: 35
?

I hope this well asked questios :P

I'm trying to draw the text via pixel dots :



Code:
function render_frame(f, t) local text = overlua_datastring or "Bingo !" local w, h = f.width, f.height surface = cairo.image_surface_create(w, h, "argb32") contex = surface.create_context() draw_text(contex,30,240,50,text,1,0,0,1)
for i = 0 , w do for j = 0,h do --[[ I really don't know why I'm doing this >< .... if I didn't test every pixel , the script never run , at the same time , it's no diffrent if I test "r" , "g" or "blue" .....they all give me what I want .... well , Idon't care , since it work fine ]]
local r, g, b = surface.get_pixel(i, j) if r == 255 then --the original text is pure red
draw_text(contex,7,i,j+30,".",1,1,0,1)
end
end end
f.overlay_cairo_surface(surface,0,0)
end
function draw_text(ctx,font_size,xPos,yPos,text_to_draw,red,green,blue,alpha) ctx.select_font_face("Disney Comic", "", "bold") ctx.set_source_rgba(red, green, blue , alpha) ctx.set_font_size(font_size) ctx.move_to(xPos, yPos) ctx.text_path(text_to_draw) ctx.fill() end
it works fine and draw the text via pixel dots , but there's a problem
-I want to know how to get rid of the original text & keep the the "pixel dots" one ...

I tried to give it zero alpha , but the both disappear >_< ..EDIT : also make two surface for each one then kill the original won't work(actually it's stupid:P)

-is there any better way to draw text via pixel dots

- any hints of how to make something :

Spoiler for this:

Last edited by MexFX; 2007-08-23 at 12:22. Reason: my bad English
MexFX is offline   Reply With Quote