Matlab-如何在黑色全屏上绘制像素? [英] Matlab - how to draw pixels on a black full screen?

查看:178
本文介绍了Matlab-如何在黑色全屏上绘制像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望matlab向我展示全黑的全屏屏幕,并能够在其上设置像素.

I want matlab to show me a full screen, all black, and to be able to set pixels on it.

有可能吗?

推荐答案

使用纯MATLAB代码不能完全做到这一点.在Windows上,我尝试了不同的组合,但是任务栏仍将位于顶部(带有开始"按钮的那个):

You can't totally do that using pure MATLAB code. On Windows, I tried different combinations, but the taskbar will still be on top (the one with the Start button):

%# 1)
sz = get(0, 'ScreenSize');
figure('Menubar','none', 'WindowStyle','modal', ...
    'Units','pixels', 'Position', [0 0 sz(3) sz(4)])

%# 2)
figure('Menubar','none', 'Units','normalized', 'Position',[0 0 1 1])

%# 3)
hFig = figure('Menubar','none', 'Units','normalized', 'Position',[0 0 1 1]);
set(hFig, 'Units','pixels')
p = get(hFig, 'Position');
set(hFig, 'Position', [1 31 p(3) p(4)-8]);

您将必须编写MEX函数并直接调用Win32 API.幸运的是, FEX 上应该有实现这种功能的现有提交.

You would have to write a MEX function and call the the Win32 API directly. Fortunately, there should be existing submissions on FEX implementing such functionality.

这里是创建全屏图形并用鼠标绘制点的示例.我正在使用 Jan Simon

Here is an example of creating a full screen figure, and drawing points with the mouse. I am using the WindowAPI solution by Jan Simon

%# open fullscreen figure
hFig = figure('Menubar','none');
WindowAPI(hFig, 'Position','full');

%# setup axis
axes('Color','k', 'XLim',[0 1], 'YLim',[0 1], ...
    'Units','normalized', 'Position',[0 0 1 1], ...
    'ButtonDownFcn',@onClick)

回调函数:

function onClick(hObj,ev)
    %# draw point
    p  = get(hObj,'CurrentPoint');
    line(p(1,1), p(1,2), 'Color','r', 'LineStyle','none', ...
        'Marker','.', 'MarkerSize',40, 'Parent',hObj)
end

这篇关于Matlab-如何在黑色全屏上绘制像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆