code
Member in Training
Posts: 74
|
Post by code on Sept 2, 2019 12:57:49 GMT
Hi , Based on this article: www.codeproject.com/Articles/14583/SWFLIB-a-free-Flash-authoring-library i made a console utility. The utility makes a sort of banner/flashmovie of three images 1.jpg 2.jpg 3.jpg and can be used in Justbasic. The 'banner' name is output.swf . Attachment DeletedPut the .bas file in the directory wher flash8.exe(see attachment) is, and also the 2 imges 1.jpg 2,jpg ... and 3.jpg you have to make yourself. Here the .bas file : UpperLeftY = 20
WindowWidth = 820
WindowHeight = 820
nomainwin
button #scr.b1, "Click to combine the 3 images", [b1], UL, 40, 300,200,60
open "Flash expiriment" for window as #scr
print #scr, "trapclose [quit]"
wait
[b1]
RUN "flash8"
wait
[quit]
close #scr
end
Maybe later some more on this... it was hard.... Regards, code
|
|
code
Member in Training
Posts: 74
|
Post by code on Sept 2, 2019 13:01:59 GMT
I see no attachment ...
Then it will not work for now.
|
|
code
Member in Training
Posts: 74
|
Post by code on Sept 2, 2019 14:33:43 GMT
|
|
code
Member in Training
Posts: 74
|
Post by code on Sept 2, 2019 17:09:30 GMT
Ok... now i will show you the console code: #include "stdafx.h" #include <iostream> #include "SWFMovie.h" #pragma comment(lib,"swflib.lib") int main() { CSWFMovie swfMovie;
SIZE_F movieSize = {400, 400}; int frameRate = 1; POINT_F pt;
swfMovie.OpenSWFFile("output.swf", movieSize, frameRate); SWF_RGB bgColor = {255, 255, 255}; swfMovie.SetBackgroundColor(bgColor);
CSWFBitmap bitmap(1, (UCHAR*)"1.jpg");
swfMovie.DefineObject(&bitmap, 2, false); USHORT depth = 1;
RECT_F shapeRect = {0, 0, 400, 400};
CSWFShape shape(3, shapeRect,depth);
SWF_RGBA lineColor = {0, 0, 0, 255}; shape.AddLineStyle(3, lineColor); RECT_F bitmapRect = {0, 0,400, 400}; // size of the bitmap RECT_F clipRect = {0, 0, 400, 400}; // where to fill shape.AddBitmapFillStyle(bitmap.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect); pt.x = 0; pt.y = 0; shape.ChangeStyle(1, 1, 0, &pt); shape.AddLineSegment(400, 0); shape.AddLineSegment(0, 400); shape.AddLineSegment(-400, 0); shape.AddLineSegment(0, -400); swfMovie.DefineObject(&shape, 5, true); swfMovie.ShowFrame(); ////frame2
CSWFBitmap bitmap2(2, (UCHAR*)"2.jpg");
swfMovie.DefineObject(&bitmap2, 6, false); CSWFShape shape2(7, shapeRect,depth); shape2.AddLineStyle(8, lineColor); shape2.AddBitmapFillStyle(bitmap2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect); pt.x = 0; pt.y = 0; shape2.ChangeStyle(1, 1, 0, &pt); shape2.AddLineSegment(400, 0); shape2.AddLineSegment(0, 400); shape2.AddLineSegment(-400, 0); shape2.AddLineSegment(0, -400); swfMovie.DefineObject(&shape2, 10, true); swfMovie.ShowFrame();
////frame3
CSWFBitmap bitmap3(9, (UCHAR*)"3.jpg");
swfMovie.DefineObject(&bitmap3, 11, false); CSWFShape shape3(12, shapeRect,depth); shape3.AddLineStyle(13, lineColor); shape3.AddBitmapFillStyle(bitmap3.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect); pt.x = 0; pt.y = 0; shape3.ChangeStyle(1, 1, 0, &pt); shape3.AddLineSegment(400, 0); shape3.AddLineSegment(0, 400); shape3.AddLineSegment(-400, 0); shape3.AddLineSegment(0, -400); swfMovie.DefineObject(&shape3, 14, true); swfMovie.ShowFrame();
swfMovie.CloseSWFFile();
}
As far as I remember the above posted code is more working than the example on : codeprojectI made it with Visual C++ 6.0... so it was more easy for me to make the utility.... So , if you wanna make your own utility ... you have your hands on this more advanced code... Thats it. Goodluck if you wanna make your own utility... Regards, code
|
|
code
Member in Training
Posts: 74
|
Post by code on Sept 4, 2019 13:02:04 GMT
Hi, In Justbasic we can make .bmp files : open "Bmpsave Test" for graphics_nf_nsb as #g
#g "fill black"
#g "font arial 15"
#g "down;color white;backcolor blue; place 40 40"
print #scr.te1, "!contents? res1$"
#g "\"+res1$
#g "getbmp image1 0 0 640 480"
But for the flash8.exe we need .jpg files... so we need a .bmp to .jpg converter Is making a converter difficult ....etc I made a little program co.exe (see attachment) wich converts temp1.bmp to temp2.jpg This two names are in the code of the little program : co.exe It worked... Maybe with DOS commands you can rename 1.bmp to temp1.bmp and the run co.exe it will output temp2.jpg , rename that also...
Thats the trick.... but have not tested it... and it can be pretty slow..
Here a link to help make your own converter...??
stackoverflow.com/questions/39728855/saving-a-jpg-from-a-bmp-using-gdi-with-a-set-dpi
Regards,
code
Attachments:co.exe (50.5 KB)
|
|
code
Member in Training
Posts: 74
|
Post by code on Feb 8, 2022 22:17:02 GMT
Hello here again.... I did some search to make from .bmp file a .jpg file I found the command: C:\test\ren test.bmp new.jpg On win10
So probally there is no need for co.exe (i have not tested it...)
Regards,
code
|
|
|
Post by tsh73 on Feb 9, 2022 8:31:20 GMT
Hello code BMP is typically bigger (say 10x ) then JPG so even if SWF will work on renamed BMP, it will be 10x bigger?
Also might be handy Load PNG jbfilesarchive.com/phpBB3/./viewtopic.php?f=27&t=2143 tiny command line PNG to BMP, JPG to BMP converter
|
|
code
Member in Training
Posts: 74
|
Post by code on Feb 11, 2022 7:02:13 GMT
Thx for the info tsh73.
I did some experiments with powershell to get a .jpg out of a .bmp ... looks i did get some result.
To test it yourself, put a .bmp file in the C:\ren\ directory.
Put a file(test.ps1) also in that directory in that file write the following:
Write-Host " " Write-Host "Justbasic..." $PSVersionTable
[void] [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $DestDir = "C:\ren\" $SrcDir = "C:\ren\" PushD $SrcDir Get-ChildItem *.bmp | ForEach-Object{ $NewFileName = ( Join-Path $DestDir ($_.BaseName.SubString(0)+'.jpg' )) $Picture = new-object System.Drawing.Bitmap($_.FullName) $Picture.Save($NewFileName ,"JPEG") } PopD
And then run it with something like:
RUN"Powershell.exe -executionpolicy bypass -File C:\ren\test.ps1"
After that there should be a .jpg in the directory C:\ren\
Thats in short... i have not done much testing....maybe later.
Goodluck !
Regards,
code
|
|
code
Member in Training
Posts: 74
|
Post by code on Feb 12, 2022 20:29:57 GMT
The command: Doesn't work... security issue?(win10) Poor me!
|
|
|
Post by Rod on Feb 13, 2022 8:40:45 GMT
Any arguments after the command will need wrapped in quotes if there are spaces within the arguments
|
|